about summary refs log tree commit diff
path: root/nptl/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-07-16 03:37:10 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-07-27 12:32:41 -0700
commit0ad926f34937f7b4843a8b49e5d93199601fe324 (patch)
treeca8a5ee934163ebaff49497afd15513bf6cc8fda /nptl/Makefile
parentb51c1500e02cec3a61c385d5aa919287f32bbd58 (diff)
downloadglibc-0ad926f34937f7b4843a8b49e5d93199601fe324.tar.gz
glibc-0ad926f34937f7b4843a8b49e5d93199601fe324.tar.xz
glibc-0ad926f34937f7b4843a8b49e5d93199601fe324.zip
nptl: Zero-extend arguments to SETXID syscalls [BZ #26248]
nptl has

/* Opcodes and data types for communication with the signal handler to
   change user/group IDs.  */
struct xid_command
{
  int syscall_no;
  long int id[3];
  volatile int cntr;
  volatile int error;
};

 /* This must be last, otherwise the current thread might not have
     permissions to send SIGSETXID syscall to the other threads.  */
  result = INTERNAL_SYSCALL_NCS (cmdp->syscall_no, 3,
                                 cmdp->id[0], cmdp->id[1], cmdp->id[2]);

But the second argument of setgroups syscal is a pointer:

       int setgroups (size_t size, const gid_t *list);

But on x32, pointers passed to syscall must have pointer type so that
they will be zero-extended.  The kernel XID arguments are unsigned and
do not require sign extension.  Change xid_command to

struct xid_command
{
  int syscall_no;
  unsigned long int id[3];
  volatile int cntr;
  volatile int error;
};

so that all arguments are zero-extended.  A testcase is added for x32 and
setgroups returned with EFAULT when running as root without the fix.
Diffstat (limited to 'nptl/Makefile')
-rw-r--r--nptl/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/nptl/Makefile b/nptl/Makefile
index 5e62c77853..89569c4f46 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -310,7 +310,7 @@ tests-internal := tst-robustpi8 tst-rwlock19 tst-rwlock20 \
 		  tst-setgetname \
 
 xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
-	tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
+	tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 tst-setgroups
 
 # This test can run into task limits because of a linux kernel bug
 # and then cause the make process to fail too, see bug 24537.