Commit 8f502d5
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull usernamespace mount fixes from Eric Biederman:
"Way back in October Andrey Vagin reported that umount(MNT_DETACH)
could be used to defeat MNT_LOCKED. As I worked to fix this I
discovered that combined with mount propagation and an appropriate
selection of shared subtrees a reference to a directory on an
unmounted filesystem is not necessary.
That MNT_DETACH is allowed in user namespace in a form that can break
MNT_LOCKED comes from my early misunderstanding what MNT_DETACH does.
To avoid breaking existing userspace the conflict between MNT_DETACH
and MNT_LOCKED is fixed by leaving mounts that are locked to their
parents in the mount hash table until the last reference goes away.
While investigating this issue I also found an issue with
__detach_mounts. The code was unnecessarily and incorrectly
triggering mount propagation. Resulting in too many mounts going away
when a directory is deleted, and too many cpu cycles are burned while
doing that.
Looking some more I realized that __detach_mounts by only keeping
mounts connected that were MNT_LOCKED it had the potential to still
leak information so I tweaked the code to keep everything locked
together that possibly could be.
This code was almost ready last cycle but Al invented fs_pin which
slightly simplifies this code but required rewrites and retesting, and
I have not been in top form for a while so it took me a while to get
all of that done. Similiarly this pull request is late because I have
been feeling absolutely miserable all week.
The issue of being able to escape a bind mount has not yet been
addressed, as the fixes are not yet mature"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
mnt: Update detach_mounts to leave mounts connected
mnt: Fix the error check in __detach_mounts
mnt: Honor MNT_LOCKED when detaching mounts
fs_pin: Allow for the possibility that m_list or s_list go unused.
mnt: Factor umount_mnt from umount_tree
mnt: Factor out unhash_mnt from detach_mnt and umount_tree
mnt: Fail collect_mounts when applied to unmounted mounts
mnt: Don't propagate unmounts to locked mounts
mnt: On an unmount propagate clearing of MNT_LOCKED
mnt: Delay removal from the mount hash.
mnt: Add MNT_UMOUNT flag
mnt: In umount_tree reuse mnt_list instead of mnt_hash
mnt: Don't propagate umounts in __detach_mounts
mnt: Improve the umount_tree flags
mnt: Use hlist_move_list in namespace_unlock6 files changed
Lines changed: 159 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
635 | | - | |
636 | | - | |
| 635 | + | |
| 636 | + | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
639 | 641 | | |
640 | 642 | | |
641 | 643 | | |
642 | | - | |
| 644 | + | |
| 645 | + | |
643 | 646 | | |
644 | 647 | | |
645 | 648 | | |
| |||
795 | 798 | | |
796 | 799 | | |
797 | 800 | | |
798 | | - | |
| 801 | + | |
799 | 802 | | |
800 | | - | |
801 | | - | |
802 | 803 | | |
803 | 804 | | |
804 | 805 | | |
| |||
808 | 809 | | |
809 | 810 | | |
810 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
811 | 832 | | |
812 | 833 | | |
813 | 834 | | |
| |||
1078 | 1099 | | |
1079 | 1100 | | |
1080 | 1101 | | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
1081 | 1109 | | |
1082 | 1110 | | |
1083 | 1111 | | |
| |||
1298 | 1326 | | |
1299 | 1327 | | |
1300 | 1328 | | |
1301 | | - | |
| 1329 | + | |
1302 | 1330 | | |
1303 | | - | |
1304 | | - | |
1305 | | - | |
1306 | | - | |
| 1331 | + | |
1307 | 1332 | | |
1308 | | - | |
1309 | | - | |
1310 | 1333 | | |
1311 | 1334 | | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1312 | 1338 | | |
1313 | 1339 | | |
1314 | 1340 | | |
| |||
1319 | 1345 | | |
1320 | 1346 | | |
1321 | 1347 | | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
1322 | 1353 | | |
1323 | 1354 | | |
1324 | 1355 | | |
1325 | | - | |
1326 | | - | |
1327 | | - | |
1328 | 1356 | | |
1329 | | - | |
| 1357 | + | |
1330 | 1358 | | |
1331 | | - | |
| 1359 | + | |
1332 | 1360 | | |
1333 | 1361 | | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1334 | 1366 | | |
1335 | | - | |
1336 | | - | |
| 1367 | + | |
| 1368 | + | |
1337 | 1369 | | |
1338 | 1370 | | |
1339 | | - | |
| 1371 | + | |
| 1372 | + | |
1340 | 1373 | | |
| 1374 | + | |
1341 | 1375 | | |
1342 | | - | |
| 1376 | + | |
| 1377 | + | |
1343 | 1378 | | |
1344 | 1379 | | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
1348 | 1383 | | |
1349 | 1384 | | |
1350 | 1385 | | |
1351 | 1386 | | |
1352 | | - | |
| 1387 | + | |
1353 | 1388 | | |
1354 | 1389 | | |
1355 | | - | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1356 | 1397 | | |
1357 | | - | |
1358 | | - | |
1359 | 1398 | | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
1365 | 1405 | | |
1366 | 1406 | | |
1367 | 1407 | | |
| |||
1447 | 1487 | | |
1448 | 1488 | | |
1449 | 1489 | | |
1450 | | - | |
| 1490 | + | |
1451 | 1491 | | |
1452 | 1492 | | |
1453 | 1493 | | |
1454 | 1494 | | |
1455 | 1495 | | |
1456 | 1496 | | |
1457 | | - | |
| 1497 | + | |
1458 | 1498 | | |
1459 | 1499 | | |
1460 | 1500 | | |
| |||
1480 | 1520 | | |
1481 | 1521 | | |
1482 | 1522 | | |
1483 | | - | |
| 1523 | + | |
1484 | 1524 | | |
1485 | 1525 | | |
1486 | 1526 | | |
1487 | 1527 | | |
1488 | 1528 | | |
1489 | | - | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
1490 | 1537 | | |
1491 | 1538 | | |
1492 | 1539 | | |
| |||
1648 | 1695 | | |
1649 | 1696 | | |
1650 | 1697 | | |
1651 | | - | |
| 1698 | + | |
1652 | 1699 | | |
1653 | 1700 | | |
1654 | 1701 | | |
| |||
1660 | 1707 | | |
1661 | 1708 | | |
1662 | 1709 | | |
1663 | | - | |
1664 | | - | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1665 | 1715 | | |
1666 | 1716 | | |
1667 | 1717 | | |
| |||
1672 | 1722 | | |
1673 | 1723 | | |
1674 | 1724 | | |
1675 | | - | |
| 1725 | + | |
1676 | 1726 | | |
1677 | 1727 | | |
1678 | 1728 | | |
| |||
1855 | 1905 | | |
1856 | 1906 | | |
1857 | 1907 | | |
1858 | | - | |
| 1908 | + | |
1859 | 1909 | | |
1860 | 1910 | | |
1861 | 1911 | | |
| |||
2035 | 2085 | | |
2036 | 2086 | | |
2037 | 2087 | | |
2038 | | - | |
| 2088 | + | |
2039 | 2089 | | |
2040 | 2090 | | |
2041 | 2091 | | |
| |||
2406 | 2456 | | |
2407 | 2457 | | |
2408 | 2458 | | |
2409 | | - | |
| 2459 | + | |
2410 | 2460 | | |
2411 | 2461 | | |
2412 | 2462 | | |
| |||
2477 | 2527 | | |
2478 | 2528 | | |
2479 | 2529 | | |
2480 | | - | |
| 2530 | + | |
2481 | 2531 | | |
2482 | 2532 | | |
2483 | 2533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
364 | 404 | | |
365 | 405 | | |
366 | 406 | | |
| |||
378 | 418 | | |
379 | 419 | | |
380 | 420 | | |
381 | | - | |
382 | | - | |
| 421 | + | |
| 422 | + | |
383 | 423 | | |
384 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
385 | 428 | | |
386 | | - | |
387 | | - | |
| 429 | + | |
| 430 | + | |
388 | 431 | | |
389 | 432 | | |
390 | 433 | | |
| |||
396 | 439 | | |
397 | 440 | | |
398 | 441 | | |
399 | | - | |
| 442 | + | |
400 | 443 | | |
401 | 444 | | |
402 | 445 | | |
403 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
404 | 450 | | |
405 | 451 | | |
406 | 452 | | |
0 commit comments