[Crash-utility] [PATCH] crash-extension/gcore: fix the failure of invalid structure member offset
Bhupesh Sharma
bhsharma at redhat.com
Fri Aug 28 06:59:32 UTC 2020
Hi Lianbo,
Please note that we still need to formulate a way to maintain
crash-extension outside a tarball.
I am preparing a RFC proposal and will share it shortly.
On Fri, Aug 28, 2020 at 9:34 AM Lianbo Jiang <lijiang at redhat.com> wrote:
>
> With kernel commit: <577d5cd7e585> ("x86/ioperm: Move iobitmap data into
> a struct"), the io_bitmap_max and io_bitmap_ptr have been changed. And
> move the iobitmap data into a struct io_bitmap.
>
> So, the crash-gcore-command needs to be updated accordingly, otherwise,
> the gcore will fail as below:
>
> crash> bt -t|grep -i task
> PID: 3968 TASK: ffff9e512e97af80 CPU: 86 COMMAND: "bash"
> crash> gcore 3968
>
> gcore: invalid structure member offset: thread_struct_io_bitmap_max
> FILE: libgcore/gcore_x86.c LINE: 846 FUNCTION: ioperm_active()
>
> [./crash] error trace: 7f31fca56108 => 7f31fca593b7 => 53a4e1 => 53a463
>
> 53a463: OFFSET_verify.part.27+51
> 53a4e1: OFFSET_verify+49
>
> gcore: invalid structure member offset: thread_struct_io_bitmap_max
> FILE: libgcore/gcore_x86.c LINE: 846 FUNCTION: ioperm_active()
>
> Failed.
>
> Signed-off-by: Lianbo Jiang <lijiang at redhat.com>
> ---
> gcore.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcore.c b/gcore.c
> index 27a11938026a..e3e41ecb435b 100644
> --- a/gcore.c
> +++ b/gcore.c
> @@ -487,6 +487,10 @@ static void gcore_offset_table_init(void)
> GCORE_MEMBER_OFFSET_INIT(thread_struct_xstate, "thread_struct", "i387");
> GCORE_MEMBER_OFFSET_INIT(thread_struct_io_bitmap_max, "thread_struct", "io_bitmap_max");
> GCORE_MEMBER_OFFSET_INIT(thread_struct_io_bitmap_ptr, "thread_struct", "io_bitmap_ptr");
> + if (GCORE_INVALID_MEMBER(thread_struct_io_bitmap_max)) {
> + GCORE_MEMBER_OFFSET_INIT(thread_struct_io_bitmap_max, "io_bitmap", "max");
> + GCORE_MEMBER_OFFSET_INIT(thread_struct_io_bitmap_ptr, "io_bitmap", "bitmap");
> + }
Maybe its better to protect this with a kernel version check to
maintain backward compatibility. Something like:
(THIS_KERNEL_VERSION < LINUX(4,2,0))
Thanks,
Bhupesh
> GCORE_MEMBER_OFFSET_INIT(user_regset_n, "user_regset", "n");
> GCORE_MEMBER_OFFSET_INIT(vm_area_struct_anon_vma, "vm_area_struct", "anon_vma");
> GCORE_MEMBER_OFFSET_INIT(vm_area_struct_vm_ops, "vm_area_struct", "vm_ops");
> --
> 2.17.1
>
More information about the Crash-utility
mailing list