diff options
author | kib <kib@FreeBSD.org> | 2017-07-21 06:48:47 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2017-07-21 06:48:47 +0000 |
commit | 11164e3de31acd3c99b7ce76781db35b623b4aa1 (patch) | |
tree | 89ce63b9dfd7b2094928d0851afb6ea8b00a9289 | |
parent | 9ff83ba0190b63cda1194f2572f5bb52e655644b (diff) | |
download | FreeBSD-src-11164e3de31acd3c99b7ce76781db35b623b4aa1.zip FreeBSD-src-11164e3de31acd3c99b7ce76781db35b623b4aa1.tar.gz |
MFC r320982:
Correct sysent flags for dynamically loaded syscalls.
-rw-r--r-- | sys/compat/freebsd32/freebsd32_util.h | 11 | ||||
-rw-r--r-- | sys/kern/capabilities.conf | 4 | ||||
-rw-r--r-- | sys/kern/uipc_mqueue.c | 16 | ||||
-rw-r--r-- | sys/netinet/sctp_syscalls.c | 8 | ||||
-rw-r--r-- | sys/sys/sysent.h | 14 |
5 files changed, 35 insertions, 18 deletions
diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h index d62bca1..a6269d5 100644 --- a/sys/compat/freebsd32/freebsd32_util.h +++ b/sys/compat/freebsd32/freebsd32_util.h @@ -79,24 +79,31 @@ SYSCALL32_MODULE(syscallname, \ & syscallname##_syscall32, & syscallname##_sysent32,\ NULL, NULL); -#define SYSCALL32_INIT_HELPER(syscallname) { \ +#define SYSCALL32_INIT_HELPER_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = FREEBSD32_SYS_##syscallname \ } -#define SYSCALL32_INIT_HELPER_COMPAT(syscallname) { \ +#define SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& sys_ ## syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = FREEBSD32_SYS_##syscallname \ } +#define SYSCALL32_INIT_HELPER(syscallname) \ + SYSCALL32_INIT_HELPER_F(syscallname, 0) +#define SYSCALL32_INIT_HELPER_COMPAT(syscallname) \ + SYSCALL32_INIT_HELPER_COMPAT_F(syscallname, 0) + int syscall32_register(int *offset, struct sysent *new_sysent, struct sysent *old_sysent, int flags); int syscall32_deregister(int *offset, struct sysent *old_sysent); diff --git a/sys/kern/capabilities.conf b/sys/kern/capabilities.conf index 7c2523c..693c024 100644 --- a/sys/kern/capabilities.conf +++ b/sys/kern/capabilities.conf @@ -341,6 +341,8 @@ kill ## ## Allow message queue operations on file descriptors, subject to capability ## rights. +## NOTE: Corresponding sysents are initialized in sys/kern/uipc_mqueue.c with +## SYF_CAPENABLED. ## kmq_notify kmq_setattr @@ -552,6 +554,8 @@ sched_yield ## ## Allow I/O-related file descriptors, subject to capability rights. +## NOTE: Corresponding sysents are initialized in sys/netinet/sctp_syscalls.c +## with SYF_CAPENABLED. ## sctp_generic_recvmsg sctp_generic_sendmsg diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index 354564b..5df97d7 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -2691,10 +2691,10 @@ static struct vfsconf mqueuefs_vfsconf = { static struct syscall_helper_data mq_syscalls[] = { SYSCALL_INIT_HELPER(kmq_open), - SYSCALL_INIT_HELPER(kmq_setattr), - SYSCALL_INIT_HELPER(kmq_timedsend), - SYSCALL_INIT_HELPER(kmq_timedreceive), - SYSCALL_INIT_HELPER(kmq_notify), + SYSCALL_INIT_HELPER_F(kmq_setattr, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_timedsend, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_timedreceive, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(kmq_notify, SYF_CAPENABLED), SYSCALL_INIT_HELPER(kmq_unlink), SYSCALL_INIT_LAST }; @@ -2851,10 +2851,10 @@ freebsd32_kmq_notify(struct thread *td, struct freebsd32_kmq_notify_args *uap) static struct syscall_helper_data mq32_syscalls[] = { SYSCALL32_INIT_HELPER(freebsd32_kmq_open), - SYSCALL32_INIT_HELPER(freebsd32_kmq_setattr), - SYSCALL32_INIT_HELPER(freebsd32_kmq_timedsend), - SYSCALL32_INIT_HELPER(freebsd32_kmq_timedreceive), - SYSCALL32_INIT_HELPER(freebsd32_kmq_notify), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_setattr, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_timedsend, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_timedreceive, SYF_CAPENABLED), + SYSCALL32_INIT_HELPER_F(freebsd32_kmq_notify, SYF_CAPENABLED), SYSCALL32_INIT_HELPER_COMPAT(kmq_unlink), SYSCALL_INIT_LAST }; diff --git a/sys/netinet/sctp_syscalls.c b/sys/netinet/sctp_syscalls.c index 66df314..05868b6 100644 --- a/sys/netinet/sctp_syscalls.c +++ b/sys/netinet/sctp_syscalls.c @@ -82,10 +82,10 @@ __FBSDID("$FreeBSD$"); #include <netinet/sctp_peeloff.h> static struct syscall_helper_data sctp_syscalls[] = { - SYSCALL_INIT_HELPER(sctp_peeloff), - SYSCALL_INIT_HELPER(sctp_generic_sendmsg), - SYSCALL_INIT_HELPER(sctp_generic_sendmsg_iov), - SYSCALL_INIT_HELPER(sctp_generic_recvmsg), + SYSCALL_INIT_HELPER_F(sctp_peeloff, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_sendmsg, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_sendmsg_iov, SYF_CAPENABLED), + SYSCALL_INIT_HELPER_F(sctp_generic_recvmsg, SYF_CAPENABLED), SYSCALL_INIT_LAST }; diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 8313fc0..d515aa1 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -231,24 +231,30 @@ struct syscall_helper_data { int syscall_no; int registered; }; -#define SYSCALL_INIT_HELPER(syscallname) { \ +#define SYSCALL_INIT_HELPER_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& sys_ ## syscallname, \ - .sy_auevent = SYS_AUE_##syscallname \ + .sy_auevent = SYS_AUE_##syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = SYS_##syscallname \ } -#define SYSCALL_INIT_HELPER_COMPAT(syscallname) { \ +#define SYSCALL_INIT_HELPER_COMPAT_F(syscallname, flags) { \ .new_sysent = { \ .sy_narg = (sizeof(struct syscallname ## _args ) \ / sizeof(register_t)), \ .sy_call = (sy_call_t *)& syscallname, \ - .sy_auevent = SYS_AUE_##syscallname \ + .sy_auevent = SYS_AUE_##syscallname, \ + .sy_flags = (flags) \ }, \ .syscall_no = SYS_##syscallname \ } +#define SYSCALL_INIT_HELPER(syscallname) \ + SYSCALL_INIT_HELPER_F(syscallname, 0) +#define SYSCALL_INIT_HELPER_COMPAT(syscallname) \ + SYSCALL_INIT_HELPER_COMPAT_F(syscallname, 0) #define SYSCALL_INIT_LAST { \ .syscall_no = NO_SYSCALL \ } |