Skip to content

Commit

Permalink
ipc: allow compat IPC version field parsing if !ARCH_WANT_OLD_COMPAT_IPC
Browse files Browse the repository at this point in the history
Commit 48b25c4 ("ipc: provide generic compat versions of IPC
syscalls") added a new ARCH_WANT_OLD_COMPAT_IPC config option for
architectures to select if their compat target requires the old IPC
syscall interface.

For architectures (such as AArch64) that do not require the internal
calling conventions provided by this option, but have a compat target
where the C library passes the IPC_64 flag explicitly,
compat_ipc_parse_version no longer strips out the flag before calling
the native system call implementation, resulting in unknown SHM/IPC
commands and -EINVAL being returned to userspace.

This patch separates the selection of the internal calling conventions
for the IPC syscalls from the version parsing, allowing architectures to
select __ARCH_WANT_COMPAT_IPC_PARSE_VERSION if they want to use version
parsing whilst retaining the newer syscall calling conventions.

Acked-by: Chris Metcalf <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
wildea01 authored and torvalds committed Jul 31, 2012
1 parent 079a96a commit b610c04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/linux/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
compat_size_t __user *len_ptr);

#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
long compat_sys_semctl(int first, int second, int third, void __user *uptr);
long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
Expand Down
2 changes: 1 addition & 1 deletion ipc/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ extern int sem_ctls[];

static inline int compat_ipc_parse_version(int *cmd)
{
#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
#ifdef __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
int version = *cmd & IPC_64;

/* this is tricky: architectures that have support for the old
Expand Down

0 comments on commit b610c04

Please sign in to comment.