From 75e9b455a9044b4162e264a56f2b9ef8c78534e2 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Mon, 7 May 2018 23:10:12 +0000 Subject: [PATCH] Change trap_enotcap to bool and annotate with __read_frequently It is read on each return to user space. --- sys/kern/sys_capability.c | 4 ++-- sys/sys/capsicum.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_capability.c b/sys/kern/sys_capability.c index 8442433aa71c..68dab46ee891 100644 --- a/sys/kern/sys_capability.c +++ b/sys/kern/sys_capability.c @@ -85,8 +85,8 @@ __FBSDID("$FreeBSD$"); #include #include -int trap_enotcap; -SYSCTL_INT(_kern, OID_AUTO, trap_enotcap, CTLFLAG_RW, &trap_enotcap, 0, +bool __read_frequently trap_enotcap; +SYSCTL_BOOL(_kern, OID_AUTO, trap_enotcap, CTLFLAG_RW, &trap_enotcap, 0, "Deliver SIGTRAP on ENOTCAPABLE"); #ifdef CAPABILITY_MODE diff --git a/sys/sys/capsicum.h b/sys/sys/capsicum.h index cb69473716f8..4fd496b19a66 100644 --- a/sys/sys/capsicum.h +++ b/sys/sys/capsicum.h @@ -370,7 +370,7 @@ int cap_ioctl_check(struct filedesc *fdp, int fd, u_long cmd); int cap_fcntl_check_fde(struct filedescent *fde, int cmd); int cap_fcntl_check(struct filedesc *fdp, int fd, int cmd); -extern int trap_enotcap; +extern bool trap_enotcap; #else /* !_KERNEL */