From: Peter Zijlstra <peterz@infradead•org>
To: Christophe Leroy <christophe.leroy@c-s•fr>
Cc: Benjamin Herrenschmidt <benh@kernel•crashing.org>,
Paul Mackerras <paulus@samba•org>,
Michael Ellerman <mpe@ellerman•id.au>,
Ingo Molnar <mingo@redhat•com>,
segher@kernel•crashing.org, linux-kernel@vger•kernel.org,
linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct
Date: Wed, 19 Sep 2018 13:58:36 +0200 [thread overview]
Message-ID: <20180919115836.GE24124@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <d60ce7dd74704b0ca0a857186f30de4006b63534.1537355312.git.christophe.leroy@c-s.fr>
On Wed, Sep 19, 2018 at 11:14:43AM +0000, Christophe Leroy wrote:
> In order to allow the use of non global stack protector canary,
> the stack canary needs to be located at a know offset defined
> in Makefile via -mstack-protector-guard-offset.
>
> On powerpc/32, register r2 points to current task_struct at
> all time, the stack_canary located inside task_struct can be
> used directly if it is located in a known place.
>
> In order to allow that, this patch moves the stack_canary field
> out of the randomized area of task_struct.
And you cannot use something like asm-offsets to extract this?
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s•fr>
> ---
> include/linux/sched.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 977cb57d7bc9..1d977b8a4bac 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -601,6 +601,10 @@ struct task_struct {
> /* -1 unrunnable, 0 runnable, >0 stopped: */
> volatile long state;
>
> +#ifdef CONFIG_STACKPROTECTOR
> + /* Canary value for the -fstack-protector GCC feature: */
> + unsigned long stack_canary;
> +#endif
> /*
> * This begins the randomizable portion of task_struct. Only
> * scheduling-critical items should be added above here.
Might as well put it before state, right after the task_info thing.
next prev parent reply other threads:[~2018-09-19 11:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 11:14 [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct Christophe Leroy
2018-09-19 11:14 ` [PATCH v2 2/2] powerpc/32: add stack protector support Christophe Leroy
2018-09-19 13:26 ` Segher Boessenkool
2018-09-19 14:22 ` Christophe LEROY
2018-09-19 14:32 ` Segher Boessenkool
2018-09-19 11:58 ` Peter Zijlstra [this message]
2018-09-19 12:25 ` [PATCH v2 1/2] sched: move stack_canary field at the top of task_struct Christophe LEROY
2018-09-19 12:52 ` Peter Zijlstra
2018-09-19 23:54 ` Michael Ellerman
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=20180919115836.GE24124@hirez.programming.kicks-ass.net \
--to=peterz@infradead$(echo .)org \
--cc=benh@kernel$(echo .)crashing.org \
--cc=christophe.leroy@c-s$(echo .)fr \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=mingo@redhat$(echo .)com \
--cc=mpe@ellerman$(echo .)id.au \
--cc=paulus@samba$(echo .)org \
--cc=segher@kernel$(echo .)crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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