glibc/sysdeps/unix/sysv/linux/i386
Dmitry V. Levin e0043e17df Fix linux personality syscall wrapper
The personality system call, starting with linux kernel commit
v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, always
successfully changes the personality if requested.  The syscall
wrapper, however, still can return an error in the following cases:
- the value returned by the system call looks like an error
due to architecture limitations of 32-bit kernels;
- a personality greater than 0xffffffff is passed to the system call,
and the 64-bit kernel does not have commit
v2.6.35-rc1-372-g485d527686850d68a0e9006dd9904f19f122485e
that would truncate this value to unsigned int;
- on sparc64, the value returned by the system call looks like an error
due to sparc64 kernel sign extension bug.

The solution is three-fold:
- move generic syscalls.list personality entry to generic 64-bit
syscalls.list file;
- for each 32-bit architecture that use negated errno semantics,
add a NOERRNO personality entry to their syscalls.list file;
- for sparc64 and 32-bit architectures that use dedicated registers
to flag syscall errors, add a wrapper around personality syscall;
if the system call return value is flagged as an error, this wrapper
returns the negated "would be errno" value, otherwise it returns
the system call return value; on sparc64, it also truncates the
personality argument to unsigned int before passing it to the kernel.

[BZ #19408]
* sysdeps/unix/sysv/linux/personality.c: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/personality.c: Likewise.
* sysdeps/unix/sysv/linux/tst-personality.c: Likewise.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) == misc]
(sysdep_routines): Add personality.
(tests): Add tst-personality.
* sysdeps/unix/sysv/linux/syscalls.list (personality): Move ...
* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: ... here.
* sysdeps/unix/sysv/linux/arm/syscalls.list (personality): New entry.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/microblaze/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (personality):
Likewise.
* sysdeps/unix/sysv/linux/sh/syscalls.list (personality): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/syscalls.list (personality):
Likewise.
2015-12-31 00:17:48 +00:00
..
i686 Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
i786 Move remaining nptl/sysdeps/unix/sysv/linux/i386/ files. 2014-05-14 13:37:40 -07:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
_exit.S PLT avoidance for _exit in rtld. 2015-07-09 15:25:47 -07:00
alphasort64.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
arch-fork.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
brk.c Use INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE 2015-10-14 03:45:46 -07:00
c++-types.data x86: Move abilist files out of nptl/ subdirectories. 2014-05-14 15:45:23 -07:00
clone.S Add INLINE_SYSCALL_ERROR_RETURN_VALUE 2015-10-13 11:59:15 -07:00
configure Move architecture cases out of sysdeps/unix/sysv/linux/configure.ac. 2014-06-24 20:53:03 +00:00
configure.ac Move architecture cases out of sysdeps/unix/sysv/linux/configure.ac. 2014-06-24 20:53:03 +00:00
dl-librecon.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-procinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
fcntl.c nptl: Rewrite cancellation macros 2015-06-04 18:58:36 -03:00
fxstat.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00
fxstatat.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00
get_clockfreq.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getcontext.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getdents64.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
getmsg.c Convert 231 sysdeps function definitions to prototype style. 2015-10-19 12:04:33 +00:00
getrlimit64.c Fix posix_spawn getrlimit64 namespace (bug 17991). 2015-02-18 00:26:35 +00:00
gettimeofday.c x86: Remove vsyscall usage 2015-06-09 18:10:19 -03:00
glob64.c Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
Implies NPTL is no longer an add-on! 2014-07-07 09:29:06 -07:00
init-first.c Consolidate vDSO macros and usage 2015-05-26 10:10:36 -03:00
kernel-features.h Use direct socket syscalls for new kernels on i386, m68k, microblaze, sh. 2015-12-09 20:59:43 +00:00
ld.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
ldconfig.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
libanl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libBrokenLocale.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libc-do-syscall.S Build i386 __libc_do_syscall when PROF is defined 2015-10-21 10:14:08 -07:00
libc-lowlevellock.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
libc.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libcrypt.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libdl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libm.abilist Fix lgamma setting signgam for ISO C (bug 15421). 2015-11-20 22:49:59 +00:00
libnsl.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libpthread.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libresolv.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
librt.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libthread_db.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
libutil.abilist Simplify the abilist format 2015-11-06 13:58:53 +01:00
lll_timedlock_wait.c Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
lll_timedwait_tid.c Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
localplt.data Support PLT and GOT references in local PIC check 2015-10-14 06:00:02 -07:00
lockf64.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00
lowlevellock.h Fix i386 build for lll_unlock_elision change. 2015-10-16 16:04:06 +00:00
lowlevellock.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
lowlevelrobustlock.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
lxstat.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00
makecontext.S Call __setcontext with HIDDEN_JUMPTARGET 2015-08-19 04:41:01 -07:00
Makefile Apply -fomit-frame-pointer only to .o/.os files 2015-10-21 09:05:01 -07:00
mmap.c i386: Remove syscall assembly codes with 6 arguments 2015-10-15 05:03:24 -07:00
olddirent.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
oldgetrlimit64.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
posix_fadvise64.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
profil-counter.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
pthread_barrier_wait.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
pthread_cond_broadcast.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
pthread_cond_signal.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
pthread_cond_timedwait.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
pthread_cond_wait.S Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386 2015-09-30 10:12:44 -07:00
putmsg.c Convert 69 more function definitions to prototype style (line wrap cases). 2015-10-19 21:23:47 +00:00
readdir64_r.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
readdir64.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
readelflib.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
register-dump.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
scandir64.c Convert miscellaneous function definitions to prototype style. 2015-10-20 21:27:22 +00:00
setcontext.S Call __setcontext with HIDDEN_JUMPTARGET 2015-08-19 04:41:01 -07:00
setegid.c Convert 231 sysdeps function definitions to prototype style. 2015-10-19 12:04:33 +00:00
seteuid.c Use INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE 2015-10-14 03:45:46 -07:00
setgid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setgroups.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setregid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setresgid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setresuid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setreuid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
setuid.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
shlib-versions Clean up gnu/lib-names.h generation (bug 14171). 2014-09-26 17:33:04 +00:00
sigaction.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
smp.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
swapcontext.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
syscall.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
syscalls.list Fix linux personality syscall wrapper 2015-12-31 00:17:48 +00:00
sysdep-cancel.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
sysdep.c Add INLINE_SYSCALL_ERROR_RETURN_VALUE 2015-10-13 11:59:15 -07:00
sysdep.h Build i386 __libc_do_syscall when PROF is defined 2015-10-21 10:14:08 -07:00
time.c x86: Remove vsyscall usage 2015-06-09 18:10:19 -03:00
ucontext_i.sym
Versions
versionsort64.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
vfork.S Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
xstat.c Always use INTERNAL_SYSCALL_ERRNO with INTERNAL_SYSCALL 2015-10-22 14:59:29 +02:00