misc/137677: security.mac.bsdextended.firstmatch_enabled default is incorrect

Steve Polyack spolyack at collaborativefusion.com
Tue Aug 11 18:00:17 UTC 2009

>Number:         137677
>Category:       misc
>Synopsis:       security.mac.bsdextended.firstmatch_enabled default is incorrect
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 11 18:00:16 UTC 2009
>Originator:     Steve Polyack
>Release:        7.2-RELEASE
Collaborative Fusion, Inc.
FreeBSD xxxxx 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #0: Tue Aug 11 10:34:08 EDT 2009     root at xxxxx:/usr/obj/usr/src/sys/GENERIC-MAC  amd64
The manpage for the mac_bsdextended kernel module states that the default for the security.mac.bsdextended.firstmatch_enabled is 1.  This does not appear to be true, as a recently rebuilt 6.3 machine as well as a fresh 7.2-RELEASE install both have the sysctl set to 0 upon loading the module:

$ sysctl security.mac.bsdextended.firstmatch_enabled 
security.mac.bsdextended.firstmatch_enabled: 0

The source code for the module appears to initialize the sysctl with the (correct) value of 1, so I'm unsure as to where the problem actually is:
 * This tunable is here for compatibility.  It will allow the user to switch
 * between the new mode (first rule matches) and the old functionality (all
 * rules match).
static int ugidfw_firstmatch_enabled;
SYSCTL_INT(_security_mac_bsdextended, OID_AUTO, firstmatch_enabled,
    CTLFLAG_RW, &ugidfw_firstmatch_enabled, 1,
    "Disable/enable match first rule functionality");
- Build and install a kernel with 'options MAC'.
- Reboot and kldload mac_bsdextended.
- Observe that the sysctl security.mac.bsdextended.firstmatch_enabled is set to 0 after spending a good amount of time wondering why your ugidfw rules aren't working as expected.


More information about the freebsd-bugs mailing list