From: Peter Zijlstra <peterz@infradead.org>
To: Ron Economos <re@w6rz.net>
Cc: Valentin Schneider <vschneid@redhat.com>,
Ruidong Tian <tianruidong@linux.alibaba.com>,
mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
kprateek.nayak@amd.com, linux-kernel@vger.kernel.org,
oliver.yang@linux.alibaba.com, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2] sched: move stack_canary to the start of the randomizable region
Date: Thu, 12 Nov 2026 16:34:27 +0100 [thread overview]
Message-ID: <20261112153427.GV1779021@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <34f2ff11-8156-4c32-91dc-e4576807cf3b@w6rz.net>
On Thu, Nov 12, 2026 at 05:33:16AM -0800, Ron Economos wrote:
> > ---
> > From: Peter Zijlstra <peterz@infradead.org>
> > Date: Fri, 6 Nov 2026 17:07:30 +0100
> > Subject: [PATCH] riscv, sched: move stack_canary to thread_info
> >
> > task_struct keeps growing over time. On architectures that compute the
> > per-task stack canary offset from asm-offsets.h and pass it to the
> > compiler via -mstack-protector-guard-offset=, this growth eventually
> > pushes stack_canary beyond what the target ISA can encode.
> >
> > On RISC-V, canary loads are emitted as
> >
> > ld t0, TSK_STACK_CANARY(tp)
> >
> > where TSK_STACK_CANARY must fit into a 12-bit signed immediate, i.e.
> > [-2048, 2047]. Once stack_canary sits past byte 2047 of task_struct,
> > the build fails with
> >
> > cc1: error: '<N>' is not a valid offset in
> > '-mstack-protector-guard-offset='
> >
> > On RISC-V, CONFIG_STACKPROTECTOR_PER_TASK depends on !RANDSTRUCT, thus
> > stack_canary does not benefit from being in the task_struct randomized
> > region.
> >
> > Move the RISC-V stack_canary to thread_info, and introduce an access macro
> > to point to the right stack_canary location. Other archs are unaffected.
> >
> > Not-signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Valentin Schneider <vschneid@redhat.com>
> > ---
>
> I'm seeing this build failure on RISC-V with gcc 16 and
> CONFIG_SCHED_CLASS_EXT=y. The build does not fail with gcc 14. I've tested
> the proposed patch with gcc 16 and it builds and boots (on real hardware)
> just fine. So for what it's worth:
>
> Tested-by: Ron Economos <re@w6rz.net>
>
> Also re-adding the RISC-V folks.
Hmm, they went walk-about? Do they need a re-sent? I'm thinking this out
to perhaps go through their tree, given they're actually seeing the
problem.
prev parent reply other threads:[~2026-11-12 15:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 3:50 Ruidong Tian
2026-05-12 16:16 ` Valentin Schneider
2026-08-21 17:11 ` Charles Mirabile
2026-11-06 15:29 ` Valentin Schneider
2026-11-06 16:07 ` Peter Zijlstra
2026-11-06 16:14 ` Peter Zijlstra
2026-11-09 11:15 ` Valentin Schneider
2026-11-12 13:33 ` Ron Economos
2026-11-12 15:34 ` Peter Zijlstra [this message]
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=20261112153427.GV1779021@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=alex@ghiti.fr \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=oliver.yang@linux.alibaba.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=re@w6rz.net \
--cc=rostedt@goodmis.org \
--cc=tianruidong@linux.alibaba.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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
all inboxes | Powered by JetHome®