Skip to content
BSD syscall#381

svc · unix #381

__mac_syscall

Generic dispatch entry point for policy-specific MAC operations.

Prototype

int __mac_syscall(char *policy, int call, user_addr_t arg);

Returns: int

Arguments

NameTypeDirDescription
policychar-
callint-
arguser_addr_t-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard381
xnu-1699.24.8macOS 10.7 Lion381
xnu-2050.18.24macOS 10.8 Mountain Lion381
xnu-2422.115.4macOS 10.9 Mavericks381
xnu-2782.40.9macOS 10.10 Yosemite381
xnu-3247.1.106macOS 10.11 El Capitan381
xnu-3789.1.32macOS 10.12 Sierra381
xnu-4570.1.46macOS 10.13 High Sierra381
xnu-4903.221.2macOS 10.14 Mojave381
xnu-6153.11.26macOS 10.15 Catalina381
xnu-7195.50.7.100.1macOS 11.0 Big Sur381
xnu-8019.41.5macOS 12.0 Monterey381
xnu-8792.41.9macOS 13.0 Ventura381
xnu-10002.1.13macOS 14.0 Sonoma381
xnu-11215.1.10macOS 15.0 Sequoia381
xnu-11417.101.15macOS 15.4 Sequoia381
xnu-12377.1.9macOS 26.0 Tahoe381
xnu-10002.41.9—381
xnu-10002.61.3—381
xnu-10002.81.5—381
xnu-10063.101.15—381
xnu-10063.121.3—381
xnu-10063.141.1—381
xnu-11215.41.3—381
xnu-11215.61.5—381
xnu-11215.81.4—381
xnu-11417.121.6—381
xnu-11417.140.69—381
xnu-12377.101.15—381
xnu-12377.41.6—381
xnu-12377.61.12—381
xnu-12377.81.4—381
xnu-1486.2.11—381
xnu-1504.15.3—381
xnu-1504.3.12—381
xnu-1504.7.4—381
xnu-1504.9.17—381
xnu-1504.9.26—381
xnu-1504.9.37—381
xnu-1699.22.73—381
xnu-1699.22.81—381
xnu-1699.24.23—381
xnu-1699.26.8—381
xnu-1699.32.7—381
xnu-2050.22.13—381
xnu-2050.24.15—381
xnu-2050.48.11—381
xnu-2050.7.9—381
xnu-2050.9.2—381
xnu-2422.1.72—381
xnu-2422.100.13—381
xnu-2422.110.17—381
xnu-2422.90.20—381
xnu-2782.1.97—381
xnu-2782.10.72—381
xnu-2782.20.48—381
xnu-2782.30.5—381
xnu-3247.10.11—381
xnu-3248.20.55—381
xnu-3248.30.4—381
xnu-3248.40.184—381
xnu-3248.50.21—381
xnu-3248.60.10—381
xnu-3789.21.4—381
xnu-3789.31.2—381
xnu-3789.41.3—381
xnu-3789.51.2—381
xnu-3789.60.24—381
xnu-3789.70.16—381
xnu-4570.20.62—381
xnu-4570.31.3—381
xnu-4570.41.2—381
xnu-4570.51.1—381
xnu-4570.61.1—381
xnu-4570.71.2—381
xnu-4903.231.4—381
xnu-4903.241.1—381
xnu-4903.270.47—381
xnu-6153.101.6—381
xnu-6153.121.1—381
xnu-6153.141.1—381
xnu-6153.41.3—381
xnu-6153.61.1—381
xnu-6153.81.5—381
xnu-7195.101.1—381
xnu-7195.121.3—381
xnu-7195.141.2—381
xnu-7195.60.75—381
xnu-7195.81.3—381
xnu-8019.61.5—381
xnu-8019.80.24—381
xnu-8020.101.4—381
xnu-8020.121.3—381
xnu-8020.140.41—381
xnu-8792.61.2—381
xnu-8792.81.2—381
xnu-8796.101.5—381
xnu-8796.121.2—381
xnu-8796.141.3—381

Examples

C — issue a Sandbox policy call

// Sandbox uses __mac_syscall("Sandbox", call, args)
extern int __mac_syscall(const char *policy, int call, void *arg);
struct sb_args { int op; const char *profile; } a = { 0, "no-network" };
__mac_syscall("Sandbox", SANDBOX_CALL_SET_PROFILE, &a);

Notes

__mac_syscall(policyname, call, arg) routes an arbitrary command to the named MAC policy's mpo_policy_syscall hook, with the policy itself defining the meaning of call and arg. On macOS the Sandbox kext exposes a rich suite this way — container creation, profile compilation, extension issuance — and it is by far the most security-relevant of the MAC syscalls.

Detection

DTrace mac_policy_syscall:entry plus arg0 (policy name) is the canonical observation point. Sandbox operations are also visible via the sandboxd log channel and via ES_EVENT_TYPE_NOTIFY_PROFILE_ADD / sandbox-extension events on recent macOS.

Related APIs

sandbox_initsandbox_extension_consume__mac_set_proccsops