diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-03-08 00:50:37 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-03-08 00:50:37 +0000 |
commit | 25330cae2048ae0818bc8d87e0c28a34b32d019b (patch) | |
tree | 39df90aae9f5c08bbe24ec8be9340cd061aadfb7 /sys/security/mac/mac_priv.c | |
parent | f18c279752d888c46c564f2adf466f19b9d17ed9 (diff) | |
download | FreeBSD-src-25330cae2048ae0818bc8d87e0c28a34b32d019b.zip FreeBSD-src-25330cae2048ae0818bc8d87e0c28a34b32d019b.tar.gz |
Add static DTrace probes for MAC Framework access control checks and
privilege grants so that dtrace can be more easily used to monitor
the security decisions being generated by the MAC Framework following
policy invocation.
Successful access control checks will be reported by:
mac_framework:kernel:<entrypoint>:mac_check_ok
Failed access control checks will be reported by:
mac_framework:kernel:<entrypoint>:mac_check_err
Successful privilege grants will be reported by:
mac_framework:kernel:priv_grant:mac_grant_ok
Failed privilege grants will be reported by:
mac_framework:kernel:priv_grant:mac_grant_err
In all cases, the return value (always 0 for _ok, otherwise an errno
for _err) will be reported via arg0 on the probe, and subsequent
arguments will hold entrypoint-specific data, in a style similar to
privilege tracing.
Obtained from: TrustedBSD Project
Sponsored by: Google, Inc.
Diffstat (limited to 'sys/security/mac/mac_priv.c')
-rw-r--r-- | sys/security/mac/mac_priv.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/security/mac/mac_priv.c b/sys/security/mac/mac_priv.c index 745695c..f12b020 100644 --- a/sys/security/mac/mac_priv.c +++ b/sys/security/mac/mac_priv.c @@ -1,10 +1,14 @@ /*- * Copyright (c) 2006 nCircle Network Security, Inc. + * Copyright (c) 2009 Robert N. M. Watson * All rights reserved. * * This software was developed by Robert N. M. Watson for the TrustedBSD * Project under contract to nCircle Network Security, Inc. * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,10 +38,13 @@ #include "sys/cdefs.h" __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" #include "opt_mac.h" #include <sys/param.h> +#include <sys/kernel.h> #include <sys/priv.h> +#include <sys/sdt.h> #include <sys/module.h> #include <security/mac/mac_framework.h> @@ -54,6 +61,8 @@ __FBSDID("$FreeBSD$"); * composition. */ +MAC_CHECK_PROBE_DEFINE2(priv_check, "struct ucred *", "int"); + /* * Restrict access to a privilege for a credential. Return failure if any * policy denies access. @@ -64,10 +73,13 @@ mac_priv_check(struct ucred *cred, int priv) int error; MAC_CHECK(priv_check, cred, priv); + MAC_CHECK_PROBE2(priv_check, error, cred, priv); return (error); } +MAC_GRANT_PROBE_DEFINE2(priv_grant, "struct ucred *", "int"); + /* * Grant access to a privilege for a credential. Return success if any * policy grants access. @@ -78,6 +90,7 @@ mac_priv_grant(struct ucred *cred, int priv) int error; MAC_GRANT(priv_grant, cred, priv); + MAC_GRANT_PROBE2(priv_grant, error, cred, priv); return (error); } |