KernelScan.io

HIGH

mm/damon WalkControl UAF

CVE-2026-43388

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI2.0LOW

01

In the Linux kernel, the following vulnerability has been resolved: mm/damon/core: clear walk_control on inactive context in damos_walk() damos_walk() sets ctx->walk_control to the caller-provided control structure before checking whether the context is running. If the context is inactive (damon_is_running() returns false), the function returns -EINVAL without clearing ctx->walk_control. This leaves a dangling pointer to a stack-allocated structure that will be freed when the caller returns. This is structurally identical to the bug fixed in commit f9132fbc2e83 ("mm/damon/core: remove call_control in inactive contexts") for damon_call(), which had the same pattern of linking a control object and returning an error without unlinking it. The dangling walk_control pointer can cause: 1. Use-after-free if the context is later started and kdamond    dereferences ctx->walk_control (e.g., in damos_walk_cancel()    which writes to control->canceled and calls complete()) 2. Permanent -EBUSY from subsequent damos_walk() calls, since the    stale pointer is non-NULL Nonetheless, the real user impact is quite restrictive. The use-after-free is impossible because there is no damos_walk() callers who starts the context later. The permanent -EBUSY can actually confuse users, as DAMON is not running. But the symptom is kept only while the context is turned off. Turning it on again will make DAMON internally uses a newly generated damon_ctx object that doesn't have the invalid damos_walk_control pointer, so everything will work fine again. Fix this by clearing ctx->walk_control under walk_control_lock before returning -EINVAL, mirroring the fix pattern from f9132fbc2e83.

02

Engine v0.2.0

Risk summary

A use-after-free pattern in the DAMON memory monitoring subsystem leaves a dangling pointer to a stack-allocated control structure when damos_walk() is called on an inactive context. The commit author explicitly notes the use-after-free is impossible to trigger in practice because no callers start the context later. The only real-world impact is a permanent -EBUSY return on subsequent damos_walk() calls against the same inactive context, which resolves once the context is restarted.

Affectedmm/damon/core.c (DAMON memory monitoring)

Vulnerability analysis

The vulnerability occurs in damos_walk() which sets ctx->walk_control to a caller-provided control structure before checking if the DAMON context is running. When the context is inactive, the function returns -EINVAL without clearing the pointer, leaving it pointing to a stack-allocated structure that gets freed when the caller returns. While this creates a structural use-after-free condition, the commit message explicitly states the UAF cannot be triggered because no existing callers start the context after such a failed walk. The practical impact is limited to subsequent damos_walk() calls returning -EBUSY while the context remains off. Turning the context on again allocates a fresh damon_ctx object, clearing the stale pointer. The fix clears ctx->walk_control under walk_control_lock before returning -EINVAL. DAMON sysfs/debugfs interfaces require root-equivalent privileges (CAP_SYS_ADMIN in the init namespace).

03

BranchFixed inPatch commit
6.186.18.19ce0aa47c963b
6.196.19.99320c77134ab
mainline7.0d210fdcac9c0