path: root/ipc/msg.c
diff options
authorDominik Brodowski <>2018-03-20 20:15:28 +0100
committerDominik Brodowski <>2018-04-02 20:15:26 +0200
commite340db56483b6e10bd5e5f281071876808801a41 (patch)
tree12c427cf6f010120b983f133965cf8157a892c2d /ipc/msg.c
parentc84d0791dfa7fe8f051082c09a558eb3e2d01931 (diff)
ipc: add msgctl syscall/compat_syscall wrappers
Provide ksys_msgctl() and compat_ksys_msgctl() wrappers to avoid in-kernel calls to these syscalls. The ksys_ prefix denotes that these functions are meant as a drop-in replacement for the syscalls. In particular, they use the same calling convention as sys_msgctl() and compat_sys_msgctl(). This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see Cc: Al Viro <> Cc: Andrew Morton <> Signed-off-by: Dominik Brodowski <>
Diffstat (limited to 'ipc/msg.c')
1 files changed, 12 insertions, 2 deletions
diff --git a/ipc/msg.c b/ipc/msg.c
index 64e8276be164..5b026868df07 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -538,7 +538,7 @@ out_unlock:
return err;
-SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
+long ksys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
int version;
struct ipc_namespace *ns;
@@ -581,6 +581,11 @@ SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
+SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
+ return ksys_msgctl(msqid, cmd, buf);
struct compat_msqid_ds {
@@ -651,7 +656,7 @@ static int copy_compat_msqid_to_user(void __user *buf, struct msqid64_ds *in,
-COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr)
+long compat_ksys_msgctl(int msqid, int cmd, void __user *uptr)
struct ipc_namespace *ns;
int err;
@@ -692,6 +697,11 @@ COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr)
return -EINVAL;
+COMPAT_SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, void __user *, uptr)
+ return compat_ksys_msgctl(msqid, cmd, uptr);
static int testmsg(struct msg_msg *msg, long type, int mode)