On Sat, Jun 27, 2020 at 06:12:14PM -0400, Steven Rostedt wrote:
> On Sat, 20 Jun 2020 13:41:36 +0300
> Mike Rapoport <[email protected]> wrote:
> 
> > From: Mike Rapoport <[email protected]>
> > 
> > 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.

Reply via email to