Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the union command sometimes can't works #59

Open
prettykernel opened this issue Jul 24, 2020 · 4 comments
Open

the union command sometimes can't works #59

prettykernel opened this issue Jul 24, 2020 · 4 comments

Comments

@prettykernel
Copy link


# crash /usr/lib/debug/usr/lib/modules/5.7.9-200.fc32.x86_64/vmlinux
crash 7.2.8-2.fc32

crash> union bpf_attr    // works well 
crash> bpf_attr
crash> *bpf_attr 

crash> union thread_union
union: invalid data structure reference: thread_union

crash> union thread_union init_thread_union
union: invalid data structure reference: thread_union

crash> thread_union
crash: command not found: thread_union

crash> *thread_union
*: invalid data structure reference: thread_union


// include/linux/sched.h
union thread_union {
#ifndef CONFIG_ARCH_TASK_STRUCT_ON_STACK
	struct task_struct task;
#endif
#ifndef CONFIG_THREAD_INFO_IN_TASK
	struct thread_info thread_info;
#endif
	unsigned long stack[THREAD_SIZE/sizeof(long)];
};

#grep CONFIG_ARCH_TASK_STRUCT_ON_STACK /boot/config-`uname -r`

#grep CONFIG_THREAD_INFO_IN_TASK /boot/config-`uname -r`
CONFIG_THREAD_INFO_IN_TASK=y

//include/asm-generic/vmlinux.lds.h
#define INIT_TASK_DATA(align)						\
	. = ALIGN(align);						\
	__start_init_task = .;						\
	init_thread_union = .;						\
	init_stack = .;							\
	KEEP(*(.data..init_task))					\
	KEEP(*(.data..init_thread_info))				\
	. = __start_init_task + THREAD_SIZE;				\
	__end_init_task = .;

crash> sym init_thread_union
ffffffff8f800000 (D) init_thread_union
crash> sym init_stack
ffffffff8f800000 (D) init_stack

@k-hagio
Copy link
Contributor

k-hagio commented Jul 29, 2020

Hmm, is there the debug info for union thread_union in the vmlinux?

$ gdb /usr/lib/debug/lib/modules/4.18.0-193.el8.x86_64/vmlinux
...
(gdb) info types thread_union
All types matching regular expression "thread_union":

File ./include/linux/sched.h:
1619:   union thread_union;
(gdb) ptype init_thread_union
type = union thread_union {
    struct task_struct task;
    unsigned long stack[2048];
}
(gdb)

@prettykernel
Copy link
Author

prettykernel commented Aug 3, 2020

Hi, it can't work in Fedora 32, but it works well in Ubuntu 18.04/20.04 and CentOS 8, 
and the definition of thread_union are the same in kernel v4.18 and v5.7.9.

Why there is no debug info for thread_union ?

#gdb /usr/lib/debug/lib/modules/5.7.9-200.fc32.x86_64/vmlinux
GNU gdb (GDB) Fedora 9.1-5.fc32
Reading symbols from /usr/lib/debug/lib/modules/5.7.9-200.fc32.x86_64/vmlinux...
(gdb) info types thread_union
All types matching regular expression "thread_union":
(gdb) ptype init_thread_union
type = <data variable, no debug info>


#crash /usr/lib/debug/usr/lib/modules/5.7.9-200.fc32.x86_64/vmlinux
crash 7.2.8-2.fc32
GNU gdb (GDB) 7.6
This GDB was configured as "x86_64-unknown-linux-gnu"...
crash> i ty thread_union
All types matching regular expression "thread_union":
crash> ptype init_thread_union
type = <data variable, no debug info>

@k-hagio
Copy link
Contributor

k-hagio commented Aug 3, 2020

Why there is no debug info for thread_union ?

I'm not sure. Fedora kernel team might know about it, could you ask them?

@bhupesh-sharma, @lian-bo
FYI. I hope that future RHEL kernels won't have the same phenomenon..

@k-hagio
Copy link
Contributor

k-hagio commented Aug 20, 2020

Just a note, found a couple of threads related to this phenomenon in the mail list:
https://www.redhat.com/archives/crash-utility/2018-April/msg00004.html
https://www.redhat.com/archives/crash-utility/2018-April/msg00010.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants