linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Nicholas Piggin <npiggin@gmail.com>,
	Nicholas Miehlbradt <nicholas@linux.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH] powerpc/64: Implement arch_within_stack_frames
Date: Wed, 14 Dec 2022 11:48:12 +0000	[thread overview]
Message-ID: <9fb5aedd-0a6a-8fb2-eeed-82d291455cf9@csgroup.eu> (raw)
In-Reply-To: <CP1IFJNCTTZ4.33ROBE5VAFAKM@bobo>



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 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: Nicholas Miehlbradt <nicholas@linux.ibm.com>
>>> ---
>>>    arch/powerpc/Kconfig                   |  1 +
>>>    arch/powerpc/include/asm/thread_info.h | 38 ++++++++++++++++++++++++++
>>>    2 files changed, 39 insertions(+)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index 2ca5418457ed..4c59d139ea83 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -198,6 +198,7 @@ config PPC
>>>    	select HAVE_ARCH_KASAN_VMALLOC		if HAVE_ARCH_KASAN
>>>    	select HAVE_ARCH_KFENCE			if ARCH_SUPPORTS_DEBUG_PAGEALLOC
>>>    	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
>>> +	select HAVE_ARCH_WITHIN_STACK_FRAMES	if PPC64
>>
>> Why don't you do something that works for both PPC32 and PPC64 ?
> 
> +1
> 
>>>    	select HAVE_ARCH_KGDB
>>>    	select HAVE_ARCH_MMAP_RND_BITS
>>>    	select HAVE_ARCH_MMAP_RND_COMPAT_BITS	if COMPAT
>>> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
>>> index af58f1ed3952..efdf39e07884 100644
>>> --- a/arch/powerpc/include/asm/thread_info.h
>>> +++ b/arch/powerpc/include/asm/thread_info.h
>>> @@ -186,6 +186,44 @@ static inline bool test_thread_local_flags(unsigned int flags)
>>>    #define is_elf2_task() (0)
>>>    #endif
>>>    
>>> +#ifdef CONFIG_PPC64
>>> +
>>> +#ifdef CONFIG_PPC64_ELF_ABI_V1
>>> +#define PARAMETER_SAVE_OFFSET 48
>>> +#else
>>> +#define PARAMETER_SAVE_OFFSET 32
>>> +#endif
>>
>> Why not use STACK_INT_FRAME_REGS, defined in asm/ptrace.h ?
> 
> I think use a STACK_FRAME prefixed define in asm/ptrace.h, but maybe
> avoid overloading the STACK_INT_ stuff for this.
> 

Maybe I should have written _already_ defined :

$ git grep -n STACK_INT_FRAME_REGS arch/powerpc/include/asm/
arch/powerpc/include/asm/ptrace.h:126:#define STACK_INT_FRAME_REGS 
(STACK_FRAME_MIN_SIZE + 16)
arch/powerpc/include/asm/ptrace.h:138:#define STACK_INT_FRAME_REGS 
STACK_FRAME_MIN_SIZE
arch/powerpc/include/asm/ptrace.h:155:#define STACK_INT_FRAME_REGS 
STACK_FRAME_MIN_SIZE


Christophe

  reply	other threads:[~2022-12-14 11:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  4:42 [PATCH] powerpc/64: Implement arch_within_stack_frames Nicholas Miehlbradt
2022-12-14  8:39 ` Christophe Leroy
2022-12-14 11:39   ` Nicholas Piggin
2022-12-14 11:48     ` Christophe Leroy [this message]
2022-12-14 11:54       ` Christophe Leroy
2022-12-15  0:17     ` Segher Boessenkool
2022-12-15  0:52       ` Nicholas Piggin
2022-12-15 16:29         ` Segher Boessenkool
2022-12-15 17:16           ` Segher Boessenkool
2022-12-19  6:32     ` Nicholas Miehlbradt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fb5aedd-0a6a-8fb2-eeed-82d291455cf9@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nicholas@linux.ibm.com \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).