diff mbox series

[05/28] linux: Consolidate and cleanup personality syscall

Message ID 20201118195552.2687336-6-adhemerval.zanella@linaro.org
State New
Headers show
Series More Linux syscall refactor | expand

Commit Message

Adhemerval Zanella Nov. 18, 2020, 7:55 p.m. UTC
The PERSONALITY_TRUNCATE_ARGUMENT handling is also removed: Linux
currently does not define any flag larger than unsigned int and
if it is required for sparc64 (where the syscall does accept an
unsigned long) it would be better to add an arch specific
implementation.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/arm/syscalls.list     |  2 --
 sysdeps/unix/sysv/linux/hppa/syscalls.list    |  1 -
 sysdeps/unix/sysv/linux/i386/syscalls.list    |  2 --
 sysdeps/unix/sysv/linux/m68k/syscalls.list    |  1 -
 .../unix/sysv/linux/microblaze/syscalls.list  |  1 -
 .../sysv/linux/mips/mips64/n32/syscalls.list  |  2 --
 sysdeps/unix/sysv/linux/personality.c         | 24 +------------------
 .../sysv/linux/s390/s390-32/syscalls.list     |  1 -
 sysdeps/unix/sysv/linux/sh/syscalls.list      |  2 --
 .../sysv/linux/sparc/sparc64/personality.c    |  3 ---
 .../unix/sysv/linux/wordsize-64/syscalls.list |  1 -
 .../unix/sysv/linux/x86_64/x32/syscalls.list  |  1 -
 12 files changed, 1 insertion(+), 40 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 13441f7eb4..b19f26a2dd 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -19,8 +19,6 @@  prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
 
-personality	EXTRA	personality	Ei:i	__personality	personality
-
 # proper socket implementations:
 bind		-	bind		i:ipi	__bind		bind
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index cd37573b89..2a776aae27 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -13,4 +13,3 @@  socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 
 prlimit64	EXTRA	prlimit64	i:iipp	__prlimit64	prlimit64@@GLIBC_2.17
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.19
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/i386/syscalls.list b/sysdeps/unix/sysv/linux/i386/syscalls.list
index 58020dfae5..191081b949 100644
--- a/sysdeps/unix/sysv/linux/i386/syscalls.list
+++ b/sysdeps/unix/sysv/linux/i386/syscalls.list
@@ -22,5 +22,3 @@  vm86		-	vm86		i:ip	__vm86		vm86@@GLIBC_2.3.4
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/m68k/syscalls.list b/sysdeps/unix/sysv/linux/m68k/syscalls.list
index 55a377b841..aba75b59e0 100644
--- a/sysdeps/unix/sysv/linux/m68k/syscalls.list
+++ b/sysdeps/unix/sysv/linux/m68k/syscalls.list
@@ -18,4 +18,3 @@  setfsuid	-	setfsuid32	Ei:i	setfsuid
 cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/microblaze/syscalls.list b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
index 932c9cccc8..4ff1c9da7e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/syscalls.list
+++ b/sysdeps/unix/sysv/linux/microblaze/syscalls.list
@@ -4,4 +4,3 @@  cacheflush	EXTRA	cacheflush	i:iiii	__cacheflush	cacheflush
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
index 9e6a584685..e6c511fecb 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
@@ -7,5 +7,3 @@  lseek64		-	lseek		i:iii	__lseek64	__libc_lseek64 lseek64@@GLIBC_2.2 llseek@GLIBC
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/personality.c b/sysdeps/unix/sysv/linux/personality.c
index e45fffa1c2..4ab7d0ec1d 100644
--- a/sysdeps/unix/sysv/linux/personality.c
+++ b/sysdeps/unix/sysv/linux/personality.c
@@ -18,31 +18,9 @@ 
 #include <sys/personality.h>
 #include <sysdep.h>
 
-extern __typeof (personality) __personality;
-
 int
 __personality (unsigned long persona)
 {
-#ifdef PERSONALITY_TRUNCATE_ARGUMENT
-  /* Starting with kernel commit v2.6.21-3117-g97dc32c, the type of
-     task_struct->pesonality is "unsigned int".
-     Starting with kernel commit v2.6.35-rc1-372-g485d527, the personality
-     syscall accepts "unsigned int" instead of "long unsigned int".
-     Inbetween, a personality argument that does not fit into "unsigned int"
-     would result to system call returning -EINVAL.
-     We explicitly truncate the personality argument to "unsigned int"
-     to eliminate the uncertainty.  */
-  persona = (unsigned int) persona;
-#endif
-
-  long int ret = INTERNAL_SYSCALL_CALL (personality, persona);
-
-  /* Starting with kernel commit v2.6.29-6609-g11d06b2, the personality syscall
-     never fails.  However, 32-bit kernels might flag valid values as errors, so
-     we need to reverse the error setting.  We can't use the raw result as some
-     arches split the return/error values.  */
-  if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret)))
-    ret = -INTERNAL_SYSCALL_ERRNO (ret);
-  return ret;
+  return INTERNAL_SYSCALL_CALL (personality, persona);
 }
 weak_alias (__personality, personality)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
index 300b13dd01..5c267744db 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
@@ -17,4 +17,3 @@  setfsuid	-	setfsuid32	Ei:i	setfsuid
 
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	fanotify_mark
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/sh/syscalls.list b/sysdeps/unix/sysv/linux/sh/syscalls.list
index 32badd1ee0..6c2d2c6535 100644
--- a/sysdeps/unix/sysv/linux/sh/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sh/syscalls.list
@@ -18,5 +18,3 @@  setfsuid	-	setfsuid32	Ei:i	setfsuid
 prlimit64	EXTRA	prlimit64	i:iipp	prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiiis	__fanotify_mark	fanotify_mark@@GLIBC_2.16
-
-personality	EXTRA	personality	Ei:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c b/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
deleted file mode 100644
index 250e501d91..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/personality.c
+++ /dev/null
@@ -1,3 +0,0 @@ 
-/* Work around sign extension bug in the kernel.  */
-#define PERSONALITY_TRUNCATE_ARGUMENT
-#include <sysdeps/unix/sysv/linux/personality.c>
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 5de6ec823a..9316778dae 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -6,4 +6,3 @@  sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 prlimit		EXTRA	prlimit64	i:iipp	prlimit		prlimit64
 
 fanotify_mark	EXTRA	fanotify_mark	i:iiiis	fanotify_mark
-personality	EXTRA	personality	i:i	__personality	personality
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
index 58ea31d1fd..758ee988c5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list
@@ -1,4 +1,3 @@ 
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-personality	EXTRA	personality	Ei:i	__personality	personality
 posix_fadvise64	-	fadvise64	Vi:iiii	posix_fadvise	posix_fadvise64