Bug #1107
closedNull pointer dereference on boot with built-in lttng-modules
100%
Description
Booting a kernel (v4.4.68 stable branch) with the lttng-modules built-in crashes the kernel.
Procedure I followed:- run ./lttng-modules/built-in.sh ./linux
- Turning on the LTTng option in the .config
- cd ./linux && make
- Boot the kernel with qemu [1]
When booting, the VM hits a bug and prints this callstack [2].
I can successfully build and boot the kernel using that same command [1] when I turn off the lttng-modules in the .config.
lttng-modules commit: c6f05468ac90af73c0077095f5e57f287197e9d8
linux-stable 4.4.y commit: be90e260145c0463c7a5c80ced379adc2f4850cc
[1]
qemu-system-x86_64 deb.qcow2
-enable-kvm
-m 1G
-nographic
-kernel linux/arch/x86/boot/bzImage
-initrd linux/arch/x86/boot/initrd.img
-append "root=UUID=8bf5feb2-6f3a-4842-a242-70aad1afeb98 console=ttyS0"
Updated by Mathieu Desnoyers almost 7 years ago
Can you add printks between each called function within lttng_events_init so we can identify where it crashes ?
Updated by Michael Jeanson almost 7 years ago
The problematic code is in wrapper/tracepoint.h :
static inline
int wrapper_lttng_fixup_sig(struct module *mod)
{
int ret = 0;
/*
* This is for module.c confusing force loaded modules with
* unsigned modules.
*/
if (!THIS_MODULE->sig_ok &&
THIS_MODULE->taints & (1U << TAINT_FORCED_MODULE)) {
THIS_MODULE->taints &= ~(1U << TAINT_FORCED_MODULE);
ret = wrapper_tracepoint_module_notify(NULL,
MODULE_STATE_COMING, mod);
THIS_MODULE->taints |= (1U << TAINT_FORCED_MODULE);
}
return ret;
}
It's only enabled with CONFIG_MODULES_SIG and should probably be disabled when CONFIG_LTTNG=y
Updated by Mathieu Desnoyers almost 7 years ago
Francis is preparing a patch that adds a THIS_MODULE NULL pointer check to this function, which seems more robust.
Updated by Francis Deslauriers almost 7 years ago
Actually, GCC warns that THIS_MODULE is always true when building the lttng-modules as modules due to this [1] #ifdef.
I am adding #ifdef MODULE
guards to replace the wrapper_lttng_fixup_sig
function in the same way.
Updated by Mathieu Desnoyers almost 7 years ago
Fair point. The solution seems acceptable.
Updated by Francis Deslauriers almost 7 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset lttng-modules|0147ae6413de42a6f254a17793414c7f25e4f28a.