Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-18 Thread Nicholas Miehlbradt
On 14/12/2022 10:39 pm, Nicholas Piggin wrote: On Wed Dec 14, 2022 at 6:39 PM AEST, Christophe Leroy wrote: Le 14/12/2022 à 05:42, Nicholas Miehlbradt a écrit : Walks the stack when copy_{to,from}_user address is in the stack to ensure that the object being copied is entirely within a

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-15 Thread Segher Boessenkool
On Thu, Dec 15, 2022 at 10:29:38AM -0600, Segher Boessenkool wrote: > The kernel does not do any of the more > problematic cases I think, but no promises (dynamic stack alignment, > recursive functions Before people get scared: I meant *nested* functions. With a static chain and all that :-)

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-15 Thread Segher Boessenkool
On Thu, Dec 15, 2022 at 10:52:35AM +1000, Nicholas Piggin wrote: > On Thu Dec 15, 2022 at 10:17 AM AEST, Segher Boessenkool wrote: > > On Wed, Dec 14, 2022 at 09:39:25PM +1000, Nicholas Piggin wrote: > > > What about just copying x86's implementation including using > > >

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Nicholas Piggin
On Thu Dec 15, 2022 at 10:17 AM AEST, Segher Boessenkool wrote: > On Wed, Dec 14, 2022 at 09:39:25PM +1000, Nicholas Piggin wrote: > > What about just copying x86's implementation including using > > __builtin_frame_address(1/2)? Are those builtins reliable for all > > our targets and compiler

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Segher Boessenkool
On Wed, Dec 14, 2022 at 09:39:25PM +1000, Nicholas Piggin wrote: > What about just copying x86's implementation including using > __builtin_frame_address(1/2)? Are those builtins reliable for all > our targets and compiler versions? __builtin_frame_address(n) with n > 0 is specifically not

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Christophe Leroy
Le 14/12/2022 à 12:48, Christophe Leroy a écrit : Le 14/12/2022 à 12:39, Nicholas Piggin a écrit : On Wed Dec 14, 2022 at 6:39 PM AEST, Christophe Leroy wrote: Le 14/12/2022 à 05:42, Nicholas Miehlbradt a écrit : Walks the stack when copy_{to,from}_user address is in the stack to

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Christophe Leroy
Le 14/12/2022 à 12:39, Nicholas Piggin a écrit : > On Wed Dec 14, 2022 at 6:39 PM AEST, Christophe Leroy wrote: >> >> >> Le 14/12/2022 à 05:42, Nicholas Miehlbradt a écrit : >>> Walks the stack when copy_{to,from}_user address is in the stack to >>> ensure that the object being copied is

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Nicholas Piggin
On Wed Dec 14, 2022 at 6:39 PM AEST, Christophe Leroy wrote: > > > Le 14/12/2022 à 05:42, Nicholas Miehlbradt a écrit : > > Walks the stack when copy_{to,from}_user address is in the stack to > > ensure that the object being copied is entirely within a single stack > > frame. > > > > Substatially

Re: [PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-14 Thread Christophe Leroy
Le 14/12/2022 à 05:42, Nicholas Miehlbradt a écrit : > Walks the stack when copy_{to,from}_user address is in the stack to > ensure that the object being copied is entirely within a single stack > frame. > > Substatially similar to the x86 implementation except using the back > chain to

[PATCH] powerpc/64: Implement arch_within_stack_frames

2022-12-13 Thread Nicholas Miehlbradt
Walks the stack when copy_{to,from}_user address is in the stack to ensure that the object being copied is entirely within a single stack frame. Substatially similar to the x86 implementation except using the back chain to traverse the stack and identify stack frame boundaries. Signed-off-by: