Skip to content

Commit

Permalink
arch: add split IPC system calls where needed
Browse files Browse the repository at this point in the history
The IPC system call handling is highly inconsistent across architectures,
some use sys_ipc, some use separate calls, and some use both.  We also
have some architectures that require passing IPC_64 in the flags, and
others that set it implicitly.

For the addition of a y2038 safe semtimedop() system call, I chose to only
support the separate entry points, but that requires first supporting
the regular ones with their own syscall numbers.

The IPC_64 is now implied by the new semctl/shmctl/msgctl system
calls even on the architectures that require passing it with the ipc()
multiplexer.

I'm not adding the new semtimedop() or semop() on 32-bit architectures,
those will get implemented using the new semtimedop_time64() version
that gets added along with the other time64 calls.
Three 64-bit architectures (powerpc, s390 and sparc) get semtimedop().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
  • Loading branch information
arndb committed Jan 25, 2019
1 parent 275f221 commit 0d6040d
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/m68k/kernel/syscalls/syscall.tbl
Expand Up @@ -388,3 +388,14 @@
378 common pwritev2 sys_pwritev2
379 common statx sys_statx
380 common seccomp sys_seccomp
# room for arch specific calls
393 common semget sys_semget
394 common semctl sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl
397 common shmat sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd
401 common msgrcv sys_msgrcv
402 common msgctl sys_msgctl
11 changes: 11 additions & 0 deletions arch/mips/kernel/syscalls/syscall_o32.tbl
Expand Up @@ -380,3 +380,14 @@
366 o32 statx sys_statx
367 o32 rseq sys_rseq
368 o32 io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
# room for arch specific calls
393 o32 semget sys_semget
394 o32 semctl sys_semctl compat_sys_semctl
395 o32 shmget sys_shmget
396 o32 shmctl sys_shmctl compat_sys_shmctl
397 o32 shmat sys_shmat compat_sys_shmat
398 o32 shmdt sys_shmdt
399 o32 msgget sys_msgget
400 o32 msgsnd sys_msgsnd compat_sys_msgsnd
401 o32 msgrcv sys_msgrcv compat_sys_msgrcv
402 o32 msgctl sys_msgctl compat_sys_msgctl
13 changes: 13 additions & 0 deletions arch/powerpc/kernel/syscalls/syscall.tbl
Expand Up @@ -414,6 +414,7 @@
363 spu switch_endian sys_ni_syscall
364 common userfaultfd sys_userfaultfd
365 common membarrier sys_membarrier
# 366-377 originally left for IPC, now unused
378 nospu mlock2 sys_mlock2
379 nospu copy_file_range sys_copy_file_range
380 common preadv2 sys_preadv2 compat_sys_preadv2
Expand All @@ -425,3 +426,15 @@
386 nospu pkey_mprotect sys_pkey_mprotect
387 nospu rseq sys_rseq
388 nospu io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
# room for arch specific syscalls
392 64 semtimedop sys_semtimedop
393 common semget sys_semget
394 common semctl sys_semctl compat_sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl compat_sys_shmctl
397 common shmat sys_shmat compat_sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd compat_sys_msgsnd
401 common msgrcv sys_msgrcv compat_sys_msgrcv
402 common msgctl sys_msgctl compat_sys_msgctl
12 changes: 12 additions & 0 deletions arch/s390/kernel/syscalls/syscall.tbl
Expand Up @@ -391,3 +391,15 @@
381 common kexec_file_load sys_kexec_file_load sys_kexec_file_load
382 common io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
383 common rseq sys_rseq sys_rseq
# room for arch specific syscalls
392 64 semtimedop sys_semtimedop -
393 common semget sys_semget sys_semget
394 common semctl sys_semctl compat_sys_semctl
395 common shmget sys_shmget sys_shmget
396 common shmctl sys_shmctl compat_sys_shmctl
397 common shmat sys_shmat compat_sys_shmat
398 common shmdt sys_shmdt sys_shmdt
399 common msgget sys_msgget sys_msgget
400 common msgsnd sys_msgsnd compat_sys_msgsnd
401 common msgrcv sys_msgrcv compat_sys_msgrcv
402 common msgctl sys_msgctl compat_sys_msgctl
11 changes: 11 additions & 0 deletions arch/sh/kernel/syscalls/syscall.tbl
Expand Up @@ -391,3 +391,14 @@
381 common preadv2 sys_preadv2
382 common pwritev2 sys_pwritev2
383 common statx sys_statx
# room for arch specific syscalls
393 common semget sys_semget
394 common semctl sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl
397 common shmat sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd
401 common msgrcv sys_msgrcv
402 common msgctl sys_msgctl
12 changes: 12 additions & 0 deletions arch/sparc/kernel/syscalls/syscall.tbl
Expand Up @@ -407,3 +407,15 @@
359 common pwritev2 sys_pwritev2 compat_sys_pwritev2
360 common statx sys_statx
361 common io_pgetevents sys_io_pgetevents compat_sys_io_pgetevents
# room for arch specific syscalls
392 64 semtimedop sys_semtimedop
393 common semget sys_semget
394 common semctl sys_semctl compat_sys_semctl
395 common shmget sys_shmget
396 common shmctl sys_shmctl compat_sys_shmctl
397 common shmat sys_shmat compat_sys_shmat
398 common shmdt sys_shmdt
399 common msgget sys_msgget
400 common msgsnd sys_msgsnd compat_sys_msgsnd
401 common msgrcv sys_msgrcv compat_sys_msgrcv
402 common msgctl sys_msgctl compat_sys_msgctl
11 changes: 11 additions & 0 deletions arch/x86/entry/syscalls/syscall_32.tbl
Expand Up @@ -398,3 +398,14 @@
384 i386 arch_prctl sys_arch_prctl __ia32_compat_sys_arch_prctl
385 i386 io_pgetevents sys_io_pgetevents __ia32_compat_sys_io_pgetevents
386 i386 rseq sys_rseq __ia32_sys_rseq
# don't use numbers 387 through 392, add new calls at the end
393 i386 semget sys_semget __ia32_sys_semget
394 i386 semctl sys_semctl __ia32_compat_sys_semctl
395 i386 shmget sys_shmget __ia32_sys_shmget
396 i386 shmctl sys_shmctl __ia32_compat_sys_shmctl
397 i386 shmat sys_shmat __ia32_compat_sys_shmat
398 i386 shmdt sys_shmdt __ia32_sys_shmdt
399 i386 msgget sys_msgget __ia32_sys_msgget
400 i386 msgsnd sys_msgsnd __ia32_compat_sys_msgsnd
401 i386 msgrcv sys_msgrcv __ia32_compat_sys_msgrcv
402 i386 msgctl sys_msgctl __ia32_compat_sys_msgctl
2 changes: 2 additions & 0 deletions arch/x86/entry/syscalls/syscall_64.tbl
Expand Up @@ -343,6 +343,8 @@
332 common statx __x64_sys_statx
333 common io_pgetevents __x64_sys_io_pgetevents
334 common rseq __x64_sys_rseq
# don't use numbers 387 through 423, add new calls after the last
# 'common' entry

#
# x32-specific system call numbers start at 512 to avoid cache impact
Expand Down
1 change: 1 addition & 0 deletions include/uapi/asm-generic/unistd.h
Expand Up @@ -740,6 +740,7 @@ __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents)
__SYSCALL(__NR_rseq, sys_rseq)
#define __NR_kexec_file_load 294
__SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)
/* 295 through 402 are unassigned to sync up with generic numbers, don't use */

#undef __NR_syscalls
#define __NR_syscalls 295
Expand Down

0 comments on commit 0d6040d

Please sign in to comment.