Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 856751 - kernel: perf race condition privilege escalaation
Summary: kernel: perf race condition privilege escalaation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Kernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL: https://www.openwall.com/lists/oss-se...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-06 19:44 UTC by Hypoon
Modified: 2023-05-01 05:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hypoon 2022-07-06 19:44:54 UTC
I don't know much about CVE-2022-1729, and I haven't been able to identify whether recent kernels are already patched against it. If not, could we get a patch rolled into gentoo-sources? Please forgive the lack of information, this is outside the realm of my expertise.

Reproducible: Always
Comment 1 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2022-07-06 19:53:13 UTC
The patch is upstream as:

commit 3ac6487e584a1eb54071dbe1212e05b884136704
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Fri May 20 20:38:06 2022 +0200

    perf: Fix sys_perf_event_open() race against self

    Norbert reported that it's possible to race sys_perf_event_open() such
    that the looser ends up in another context from the group leader,
    triggering many WARNs.

    The move_group case checks for races against itself, but the
    !move_group case doesn't, seemingly relying on the previous
    group_leader->ctx == ctx check. However, that check is racy due to not
    holding any locks at that time.

    Therefore, re-check the result after acquiring locks and bailing
    if they no longer match.

    Additionally, clarify the not_move_group case from the
    move_group-vs-move_group race.

    Fixes: f63a8daa5812 ("perf: Fix event->ctx locking")
    Reported-by: Norbert Slusarek <nslusarek@gmx.net>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

$ fix_in_what_release 3ac6487e584a1eb54071dbe1212e05b884136704
4.9.316 4.14.281 4.19.245 5.4.196 5.10.118 5.15.42 5.17.10 logs/log-5.18

dist-kernels 5.4.199, 5.10.123, and 5.15.48 are stabled, but fixed gentoo-sources are not. kernel@: please stabilize fixed kernels and cleanup
Comment 2 Mike Pagano gentoo-dev 2023-04-30 18:55:53 UTC
This patch is present in the following and subsequent kernel versions:

4.9.316 4.14.281 4.19.245 5.4.196 5.10.118 5.15.42 5.17.10 5.18

This is safe to close
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2023-05-01 05:58:00 UTC
Agreed, thanks!