Commit b32d14b
committed
use uniform permission checks for all mount propagation changes
jira VULN-98610
cve-bf CVE-2025-38498
commit-author Al Viro <[email protected]>
commit cffd044
do_change_type() and do_set_group() are operating on different
aspects of the same thing - propagation graph. The latter
asks for mounts involved to be mounted in namespace(s) the caller
has CAP_SYS_ADMIN for. The former is a mess - originally it
didn't even check that mount *is* mounted. That got fixed,
but the resulting check turns out to be too strict for userland -
in effect, we check that mount is in our namespace, having already
checked that we have CAP_SYS_ADMIN there.
What we really need (in both cases) is
* only touch mounts that are mounted. That's a must-have
constraint - data corruption happens if it get violated.
* don't allow to mess with a namespace unless you already
have enough permissions to do so (i.e. CAP_SYS_ADMIN in its userns).
That's an equivalent of what do_set_group() does; let's extract that
into a helper (may_change_propagation()) and use it in both
do_set_group() and do_change_type().
Fixes: 12f147d "do_change_type(): refuse to operate on unmounted/not ours mounts"
Acked-by: Andrei Vagin <[email protected]>
Reviewed-by: Pavel Tikhomirov <[email protected]>
Tested-by: Pavel Tikhomirov <[email protected]>
Reviewed-by: Christian Brauner <[email protected]>
Signed-off-by: Al Viro <[email protected]>
(cherry picked from commit cffd044)
Signed-off-by: Roxana Nicolescu <[email protected]>1 parent 3528c6b commit b32d14b
1 file changed
+20
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2293 | 2293 | | |
2294 | 2294 | | |
2295 | 2295 | | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
2296 | 2309 | | |
2297 | 2310 | | |
2298 | 2311 | | |
| |||
2329 | 2342 | | |
2330 | 2343 | | |
2331 | 2344 | | |
2332 | | - | |
2333 | | - | |
| 2345 | + | |
| 2346 | + | |
2334 | 2347 | | |
2335 | | - | |
| 2348 | + | |
2336 | 2349 | | |
2337 | 2350 | | |
2338 | 2351 | | |
| |||
2715 | 2728 | | |
2716 | 2729 | | |
2717 | 2730 | | |
2718 | | - | |
2719 | | - | |
2720 | | - | |
2721 | | - | |
2722 | | - | |
2723 | | - | |
2724 | | - | |
2725 | | - | |
2726 | | - | |
2727 | | - | |
| 2731 | + | |
| 2732 | + | |
2728 | 2733 | | |
2729 | | - | |
| 2734 | + | |
| 2735 | + | |
2730 | 2736 | | |
2731 | 2737 | | |
2732 | 2738 | | |
| |||
0 commit comments