PERFORCE change 29015 for review
Robert Watson
rwatson at FreeBSD.org
Tue Apr 15 13:45:00 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29015
Change 29015 by rwatson at rwatson_tislabs on 2003/04/15 13:43:57
Modify mac_test policy to invoke WITNESS_WARN() when a potentially
blocking allocation could occur as a result of a label
initialization. This will simulate the behavior of allocated
label policies such as MLS and Biba when running mac_test from
the perspective of WITNESS lock and sleep warnings.
Affected files ...
.. //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#99 edit
Differences ...
==== //depot/projects/trustedbsd/mac/sys/security/mac_test/mac_test.c#99 (text+ko) ====
@@ -46,6 +46,7 @@
#include <sys/extattr.h>
#include <sys/kernel.h>
#include <sys/mac.h>
+#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/systm.h>
@@ -246,6 +247,11 @@
mac_test_init_ipq_label(struct label *label, int flag)
{
+ if (flag & M_WAITOK)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+ "mac_test_init_ipq_label() at %s:%d", __FILE__,
+ __LINE__);
+
SLOT(label) = IPQMAGIC;
atomic_add_int(&init_count_ipq, 1);
return (0);
@@ -255,6 +261,11 @@
mac_test_init_mbuf_label(struct label *label, int flag)
{
+ if (flag & M_WAITOK)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+ "mac_test_init_mbuf_label() at %s:%d", __FILE__,
+ __LINE__);
+
SLOT(label) = MBUFMAGIC;
atomic_add_int(&init_count_mbuf, 1);
return (0);
@@ -280,6 +291,11 @@
mac_test_init_socket_label(struct label *label, int flag)
{
+ if (flag & M_WAITOK)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+ "mac_test_init_socket_label() at %s:%d", __FILE__,
+ __LINE__);
+
SLOT(label) = SOCKETMAGIC;
atomic_add_int(&init_count_socket, 1);
return (0);
@@ -289,6 +305,11 @@
mac_test_init_socket_peer_label(struct label *label, int flag)
{
+ if (flag & M_WAITOK)
+ WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+ "mac_test_init_socket_peer_label() at %s:%d", __FILE__,
+ __LINE__);
+
SLOT(label) = SOCKETMAGIC;
atomic_add_int(&init_count_socket_peerlabel, 1);
return (0);
More information about the p4-projects
mailing list