Commit bef2981
committed
Merge patch series "open_tree_attr: do not allow id-mapping changes without OPEN_TREE_CLONE"
Aleksa Sarai <cyphar@cyphar.com> says:
As described in commit 7a54947 ('Merge patch series "fs: allow
changing idmappings"'), open_tree_attr(2) was necessary in order to
allow for a detached mount to be created and have its idmappings changed
without the risk of any racing threads operating on it. For this reason,
mount_setattr(2) still does not allow for id-mappings to be changed.
However, there was a bug in commit 2462651 ("fs: allow changing
idmappings") which allowed users to bypass this restriction by calling
open_tree_attr(2) *without* OPEN_TREE_CLONE.
can_idmap_mount() prevented this bug from allowing an attached
mountpoint's id-mapping from being modified (thanks to an is_anon_ns()
check), but this still allows for detached (but visible) mounts to have
their be id-mapping changed. This risks the same UAF and locking issues
as described in the merge commit, and was likely unintentional.
For what it's worth, I found this while working on the open_tree_attr(2)
man page, and was trying to figure out what open_tree_attr(2)'s
behaviour was in the (slightly fruity) ~OPEN_TREE_CLONE case.
* patches from https://lore.kernel.org/20250808-open_tree_attr-bugfix-idmap-v1-0-0ec7bc05646c@cyphar.com:
selftests/mount_setattr: add smoke tests for open_tree_attr(2) bug
open_tree_attr: do not allow id-mapping changes without OPEN_TREE_CLONE
Link: https://lore.kernel.org/20250808-open_tree_attr-bugfix-idmap-v1-0-0ec7bc05646c@cyphar.com
Signed-off-by: Christian Brauner <brauner@kernel.org>2 files changed
Lines changed: 66 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5176 | 5176 | | |
5177 | 5177 | | |
5178 | 5178 | | |
5179 | | - | |
| 5179 | + | |
| 5180 | + | |
5180 | 5181 | | |
5181 | 5182 | | |
5182 | 5183 | | |
| |||
Lines changed: 64 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
110 | 130 | | |
111 | 131 | | |
112 | 132 | | |
| |||
121 | 141 | | |
122 | 142 | | |
123 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
124 | 150 | | |
125 | 151 | | |
126 | 152 | | |
| |||
1222 | 1248 | | |
1223 | 1249 | | |
1224 | 1250 | | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1225 | 1257 | | |
1226 | 1258 | | |
1227 | 1259 | | |
| |||
1255 | 1287 | | |
1256 | 1288 | | |
1257 | 1289 | | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
1258 | 1296 | | |
1259 | 1297 | | |
1260 | 1298 | | |
| |||
1321 | 1359 | | |
1322 | 1360 | | |
1323 | 1361 | | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
1324 | 1375 | | |
1325 | 1376 | | |
1326 | 1377 | | |
| |||
1331 | 1382 | | |
1332 | 1383 | | |
1333 | 1384 | | |
| 1385 | + | |
| 1386 | + | |
1334 | 1387 | | |
1335 | 1388 | | |
1336 | 1389 | | |
| |||
1348 | 1401 | | |
1349 | 1402 | | |
1350 | 1403 | | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
1351 | 1407 | | |
1352 | 1408 | | |
1353 | 1409 | | |
1354 | 1410 | | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
1355 | 1419 | | |
1356 | 1420 | | |
1357 | 1421 | | |
1358 | 1422 | | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
1368 | | - | |
1369 | | - | |
1370 | | - | |
1371 | | - | |
1372 | 1423 | | |
1373 | 1424 | | |
1374 | 1425 | | |
| |||
0 commit comments