[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220516204449.GO76023@worktop.programming.kicks-ass.net>
Date: Mon, 16 May 2022 22:44:49 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kees Cook <keescook@...omium.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Christophe de Dinechin <dinechin@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] sched/core: Do not treat class list boundary markers as
arrays
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
>
Powered by blists - more mailing lists