Page MenuHomeFreeBSD

setcred(): Fix RACCT resource accounting on credentials change
ClosedPublic

Authored by olce on Oct 29 2025, 8:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 24 2025, 11:53 AM
Unknown Object (File)
Nov 22 2025, 11:41 AM
Unknown Object (File)
Nov 12 2025, 5:15 PM
Unknown Object (File)
Nov 11 2025, 3:58 PM
Unknown Object (File)
Nov 9 2025, 4:45 PM
Unknown Object (File)
Nov 6 2025, 7:54 AM
Unknown Object (File)
Nov 3 2025, 10:36 AM
Unknown Object (File)
Nov 3 2025, 2:30 AM

Details

Summary

When credentials are changed, we need to adjust the sum of resources
associated to the initial and new process' user IDs (and old and new
login classes and jails, but setcred() does not change them) for them to
stay consistent.

PR: 290352
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68286
Build 65169: arc lint + arc unit

Event Timeline

olce requested review of this revision.Oct 29 2025, 8:53 PM
olce planned changes to this revision.EditedOct 29 2025, 8:56 PM

Wow, sorry, I forgot to wrap the last block (doing rctl_proc_ucred_changed()) inside a if (error == 0).

  • Ensure the last block is executed only on no error.

On RCTL, guard the call to rctl_proc_ucred_changed() with cred_set instead of relying on error being 0 as this is more error-prone on potential future changes to setcred().

This revision was not accepted when it landed; it landed in state Needs Review.Nov 2 2025, 6:18 PM
This revision was automatically updated to reflect the committed changes.