samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-multi-modify
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ e1067a07cfbc5a36abad3752fafe4c79e06db1bb · < 6727b7618f49401acf373fa3ec5712e2ec52e5cf| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
samples/ftrace: Fix kthread_stop() on ERR_PTR in ftrace-direct-multi-modify
ftrace_direct_multi_init() assigns kthread_run()'s return value to simple_tsk without an IS_ERR() check. When kthread_run() fails it returns ERR_PTR(-ENOMEM), but init still returns 0, so the module loads with simple_tsk holding an error pointer. On unload, ftrace_direct_multi_exit() then passes that ERR_PTR to kthread_stop(), leading to a null-pointer-dereference.
Check the return value of kthread_run() with IS_ERR(); on failure, unregister the ftrace direct call and propagate the error code.
From the CVE record · Linux
The ftrace-direct-multi-modify sample module can load with an error pointer if kthread_run() fails. Unloading the module then passes that pointer to kthread_stop(), causing a null-pointer dereference. The input does not establish an attacker path or authentication requirements.
Engineers running Linux kernels with the ftrace-direct-multi-modify sample module should check their exposure; affected versions are not specified.