From: Peter Zijlstra <peterz@infradead.org>
To: Kees Cook <keescook@chromium.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Christophe de Dinechin <dinechin@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Davidlohr Bueso <dave@stgolabs.net>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] sched/core: Do not treat class list boundary markers as arrays
Date: Mon, 16 May 2022 22:44:49 +0200 [thread overview]
Message-ID: <20220516204449.GO76023@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220516194241.3064242-1-keescook@chromium.org>
On Mon, May 16, 2022 at 12:42:41PM -0700, Kees Cook wrote:
> GCC 12 is very sensitive about array checking, and views all negative
> array accesses as unsafe (a not unreasonable position). Avoid the
> warnings about __begin_sched_classes being accessed via negative bounds
> by converting them to the pointers they actually are. Silences this
> warning:
Yeah, this patch is *much* saner, thanks!
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 8dccb34eb190..3d31ed9d33fa 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -2190,8 +2190,8 @@ const struct sched_class name##_sched_class \
> __section("__" #name "_sched_class")
>
> /* Defined in include/asm-generic/vmlinux.lds.h */
> -extern struct sched_class __begin_sched_classes[];
> -extern struct sched_class __end_sched_classes[];
> +extern struct sched_class *__begin_sched_classes;
> +extern struct sched_class *__end_sched_classes;
>
> #define sched_class_highest (__end_sched_classes - 1)
> #define sched_class_lowest (__begin_sched_classes - 1)
> --
> 2.32.0
>
next prev parent reply other threads:[~2022-05-16 21:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 19:42 [PATCH] sched/core: Do not treat class list boundary markers as arrays Kees Cook
2022-05-16 20:44 ` Peter Zijlstra [this message]
2022-05-19 8:12 ` [sched/core] 4eb47d360b: BUG:unable_to_handle_page_fault_for_address kernel test robot
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=20220516204449.GO76023@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dave@stgolabs.net \
--cc=dietmar.eggemann@arm.com \
--cc=dinechin@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
/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