Message ID | alpine.DEB.2.21.1810312138210.17117@digraph.polyomino.org.uk |
---|---|
State | New |
Headers | show |
Series | Update and correct SPARC configuration for supported socket syscalls | expand |
From: Joseph Myers <joseph@codesourcery.com> Date: Wed, 31 Oct 2018 21:41:31 +0000 > Note the observation in a comment in the patch that even the latest > Linux kernel for SPARC does not have getpeername and getsockname > syscalls in the compat syscall table for 32-bit binaries on 64-bit > kernels (so glibc can't assume those syscalls to be present for 32-bit > at all, although the 32-bit syscall table gained them in 4.4). I'm fixing this as follows, thanks for pointing this out. Your patch looks fine to me. From 1f2b5b8e2df4591fbca430aff9c5a072dcc0f408 Mon Sep 17 00:00:00 2001 From: "David S. Miller" <davem@davemloft.net> Date: Wed, 31 Oct 2018 18:30:21 -0700 Subject: [PATCH] sparc64: Wire up compat getpeername and getsockname. Fixes: 8b30ca73b7cc ("sparc: Add all necessary direct socket system calls.") Reported-by: Joseph Myers <joseph@codesourcery.com> Signed-off-by: David S. Miller <davem@davemloft.net> --- arch/sparc/kernel/systbls_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index bb68c80..ff9389a 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S @@ -47,9 +47,9 @@ sys_call_table32: .word sys_recvfrom, sys_setreuid16, sys_setregid16, sys_rename, compat_sys_truncate /*130*/ .word compat_sys_ftruncate, sys_flock, compat_sys_lstat64, sys_sendto, sys_shutdown .word sys_socketpair, sys_mkdir, sys_rmdir, compat_sys_utimes, compat_sys_stat64 -/*140*/ .word sys_sendfile64, sys_nis_syscall, compat_sys_futex, sys_gettid, compat_sys_getrlimit +/*140*/ .word sys_sendfile64, sys_getpeername, compat_sys_futex, sys_gettid, compat_sys_getrlimit .word compat_sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write -/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64 +/*150*/ .word sys_getsockname, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64 .word compat_sys_fcntl64, sys_inotify_rm_watch, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount /*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall .word sys_quotactl, sys_set_tid_address, compat_sys_mount, compat_sys_ustat, sys_setxattr
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 91990a716f..fd48081a77 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -28,11 +28,34 @@ # undef __ASSUME_SET_ROBUST_LIST #endif -#if !defined __arch64__ +/* These syscalls were added for 32-bit in 4.4 (but present for 64-bit + in all supported kernel versions); the architecture-independent + kernel-features.h assumes some of them to be present by default. + getpeername and getsockname syscalls were also added for 32-bit in + 4.4, but only for 32-bit kernels, not in the compat syscall table + for 64-bit kernels. */ +#if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x040400 +# undef __ASSUME_SENDMSG_SYSCALL +# undef __ASSUME_RECVMSG_SYSCALL # undef __ASSUME_ACCEPT_SYSCALL # undef __ASSUME_CONNECT_SYSCALL # undef __ASSUME_RECVFROM_SYSCALL +# undef __ASSUME_SENDTO_SYSCALL #else +# define __ASSUME_SOCKET_SYSCALL 1 +# define __ASSUME_SOCKETPAIR_SYSCALL 1 +# define __ASSUME_GETSOCKOPT_SYSCALL 1 +# define __ASSUME_SHUTDOWN_SYSCALL 1 +#endif + +/* These syscalls were added for both 32-bit and 64-bit in 4.4. */ +#if __LINUX_KERNEL_VERSION >= 0x040400 +# define __ASSUME_BIND_SYSCALL 1 +# define __ASSUME_LISTEN_SYSCALL 1 +# define __ASSUME_SETSOCKOPT_SYSCALL 1 +#endif + +#ifdef __arch64__ /* sparc64 defines __NR_pause, however it is not supported (ENOSYS). Undefine so pause.c can use a correct alternative. */ # undef __NR_pause diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index 33082f31eb..d30d7f2b96 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -1,10 +1,7 @@ # File name Caller Syscall name # args Strong name Weak names -bind - bind 3 __bind bind getpeername - getpeername 3 __getpeername getpeername getsockname - getsockname 3 __getsockname getsockname getsockopt - getsockopt 5 __getsockopt getsockopt -listen - listen 2 __listen listen -setsockopt - setsockopt 5 __setsockopt setsockopt shutdown - shutdown 2 __shutdown shutdown socketpair - socketpair 4 __socketpair socketpair