Page MenuHomeFreeBSD

use crcopysafe(9) to update a process' credential in sys_cap_enter()
ClosedPublic

Authored by markj on Jan 5 2015, 10:12 PM.
Tags
None
Referenced Files
F172765860: D1443.id3006.diff
Sun, Sep 20, 8:30 PM
F172749072: D1443.id3007.diff
Sun, Sep 20, 5:45 PM
Unknown Object (File)
Sat, Sep 19, 8:41 PM
Unknown Object (File)
Fri, Sep 18, 2:08 PM
Unknown Object (File)
Fri, Sep 18, 10:11 AM
Unknown Object (File)
Aug 8 2026, 4:46 PM
Unknown Object (File)
Aug 8 2026, 11:26 AM
Unknown Object (File)
Jul 7 2026, 11:31 PM
Subscribers
None

Details

Summary

At the moment, sys_cap_enter() uses crcopy(9) to make a copy of a process' credential struct; it sets a flag on the copy and updates the process' p_ucred to point to the new copy. All of this is done while the corresponding proc lock is held.

crcopy(9) potentially performs an M_WAITOK allocation, which is not allowed when a mutex is held. This change modifies sys_cap_enter() to use crcopysafe(9) instead, since it's designed to avoid this problem.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

markj retitled this revision from to use crcopysafe(9) to update a process' credential in sys_cap_enter().
markj updated this object.
markj edited the test plan for this revision. (Show Details)
markj added reviewers: capsicum, rwatson.
markj updated this revision to Diff 3007.

Closed by commit rS276727 (authored by @markj).