Re: [RFC][PATCH 7/7] sched: Replace rq::wake_list

From: Steven Rostedt
Date: Thu Jun 18 2020 - 13:57:43 EST


On Tue, Jun 09, 2020 at 02:25:09PM -0700, Guenter Roeck wrote:
> >
> > Still occurring on Linus' tree. This needs to be fixed. (And not by removing
> > support for randstruct; that's not a "fix"...)
> >
>
> How about the hack below ?

My test suite failed due to this bug (on my allmodconfig test).

Your hack appears to fix it. I've applied it to my "fixes" patches applied to
my test suite before building my kernels.

Thanks!

-- Steve


>
> Guenter
>
> ---
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index c5d96e3e7fff..df1cbb04f9b3 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -629,6 +629,15 @@ struct wake_q_node {
> struct wake_q_node *next;
> };
>
> +/*
> + * Hack around assumption that wake_entry_type follows wake_entry even with
> + * CONFIG_GCC_PLUGIN_RANDSTRUCT=y.
> + */
> +struct _wake_entry {
> + struct llist_node wake_entry;
> + unsigned int wake_entry_type;
> +};
> +
> struct task_struct {
> #ifdef CONFIG_THREAD_INFO_IN_TASK
> /*
> @@ -653,8 +662,9 @@ struct task_struct {
> unsigned int ptrace;
>
> #ifdef CONFIG_SMP
> - struct llist_node wake_entry;
> - unsigned int wake_entry_type;
> + struct _wake_entry _we;
> +#define wake_entry _we.wake_entry
> +#define wake_entry_type _we.wake_entry_type
> int on_cpu;
> #ifdef CONFIG_THREAD_INFO_IN_TASK
> /* Current CPU: */