[Crash-utility] [PATCH 1/1] Handle task_struct cpu member changes in linux-next

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Thu Nov 4 03:09:11 UTC 2021


-----Original Message-----
> -----Original Message-----
> > > Kernel commit bcf9033e5449bdcaa9bed46467a7141a8049dadb
> > > ("sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y")
> > > moved the member cpu of task_struct back into thread_info.

I can see the commit in mainline, and applied.

Thanks,
Kazu

> > >
> > > https://lkml.org/lkml/2021/9/30/517
> > >
> > > This fixes the following problem:
> > >
> > > please wait... (gathering task table data)
> > > crash: invalid structure member offset: task_struct_cpu
> > >        FILE: task.c  LINE: 2904  FUNCTION: add_context()
> > >
> > > [/usr/bin/crash] error trace: 114840a => 115560a => 114e360 => 11d6394
> > >
> > >   11d6394: (undetermined)
> > >   114e360: (undetermined)
> > >   115560a: (undetermined)
> > >   114840a: task_init+4634
> > >
> > > Signed-off-by: Alexander Egorenkov <egorenar at linux.ibm.com>
> > > ---
> > >  task.c | 7 ++++---
> > >  1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/task.c b/task.c
> > > index 672b41697e75..bb6a5da8ad33 100644
> > > --- a/task.c
> > > +++ b/task.c
> > > @@ -278,8 +278,10 @@ task_init(void)
> > >         } else if (VALID_MEMBER(task_struct_stack))
> > >                 MEMBER_OFFSET_INIT(task_struct_thread_info, "task_struct", "stack");
> > >
> > > +       MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
> > > +
> > >         if (VALID_MEMBER(task_struct_thread_info)) {
> > > -               if (tt->flags & THREAD_INFO_IN_TASK) {
> > > +               if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu)) {
> > >                         MEMBER_OFFSET_INIT(thread_info_flags, "thread_info", "flags");
> > >                         /* (unnecessary) reminders */
> > >                         ASSIGN_OFFSET(thread_info_task) = INVALID_OFFSET;
> > > @@ -315,7 +317,6 @@ task_init(void)
> > >          MEMBER_OFFSET_INIT(task_struct_has_cpu, "task_struct", "has_cpu");
> > >          MEMBER_OFFSET_INIT(task_struct_cpus_runnable,
> > >                 "task_struct", "cpus_runnable");
> > > -       MEMBER_OFFSET_INIT(task_struct_cpu, "task_struct", "cpu");
> > >         MEMBER_OFFSET_INIT(task_struct_active_mm, "task_struct", "active_mm");
> > >         MEMBER_OFFSET_INIT(task_struct_next_run, "task_struct", "next_run");
> > >         MEMBER_OFFSET_INIT(task_struct_flags, "task_struct", "flags");
> > > @@ -2900,7 +2901,7 @@ add_context(ulong task, char *tp)
> > >                 else
> > >                         tc->thread_info = ULONG(tp + OFFSET(task_struct_thread_info));
> > >                 fill_thread_info(tc->thread_info);
> > > -               if (tt->flags & THREAD_INFO_IN_TASK)
> > > +               if (tt->flags & THREAD_INFO_IN_TASK && VALID_MEMBER(task_struct_cpu))
> > >                         processor_addr = (int *) (tp + OFFSET(task_struct_cpu));
> > >                 else
> > >                         processor_addr = (int *) (tt->thread_info +
> > > --
> > > 2.31.1
> >
> > Thank you for the fix, Alexander.
> > Acked-by: Lianbo Jiang <lijiang at redhat.com>
> 
> ok, we will merge this when the kernel commit gets into mainline.
> 
> Thanks,
> Kazu
> 
> 
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://listman.redhat.com/mailman/listinfo/crash-utility





More information about the Crash-utility mailing list