Commit 05e43966 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] Use SYSVIPC_COMPAT to fix various problems on N32

N32 SysV IPC system calls should use 32-bit compatible code.
arch/mips/kernel/linux32.c have similar compatible code for O32, but
ipc/compat.c seems more complete.  We can use it for both N32 and O32.

This patch should fix these problems (and other possible problems):

http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=1149188824.6986.6.camel%40diimka-laptop
http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=44C6B829.8050508%40caviumnetworks.comSigned-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 9567772f
...@@ -1940,6 +1940,11 @@ config COMPAT ...@@ -1940,6 +1940,11 @@ config COMPAT
depends on MIPS32_COMPAT depends on MIPS32_COMPAT
default y default y
config SYSVIPC_COMPAT
bool
depends on COMPAT && SYSVIPC
default y
config MIPS32_O32 config MIPS32_O32
bool "Kernel support for o32 binaries" bool "Kernel support for o32 binaries"
depends on MIPS32_COMPAT depends on MIPS32_COMPAT
......
This diff is collapsed.
...@@ -149,8 +149,8 @@ EXPORT(sysn32_call_table) ...@@ -149,8 +149,8 @@ EXPORT(sysn32_call_table)
PTR sys_mincore PTR sys_mincore
PTR sys_madvise PTR sys_madvise
PTR sys_shmget PTR sys_shmget
PTR sys32_shmat PTR sys_shmat
PTR sys_shmctl /* 6030 */ PTR compat_sys_shmctl /* 6030 */
PTR sys_dup PTR sys_dup
PTR sys_dup2 PTR sys_dup2
PTR sys_pause PTR sys_pause
...@@ -184,12 +184,12 @@ EXPORT(sysn32_call_table) ...@@ -184,12 +184,12 @@ EXPORT(sysn32_call_table)
PTR sys32_newuname PTR sys32_newuname
PTR sys_semget PTR sys_semget
PTR sys_semop PTR sys_semop
PTR sys_semctl PTR sysn32_semctl
PTR sys_shmdt /* 6065 */ PTR sys_shmdt /* 6065 */
PTR sys_msgget PTR sys_msgget
PTR sys_msgsnd PTR compat_sys_msgsnd
PTR sys_msgrcv PTR compat_sys_msgrcv
PTR sys_msgctl PTR compat_sys_msgctl
PTR compat_sys_fcntl /* 6070 */ PTR compat_sys_fcntl /* 6070 */
PTR sys_flock PTR sys_flock
PTR sys_fsync PTR sys_fsync
...@@ -335,7 +335,7 @@ EXPORT(sysn32_call_table) ...@@ -335,7 +335,7 @@ EXPORT(sysn32_call_table)
PTR compat_sys_fcntl64 PTR compat_sys_fcntl64
PTR sys_set_tid_address PTR sys_set_tid_address
PTR sys_restart_syscall PTR sys_restart_syscall
PTR sys_semtimedop /* 6215 */ PTR compat_sys_semtimedop /* 6215 */
PTR sys_fadvise64_64 PTR sys_fadvise64_64
PTR compat_sys_statfs64 PTR compat_sys_statfs64
PTR compat_sys_fstatfs64 PTR compat_sys_fstatfs64
......
...@@ -32,6 +32,7 @@ typedef struct { ...@@ -32,6 +32,7 @@ typedef struct {
s32 val[2]; s32 val[2];
} compat_fsid_t; } compat_fsid_t;
typedef s32 compat_timer_t; typedef s32 compat_timer_t;
typedef s32 compat_key_t;
typedef s32 compat_int_t; typedef s32 compat_int_t;
typedef s32 compat_long_t; typedef s32 compat_long_t;
...@@ -146,4 +147,71 @@ static inline void __user *compat_alloc_user_space(long len) ...@@ -146,4 +147,71 @@ static inline void __user *compat_alloc_user_space(long len)
return (void __user *) (regs->regs[29] - len); return (void __user *) (regs->regs[29] - len);
} }
struct compat_ipc64_perm {
compat_key_t key;
__compat_uid32_t uid;
__compat_gid32_t gid;
__compat_uid32_t cuid;
__compat_gid32_t cgid;
compat_mode_t mode;
unsigned short seq;
unsigned short __pad2;
compat_ulong_t __unused1;
compat_ulong_t __unused2;
};
struct compat_semid64_ds {
struct compat_ipc64_perm sem_perm;
compat_time_t sem_otime;
compat_time_t sem_ctime;
compat_ulong_t sem_nsems;
compat_ulong_t __unused1;
compat_ulong_t __unused2;
};
struct compat_msqid64_ds {
struct compat_ipc64_perm msg_perm;
#ifndef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused1;
#endif
compat_time_t msg_stime;
#ifdef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused1;
#endif
#ifndef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused2;
#endif
compat_time_t msg_rtime;
#ifdef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused2;
#endif
#ifndef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused3;
#endif
compat_time_t msg_ctime;
#ifdef CONFIG_CPU_LITTLE_ENDIAN
compat_ulong_t __unused3;
#endif
compat_ulong_t msg_cbytes;
compat_ulong_t msg_qnum;
compat_ulong_t msg_qbytes;
compat_pid_t msg_lspid;
compat_pid_t msg_lrpid;
compat_ulong_t __unused4;
compat_ulong_t __unused5;
};
struct compat_shmid64_ds {
struct compat_ipc64_perm shm_perm;
compat_size_t shm_segsz;
compat_time_t shm_atime;
compat_time_t shm_dtime;
compat_time_t shm_ctime;
compat_pid_t shm_cpid;
compat_pid_t shm_lpid;
compat_ulong_t shm_nattch;
compat_ulong_t __unused1;
compat_ulong_t __unused2;
};
#endif /* _ASM_COMPAT_H */ #endif /* _ASM_COMPAT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment