Page MenuHomeFreeBSD

libjail: fix fetching mac.label for multiple jails
Needs ReviewPublic

Authored by kevans on Wed, May 27, 6:50 PM.
Tags
None
Referenced Files
F160243243: D57280.diff
Mon, Jun 22, 12:33 PM
Unknown Object (File)
Wed, Jun 10, 3:23 AM
Unknown Object (File)
Wed, Jun 10, 3:08 AM
Unknown Object (File)
Wed, Jun 10, 3:04 AM
Unknown Object (File)
Sun, Jun 7, 10:07 PM
Unknown Object (File)
Sun, Jun 7, 10:04 PM
Unknown Object (File)
Fri, Jun 5, 1:32 AM
Unknown Object (File)
Fri, Jun 5, 12:59 AM
Subscribers

Details

Reviewers
ivy
Group Reviewers
Jails
Summary

When doing a basic jls -n, jls(8) will jailparam_get() the mac.label
for every jail on the system using the same set of jailparams, and thus
the same jp_value. We only init the mac_t the first time, so the first
jail would populate it with ? from /etc/mac.conf and the resulting
jail_get(2) would clobber it with the empty string, then a second jail
would try to pass the empty string to the kernel and fail because it
must have a non-zero length.

Fix it by invoking jps_get() every time. Drop some comments to note
that jps_get() will be invoked with zero || garbage from previous call,
and be sure that we don't leak our previous mac_t. There aren't any
other jps_get implementations at this time, so this shouldn't cause any
unexpected problems.

Reported by: ivy

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73486
Build 70369: arc lint + arc unit

Event Timeline

jamie added a subscriber: jamie.

The key point is "there aren't any other jps_get implementations." So it's all yours :-)