Commit c923a8e
committed
ucounts: Move RLIMIT_NPROC handling after set_user
During set*id() which cred->ucounts to charge the the current process
to is not known until after set_cred_ucounts. So move the
RLIMIT_NPROC checking into a new helper flag_nproc_exceeded and call
flag_nproc_exceeded after set_cred_ucounts.
This is very much an arbitrary subset of the places where we currently
change the RLIMIT_NPROC accounting, designed to preserve the existing
logic.
Fixing the existing logic will be the subject of another series of
changes.
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20220216155832.680775-4-ebiederm@xmission.com
Fixes: 21d1c5e ("Reimplement RLIMIT_NPROC on top of ucounts")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>1 parent a55d072 commit c923a8e
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
475 | 485 | | |
476 | 486 | | |
477 | 487 | | |
| |||
480 | 490 | | |
481 | 491 | | |
482 | 492 | | |
483 | | - | |
| 493 | + | |
484 | 494 | | |
485 | 495 | | |
486 | 496 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | 497 | | |
492 | 498 | | |
493 | 499 | | |
| |||
562 | 568 | | |
563 | 569 | | |
564 | 570 | | |
| 571 | + | |
565 | 572 | | |
566 | 573 | | |
567 | 574 | | |
| |||
624 | 631 | | |
625 | 632 | | |
626 | 633 | | |
| 634 | + | |
627 | 635 | | |
628 | 636 | | |
629 | 637 | | |
| |||
703 | 711 | | |
704 | 712 | | |
705 | 713 | | |
| 714 | + | |
706 | 715 | | |
707 | 716 | | |
708 | 717 | | |
| |||
0 commit comments