[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200628064403.GA576120@kernel.org>
Date: Sun, 28 Jun 2020 09:44:03 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Mike Rapoport <rppt@...ux.ibm.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH] sched: fix build with GCC_PLUGIN_RANDSTRUCT
On Sat, Jun 27, 2020 at 06:12:14PM -0400, Steven Rostedt wrote:
> On Sat, 20 Jun 2020 13:41:36 +0300
> Mike Rapoport <rppt@...nel.org> wrote:
>
> > From: Mike Rapoport <rppt@...ux.ibm.com>
> >
> > Since the commit a148866489fb ("sched: Replace rq::wake_list")
> > task_struct and CSD_TYPE_TTWU objects can be on the same queue and this
> > requires that have "layout similar enough".
> >
> > This assumption is broken when CONFIG_GCC_PLUGIN_RANDSTRUCT is enabled:
>
> You forgot to Cc Kees, who's the one that is probably the most
> concerned about randomizing structures!
I was not concerned about randomizing, I was troubled by failing
allyesconfig builds :)
> > /*
> > * This begins the randomizable portion of task_struct. Only
> > * scheduling-critical items should be added above here.
> > @@ -654,8 +663,6 @@ struct task_struct {
> > unsigned int ptrace;
> >
> > #ifdef CONFIG_SMP
> > - struct llist_node wake_entry;
> > - unsigned int wake_entry_type;
>
> What about instead just create an anonymous structure of the two. That
> way they can still be randomized within the task struct and not be a
> target of attacks?
>
> struct {
> struct llist_node wake_entry;
> unsigned int wake_entry_type;
> };
>
> Would that work?
Yep, thanks, this works.
Will send v2 soon.
> -- Steve
>
>
> > int on_cpu;
> > #ifdef CONFIG_THREAD_INFO_IN_TASK
> > /* Current CPU: */
>
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists