tracing/synthetic: Fix races on freeing last_cmd
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.1.246.2.116.3In the Linux kernel, the following vulnerability has been resolved:
tracing/synthetic: Fix races on freeing last_cmd
Currently, the "last_cmd" variable can be accessed by multiple processes asynchronously when multiple users manipulate synthetic_events node at the same time, it could lead to use-after-free or double-free.
This patch add "lastcmd_mutex" to prevent "last_cmd" from being accessed asynchronously.
================================================================
It's easy to reproduce in the KASAN environment by running the two scripts below in different shells.
script 1: while : do echo -n -e '\x88' > /sys/kernel/tracing/synthetic_events done
script 2: while : do echo -n -e '\xb0' > /sys/kernel/tracing/synthetic_events done
From the CVE record · Linux
A race in the Linux kernel’s synthetic event tracing can cause a double-free or use-after-free of `last_cmd`. It can occur when multiple local processes concurrently write to `/sys/kernel/tracing/synthetic_events`; the processes must be able to access that node.
Engineers running Linux kernels with synthetic event tracing should check their kernel versions against the vendor advisory; affected versions were not provided.