eventpoll: Fix semi-unbounded recursion
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 22bacca48a1755f79b7e0f192ddb9fbb7fc6e64e · < 3542c90797bc3ab83ebab54b737d751cf3682036| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
eventpoll: Fix semi-unbounded recursion
Ensure that epoll instances can never form a graph deeper than EP_MAX_NESTS+1 links.
Currently, ep_loop_check_proc() ensures that the graph is loop-free and does some recursion depth checks, but those recursion depth checks don't limit the depth of the resulting tree for two reasons:
- They don't look upwards in the tree. - If there are multiple downwards paths of different lengths, only one of the paths is actually considered for the depth check since commit 28d82dc1c4ed ("epoll: limit paths").
Essentially, the current recursion depth check in ep_loop_check_proc() just serves to prevent it from recursing too deeply while checking for loops.
A more thorough check is done in reverse_path_check() after the new graph edge has already been created; this checks, among other things, that no paths going upwards from any non-epoll file with a length of more than 5 edges exist. However, this check does not apply to non-epoll files.
As a result, it is possible to recurse to a depth of at least roughly 500, tested on v6.15. (I am unsure if deeper recursion is possible; and this may have changed with commit 8c44dac8add7 ("eventpoll: Fix priority inversion problem").)
From the CVE record · Linux
The Linux kernel's eventpoll depth checks can allow epoll graphs much deeper than the intended limit. A local user who can create nested epoll instances may trigger deep kernel recursion; the input does not specify a resulting crash or other impact.
Engineers running Linux kernels with eventpoll should check their vendor's advisory; the issue was tested on v6.15, but an affected version range was not provided.