]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh736346.patch
Merge remote-tracking branch 'origin/next' into thirteen
[people/pmueller/ipfire-2.x.git] / src / patches / glibc / glibc-rh736346.patch
1 2011-01-14 Ulrich Drepper <drepper@gmail.com>
2
3 [BZ #10563]
4 * sysdeps/unix/sysv/linux/i386/setgroups.c: Use INLINE_SETXID_SYSCALL
5 to make the syscall.
6 * sysdeps/unix/sysv/linux/setgroups.c: New file.
7
8 2011-01-14 Ulrich Drepper <drepper@gmail.com>
9
10 [BZ #10563]
11 * sysdeps/pthread/setxid.h (__SETXID_1): Add cast to assignment.
12 (__SETXID_2): Likewise.
13 (__SETXID_3): Likewise.
14
15 Index: glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
16 ===================================================================
17 --- glibc-2.12-2-gc4ccff1.orig/nptl/sysdeps/pthread/setxid.h
18 +++ glibc-2.12-2-gc4ccff1/nptl/sysdeps/pthread/setxid.h
19 @@ -20,11 +20,11 @@
20 #include <sysdep.h>
21
22 #define __SETXID_1(cmd, arg1) \
23 - cmd.id[0] = arg1
24 + cmd.id[0] = (long int) arg1
25 #define __SETXID_2(cmd, arg1, arg2) \
26 - __SETXID_1 (cmd, arg1); cmd.id[1] = arg2
27 + __SETXID_1 (cmd, arg1); cmd.id[1] = (long int) arg2
28 #define __SETXID_3(cmd, arg1, arg2, arg3) \
29 - __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = arg3
30 + __SETXID_2 (cmd, arg1, arg2); cmd.id[2] = (long int) arg3
31
32 #ifdef SINGLE_THREAD
33 # define INLINE_SETXID_SYSCALL(name, nr, args...) \
34 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
35 ===================================================================
36 --- glibc-2.12-2-gc4ccff1.orig/sysdeps/unix/sysv/linux/i386/setgroups.c
37 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/i386/setgroups.c
38 @@ -25,6 +25,7 @@
39 #include <sys/syscall.h>
40 #include <bp-checks.h>
41
42 +#include <setxid.h>
43 #include <linux/posix_types.h>
44 #include <kernel-features.h>
45
46 @@ -44,7 +45,7 @@ int
47 setgroups (size_t n, const gid_t *groups)
48 {
49 #if __ASSUME_32BITUIDS > 0
50 - return INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
51 + return INLINE_SETXID_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
52 #else
53 if (n > (size_t) __sysconf (_SC_NGROUPS_MAX))
54 {
55 @@ -62,7 +63,8 @@ setgroups (size_t n, const gid_t *groups
56 int result;
57 int saved_errno = errno;
58
59 - result = INLINE_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n));
60 + result = INLINE_SETXID_SYSCALL (setgroups32, 2, n,
61 + CHECK_N (groups, n));
62 if (result == 0 || errno != ENOSYS)
63 return result;
64
65 @@ -80,7 +82,8 @@ setgroups (size_t n, const gid_t *groups
66 }
67 }
68
69 - return INLINE_SYSCALL (setgroups, 2, n, CHECK_N (kernel_groups, n));
70 + return INLINE_SETXID_SYSCALL (setgroups, 2, n,
71 + CHECK_N (kernel_groups, n));
72 }
73 #endif
74 }
75 Index: glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
76 ===================================================================
77 --- /dev/null
78 +++ glibc-2.12-2-gc4ccff1/sysdeps/unix/sysv/linux/setgroups.c
79 @@ -0,0 +1,37 @@
80 +/* Copyright (C) 1997,1998,2000,2002,2004,2006,2011
81 + Free Software Foundation, Inc.
82 + This file is part of the GNU C Library.
83 +
84 + The GNU C Library is free software; you can redistribute it and/or
85 + modify it under the terms of the GNU Lesser General Public
86 + License as published by the Free Software Foundation; either
87 + version 2.1 of the License, or (at your option) any later version.
88 +
89 + The GNU C Library is distributed in the hope that it will be useful,
90 + but WITHOUT ANY WARRANTY; without even the implied warranty of
91 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
92 + Lesser General Public License for more details.
93 +
94 + You should have received a copy of the GNU Lesser General Public
95 + License along with the GNU C Library; if not, write to the Free
96 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
97 + 02111-1307 USA. */
98 +
99 +#include <errno.h>
100 +#include <grp.h>
101 +#include <setxid.h>
102 +#include <sysdep.h>
103 +
104 +
105 +/* Set the group set for the current user to GROUPS (N of them). For
106 + Linux we must convert the array of groups into the format that the
107 + kernel expects. */
108 +int
109 +setgroups (size_t n, const gid_t *groups)
110 +{
111 +#ifdef __NR_setgroups32
112 +# error "wrong setgroups.c file used"
113 +#endif
114 + return INLINE_SETXID_SYSCALL (setgroups, 2, n, groups);
115 +}
116 +libc_hidden_def (setgroups)