Blame SOURCES/glibc-rh736346.patch

b9ba6d
2011-01-14  Ulrich Drepper  <drepper@gmail.com>
b9ba6d
b9ba6d
	[BZ #10563]
b9ba6d
	* sysdeps/unix/sysv/linux/i386/setgroups.c: Use INLINE_SETXID_SYSCALL
b9ba6d
	to make the syscall.
b9ba6d
	* sysdeps/unix/sysv/linux/setgroups.c: New file.
b9ba6d
b9ba6d
2011-01-14  Ulrich Drepper  <drepper@gmail.com>
b9ba6d
b9ba6d
	[BZ #10563]
b9ba6d
	* sysdeps/pthread/setxid.h (__SETXID_1): Add cast to assignment.
b9ba6d
	(__SETXID_2): Likewise.
b9ba6d
	(__SETXID_3): Likewise.
b9ba6d
b9ba6d
Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
b9ba6d
===================================================================
b9ba6d
--- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/setxid.h
b9ba6d
+++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
b9ba6d
@@ -20,11 +20,11 @@
b9ba6d
 #include <sysdep.h>
b9ba6d
 
b9ba6d
 #define __SETXID_1(cmd, arg1) \
b9ba6d
-  cmd.id[0] = arg1
b9ba6d
+  cmd.id[0] = (long int) arg1
b9ba6d
 #define __SETXID_2(cmd, arg1, arg2) \
b9ba6d
-  __SETXID_1 (cmd, arg1); cmd.id[1] = arg2
b9ba6d
+  __SETXID_1 (cmd, arg1); cmd.id[1] = (long int) arg2
b9ba6d
 #define __SETXID_3(cmd, arg1, arg2, arg3) \
b9ba6d
-  __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = arg3
b9ba6d
+  __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = (long int) arg3
b9ba6d
 
b9ba6d
 #ifdef SINGLE_THREAD
b9ba6d
 # define INLINE_SETXID_SYSCALL(name, nr, args...) \
b9ba6d
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
b9ba6d
===================================================================
b9ba6d
--- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/setgroups.c
b9ba6d
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
b9ba6d
@@ -25,6 +25,7 @@
b9ba6d
 #include <sys/syscall.h>
b9ba6d
 #include <bp-checks.h>
b9ba6d
 
b9ba6d
+#include <setxid.h>
b9ba6d
 #include <linux/posix_types.h>
b9ba6d
 #include <kernel-features.h>
b9ba6d
 
b9ba6d
@@ -44,7 +45,7 @@ int
b9ba6d
 setgroups (size_t n, const gid_t *groups)
b9ba6d
 {
b9ba6d
 #if __ASSUME_32BITUIDS > 0
b9ba6d
-  return INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b9ba6d
+  return INLINE_SETXID_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b9ba6d
 #else
b9ba6d
   if (n > (size_t) __sysconf (_SC_NGROUPS_MAX))
b9ba6d
     {
b9ba6d
@@ -62,7 +63,8 @@ setgroups (size_t n, const gid_t *groups
b9ba6d
 	  int result;
b9ba6d
 	  int saved_errno = errno;
b9ba6d
 
b9ba6d
-	  result = INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
b9ba6d
+	  result = INLINE_SETXID_SYSCALL (setgroups32, 2, n,
b9ba6d
+					  CHECK_N (groups, n));
b9ba6d
 	  if (result == 0 || errno != ENOSYS)
b9ba6d
 	    return result;
b9ba6d
 
b9ba6d
@@ -80,7 +82,8 @@ setgroups (size_t n, const gid_t *groups
b9ba6d
 	    }
b9ba6d
 	}
b9ba6d
 
b9ba6d
-      return INLINE_SYSCALL (setgroups, 2, n, CHECK_N (kernel_groups, n));
b9ba6d
+      return INLINE_SETXID_SYSCALL (setgroups, 2, n,
b9ba6d
+				    CHECK_N (kernel_groups, n));
b9ba6d
     }
b9ba6d
 #endif
b9ba6d
 }
b9ba6d
Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
b9ba6d
===================================================================
b9ba6d
--- /dev/null
b9ba6d
+++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
b9ba6d
@@ -0,0 +1,37 @@
b9ba6d
+/* Copyright (C) 1997,1998,2000,2002,2004,2006,2011
b9ba6d
+   Free Software Foundation, Inc.
b9ba6d
+   This file is part of the GNU C Library.
b9ba6d
+
b9ba6d
+   The GNU C Library is free software; you can redistribute it and/or
b9ba6d
+   modify it under the terms of the GNU Lesser General Public
b9ba6d
+   License as published by the Free Software Foundation; either
b9ba6d
+   version 2.1 of the License, or (at your option) any later version.
b9ba6d
+
b9ba6d
+   The GNU C Library is distributed in the hope that it will be useful,
b9ba6d
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
b9ba6d
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b9ba6d
+   Lesser General Public License for more details.
b9ba6d
+
b9ba6d
+   You should have received a copy of the GNU Lesser General Public
b9ba6d
+   License along with the GNU C Library; if not, write to the Free
b9ba6d
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
b9ba6d
+   02111-1307 USA.  */
b9ba6d
+
b9ba6d
+#include <errno.h>
b9ba6d
+#include <grp.h>
b9ba6d
+#include <setxid.h>
b9ba6d
+#include <sysdep.h>
b9ba6d
+
b9ba6d
+
b9ba6d
+/* Set the group set for the current user to GROUPS (N of them).  For
b9ba6d
+   Linux we must convert the array of groups into the format that the
b9ba6d
+   kernel expects.  */
b9ba6d
+int
b9ba6d
+setgroups (size_t n, const gid_t *groups)
b9ba6d
+{
b9ba6d
+#ifdef __NR_setgroups32
b9ba6d
+# error "wrong setgroups.c file used"
b9ba6d
+#endif
b9ba6d
+  return INLINE_SETXID_SYSCALL (setgroups, 2, n, groups);
b9ba6d
+}
b9ba6d
+libc_hidden_def (setgroups)