If the kernel is compiled with options INVARIANTS and options MAC_PORTACL and /boot/loader.conf has "mac_portacl_load=YES" then kernel panices as soon as /etc/rc.d/initrandom script runs "sysctl -a" at boot time: http://www.grosbein.net/files/portacl.jpg How-To-Repeat: Build custom kernel with options INVARIANTS and options MAC_PORTACL, have "mac_portacl_load=YES" in /boot/loader.conf and try to boot.
As 2 years ago for 9.2-STABLE, there is still the same problem for 10.2-STABLE and attached patch helps.
Reset to Open (No In Progress without Assignee) Thank you for the update Eugen!
*** Bug 186362 has been marked as a duplicate of this bug. ***
My PR.
A commit references this bug: Author: eugen Date: Sun Feb 25 23:10:13 UTC 2018 New revision: 329994 URL: https://svnweb.freebsd.org/changeset/base/329994 Log: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko when kernel already has options MAC_PORTACL. PR: 183817 Approved by: avg (mentor) MFC after: 1 week Changes: head/sys/security/mac_portacl/mac_portacl.c
A commit references this bug: Author: eugen Date: Mon Mar 5 12:16:37 UTC 2018 New revision: 330499 URL: https://svnweb.freebsd.org/changeset/base/330499 Log: MFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko when kernel already has options MAC_PORTACL. PR: 183817 Approved by: avg (mentor) Changes: _U stable/11/ stable/11/sys/security/mac_portacl/mac_portacl.c
A commit references this bug: Author: eugen Date: Mon Mar 5 12:21:36 UTC 2018 New revision: 330500 URL: https://svnweb.freebsd.org/changeset/base/330500 Log: MFC r329994: mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko when kernel already has options MAC_PORTACL. PR: 183817 Approved by: avg (mentor) Changes: _U stable/10/ stable/10/sys/security/mac_portacl/mac_portacl.c