On Dec 30, 2014, at 11:48 PM, Andrew Pinski wrote: >> If we have 64-bit kernel and 64-bit application is executed sys_getresuid is >> used for getresuid syscall, otherwise if 32-bit application is executed -- >> sys_getresuid16 is used. Thus 64-bit application will never call >> sys_getresuid16 implemenation. Then >> getresuid16/getresgid16/getgroups16/setgroups16/etc only needs to in 32-bit >> binary of libsanitizer. Same should apply for x86_64/i*86. >> >> Is that correct? > > Kinda. It only applies for aarch32 and not for AARCH64:ILP32. > AARCH64:ILP32 uses the standard system calls here too. I am attaching an updated patch, bootstrapped trunk on arrch64 with kernels 3.12 and 3.17 (QEMU). I looked at kernel source. If CONFIG_COMPAT is set then CONFIG_HAVE_UID16 is set. From include/linux/syscalls.h 523 #ifdef CONFIG_UID16 524 asmlinkage long sys_chown16(const char __user *filename, 525 old_uid_t user, old_gid_t group); 526 asmlinkage long sys_lchown16(const char __user *filename, 527 old_uid_t user, old_gid_t group); 528 asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group); 529 asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid); 530 asmlinkage long sys_setgid16(old_gid_t gid); 531 asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid); 532 asmlinkage long sys_setuid16(old_uid_t uid); 533 asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid); 534 asmlinkage long sys_getresuid16(old_uid_t __user *ruid, 535 old_uid_t __user *euid, old_uid_t __user *suid); 536 asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid); 537 asmlinkage long sys_getresgid16(old_gid_t __user *rgid, 538 old_gid_t __user *egid, old_gid_t __user *sgid); 539 asmlinkage long sys_setfsuid16(old_uid_t uid); 540 asmlinkage long sys_setfsgid16(old_gid_t gid); 541 asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist); 542 asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist); 543 asmlinkage long sys_getuid16(void); 544 asmlinkage long sys_geteuid16(void); 545 asmlinkage long sys_getgid16(void); 546 asmlinkage long sys_getegid16(void); 547 #endif Thus I disabled such syscalls in libsanitizer with SANITIZER_WORDSIZE macro and disabled type checks for __kernel_old_{uid,gid}_t. Did not touch the fragment which sets __kernel_old_{uid,gid}_t. SANITIZER_WORDSIZE is set based on _LP64 macro. If patch is acceptable I could do more tests after holidays. Thanks, david