Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48b25c43 authored by Chris Metcalf's avatar Chris Metcalf
Browse files

[PATCH v3] ipc: provide generic compat versions of IPC syscalls



When using the "compat" APIs, architectures will generally want to
be able to make direct syscalls to msgsnd(), shmctl(), etc., and
in the kernel we would want them to be handled directly by
compat_sys_xxx() functions, as is true for other compat syscalls.

However, for historical reasons, several of the existing compat IPC
syscalls do not do this.  semctl() expects a pointer to the fourth
argument, instead of the fourth argument itself.  msgsnd(), msgrcv()
and shmat() expect arguments in different order.

This change adds an ARCH_WANT_OLD_COMPAT_IPC config option that can be
set to preserve this behavior for ports that use it (x86, sparc, powerpc,
s390, and mips).  No actual semantics are changed for those architectures,
and there is only a minimal amount of code refactoring in ipc/compat.c.

Newer architectures like tile (and perhaps future architectures such
as arm64 and unicore64) should not select this option, and thus can
avoid having any IPC-specific code at all in their architecture-specific
compat layer.  In the same vein, if this option is not selected, IPC_64
mode is assumed, since that's what the <asm-generic> headers expect.

The workaround code in "tile" for msgsnd() and msgrcv() is removed
with this change; it also fixes the bug that shmat() and semctl() were
not being properly handled.

Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
parent fde7d904
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -199,4 +199,7 @@ config HAVE_CMPXCHG_LOCAL
config HAVE_CMPXCHG_DOUBLE
	bool

config ARCH_WANT_OLD_COMPAT_IPC
	bool

source "kernel/gcov/Kconfig"
+1 −0
Original line number Diff line number Diff line
@@ -2456,6 +2456,7 @@ config MIPS32_COMPAT
config COMPAT
	bool
	depends on MIPS32_COMPAT
	select ARCH_WANT_OLD_COMPAT_IPC
	default y

config SYSVIPC_COMPAT
+1 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ config COMPAT
	bool
	default y if PPC64
	select COMPAT_BINFMT_ELF
	select ARCH_WANT_OLD_COMPAT_IPC

config SYSVIPC_COMPAT
	bool
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ config COMPAT
	prompt "Kernel support for 31 bit emulation"
	depends on 64BIT
	select COMPAT_BINFMT_ELF
	select ARCH_WANT_OLD_COMPAT_IPC
	help
	  Select this option if you want to enable your system kernel to
	  handle system-calls from ELF binaries for 31 bit ESA.  This option
+1 −0
Original line number Diff line number Diff line
@@ -576,6 +576,7 @@ config COMPAT
	depends on SPARC64
	default y
	select COMPAT_BINFMT_ELF
	select ARCH_WANT_OLD_COMPAT_IPC

config SYSVIPC_COMPAT
	bool
Loading