Repository navigation
Commit 52ee2df
pids: refactor vnr/nr_ns helpers to make them safe
Inho, the safety rules for vnr/nr_ns helpers are horrible and buggy.
task_pid_nr_ns(task) needs rcu/tasklist depending on task == current.
As for "special" pids, vnr/nr_ns helpers always need rcu. However, if
task != current, they are unsafe even under rcu lock, we can't trust
task->group_leader without the special checks.
And almost every helper has a callsite which needs a fix.
Also, it is a bit annoying that the implementations of, say,
task_pgrp_vnr() and task_pgrp_nr_ns() are not "symmetrical".
This patch introduces the new helper, __task_pid_nr_ns(), which is always
safe to use, and turns all other helpers into the trivial wrappers.
After this I'll send another patch which converts task_tgid_xxx() as well,
they're are a bit special.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Louis Rilling <Louis.Rilling@kerlabs.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>1 parent 2ae448e commit 52ee2df
2 files changed
Lines changed: 36 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1519 | 1519 | | |
1520 | 1520 | | |
1521 | 1521 | | |
| 1522 | + | |
| 1523 | + | |
1522 | 1524 | | |
1523 | 1525 | | |
1524 | 1526 | | |
1525 | 1527 | | |
1526 | 1528 | | |
1527 | 1529 | | |
1528 | | - | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
1529 | 1535 | | |
1530 | 1536 | | |
1531 | 1537 | | |
1532 | | - | |
| 1538 | + | |
1533 | 1539 | | |
1534 | 1540 | | |
1535 | 1541 | | |
| |||
1551 | 1557 | | |
1552 | 1558 | | |
1553 | 1559 | | |
1554 | | - | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1555 | 1565 | | |
1556 | 1566 | | |
1557 | 1567 | | |
1558 | | - | |
| 1568 | + | |
1559 | 1569 | | |
1560 | 1570 | | |
1561 | 1571 | | |
| |||
1564 | 1574 | | |
1565 | 1575 | | |
1566 | 1576 | | |
1567 | | - | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
1568 | 1582 | | |
1569 | 1583 | | |
1570 | 1584 | | |
1571 | | - | |
| 1585 | + | |
1572 | 1586 | | |
1573 | 1587 | | |
1574 | | - | |
1575 | 1588 | | |
1576 | 1589 | | |
1577 | 1590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
| 456 | + | |
456 | 457 | | |
457 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
458 | 471 | | |
459 | | - | |
| 472 | + | |
460 | 473 | | |
461 | 474 | | |
462 | 475 | | |
463 | 476 | | |
464 | 477 | | |
465 | 478 | | |
466 | 479 | | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
| |||
0 commit comments