about summary refs log tree commit diff
path: root/nptl/tst-mutexpi5a.c
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/tst-mutexpi5a.c
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/tst-mutexpi5a.c')
0 files changed, 0 insertions, 0 deletions