History

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace

Pull namespace updates from Eric Biederman: "Life has been busy and I have not gotten half as much done this round as I would have liked. I delayed it so that a minor conflict resolution with the mips tree could spend a little time in linux-next before I sent this pull request. This includes two long delayed user namespace changes from Kirill Tkhai. It also includes a very useful change from Serge Hallyn that allows the security capability attribute to be used inside of user namespaces. The practical effect of this is people can now untar tarballs and install rpms in user namespaces. It had been suggested to generalize this and encode some of the namespace information information in the xattr name. Upon close inspection that makes the things that should be hard easy and the things that should be easy more expensive. Then there is my bugfix/cleanup for signal injection that removes the magic encoding of the siginfo union member from the kernel internal si_code. The mips folks reported the case where I had used FPE_FIXME me is impossible so I have remove FPE_FIXME from mips, while at the same time including a return statement in that case to keep gcc from complaining about unitialized variables. I almost finished the work to get make copy_siginfo_to_user a trivial copy to user. The code is available at: git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git neuter-copy_siginfo_to_user-v3 But I did not have time/energy to get the code posted and reviewed before the merge window opened. I was able to see that the security excuse for just copying fields that we know are initialized doesn't work in practice there are buggy initializations that don't initialize the proper fields in siginfo. So we still sometimes copy unitialized data to userspace" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: Introduce v3 namespaced file capabilities mips/signal: In force_fcr31_sig return in the impossible case signal: Remove kernel interal si_code magic fcntl: Don't use ambiguous SIG_POLL si_codes prctl: Allow local CAP_SYS_ADMIN changing exe_file security: Use user_namespace::level to avoid redundant iterations in cap_capable() userns,pidns: Verify the userns for new pid namespaces signal/testing: Don't look for __SI_FAULT in userspace signal/mips: Document a conflict with SI_USER with SIGFPE signal/sparc: Document a conflict with SI_USER with SIGFPE signal/ia64: Document a conflict with SI_USER with SIGFPE signal/alpha: Document a conflict with SI_USER for SIGTRAP

Linus Torvalds committed 9 years ago

Commit dd198ce2 parents 89fd915 076a9bc40 files · +622 −297Browse files

Showing the changes to include/uapi (2 of 40 files). Show all

Unified · Split

2 files
  1. include/uapi/asm-generic/siginfo.h +46 −69
  2. include/uapi/linux/capability.h +19 −3
include/uapi/asm-generic/siginfo.h+46−69
@@ -151,29 +151,6 @@ typedef struct siginfo { · 150 unmodified lines
151151 #define si_arch _sifields._sigsys._arch
152152 #endif
153153
154−#ifdef __KERNEL__
155−#define __SI_MASK 0xffff0000u
156−#define __SI_KILL (0 << 16)
157−#define __SI_TIMER (1 << 16)
158−#define __SI_POLL (2 << 16)
159−#define __SI_FAULT (3 << 16)
160−#define __SI_CHLD (4 << 16)
161−#define __SI_RT (5 << 16)
162−#define __SI_MESGQ (6 << 16)
163−#define __SI_SYS (7 << 16)
164−#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
165−#else /* __KERNEL__ */
166−#define __SI_KILL 0
167−#define __SI_TIMER 0
168−#define __SI_POLL 0
169−#define __SI_FAULT 0
170−#define __SI_CHLD 0
171−#define __SI_RT 0
172−#define __SI_MESGQ 0
173−#define __SI_SYS 0
174−#define __SI_CODE(T,N) (N)
175−#endif /* __KERNEL__ */
176−
177154 /*
178155 * si_code values
179156 * Digital reserves positive values for kernel-generated signals.
@@ -181,8 +158,8 @@ typedef struct siginfo { · 1 unmodified line
181158 #define SI_USER 0 /* sent by kill, sigsend, raise */
182159 #define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
183160 #define SI_QUEUE -1 /* sent by sigqueue */
184−#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
185−#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
161+#define SI_TIMER -2 /* sent by timer expiration */
162+#define SI_MESGQ -3 /* sent by real time mesq state change */
186163 #define SI_ASYNCIO -4 /* sent by AIO completion */
187164 #define SI_SIGIO -5 /* sent by queued SIGIO */
188165 #define SI_TKILL -6 /* sent by tkill system call */
@@ -194,86 +171,86 @@ typedef struct siginfo { · 5 unmodified lines
194171 /*
195172 * SIGILL si_codes
196173 */
197−#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
198−#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
199−#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
200−#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
201−#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
202−#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
203−#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
204−#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
174+#define ILL_ILLOPC 1 /* illegal opcode */
175+#define ILL_ILLOPN 2 /* illegal operand */
176+#define ILL_ILLADR 3 /* illegal addressing mode */
177+#define ILL_ILLTRP 4 /* illegal trap */
178+#define ILL_PRVOPC 5 /* privileged opcode */
179+#define ILL_PRVREG 6 /* privileged register */
180+#define ILL_COPROC 7 /* coprocessor error */
181+#define ILL_BADSTK 8 /* internal stack error */
205182 #define NSIGILL 8
206183
207184 /*
208185 * SIGFPE si_codes
209186 */
210−#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
211−#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
212−#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
213−#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
214−#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
215−#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
216−#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
217−#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
187+#define FPE_INTDIV 1 /* integer divide by zero */
188+#define FPE_INTOVF 2 /* integer overflow */
189+#define FPE_FLTDIV 3 /* floating point divide by zero */
190+#define FPE_FLTOVF 4 /* floating point overflow */
191+#define FPE_FLTUND 5 /* floating point underflow */
192+#define FPE_FLTRES 6 /* floating point inexact result */
193+#define FPE_FLTINV 7 /* floating point invalid operation */
194+#define FPE_FLTSUB 8 /* subscript out of range */
218195 #define NSIGFPE 8
219196
220197 /*
221198 * SIGSEGV si_codes
222199 */
223−#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
224−#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
225−#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */
226−#define SEGV_PKUERR (__SI_FAULT|4) /* failed protection key checks */
200+#define SEGV_MAPERR 1 /* address not mapped to object */
201+#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
202+#define SEGV_BNDERR 3 /* failed address bound checks */
203+#define SEGV_PKUERR 4 /* failed protection key checks */
227204 #define NSIGSEGV 4
228205
229206 /*
230207 * SIGBUS si_codes
231208 */
232−#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
233−#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
234−#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
209+#define BUS_ADRALN 1 /* invalid address alignment */
210+#define BUS_ADRERR 2 /* non-existent physical address */
211+#define BUS_OBJERR 3 /* object specific hardware error */
235212 /* hardware memory error consumed on a machine check: action required */
236−#define BUS_MCEERR_AR (__SI_FAULT|4)
213+#define BUS_MCEERR_AR 4
237214 /* hardware memory error detected in process but not consumed: action optional*/
238−#define BUS_MCEERR_AO (__SI_FAULT|5)
215+#define BUS_MCEERR_AO 5
239216 #define NSIGBUS 5
240217
241218 /*
242219 * SIGTRAP si_codes
243220 */
244−#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
245−#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
246−#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
247−#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
221+#define TRAP_BRKPT 1 /* process breakpoint */
222+#define TRAP_TRACE 2 /* process trace trap */
223+#define TRAP_BRANCH 3 /* process taken branch trap */
224+#define TRAP_HWBKPT 4 /* hardware breakpoint/watchpoint */
248225 #define NSIGTRAP 4
249226
250227 /*
251228 * SIGCHLD si_codes
252229 */
253−#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
254−#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
255−#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
256−#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
257−#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
258−#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
230+#define CLD_EXITED 1 /* child has exited */
231+#define CLD_KILLED 2 /* child was killed */
232+#define CLD_DUMPED 3 /* child terminated abnormally */
233+#define CLD_TRAPPED 4 /* traced child has trapped */
234+#define CLD_STOPPED 5 /* child has stopped */
235+#define CLD_CONTINUED 6 /* stopped child has continued */
259236 #define NSIGCHLD 6
260237
261238 /*
262− * SIGPOLL si_codes
239+ * SIGPOLL (or any other signal without signal specific si_codes) si_codes
263240 */
264−#define POLL_IN (__SI_POLL|1) /* data input available */
265−#define POLL_OUT (__SI_POLL|2) /* output buffers available */
266−#define POLL_MSG (__SI_POLL|3) /* input message available */
267−#define POLL_ERR (__SI_POLL|4) /* i/o error */
268−#define POLL_PRI (__SI_POLL|5) /* high priority input available */
269−#define POLL_HUP (__SI_POLL|6) /* device disconnected */
241+#define POLL_IN 1 /* data input available */
242+#define POLL_OUT 2 /* output buffers available */
243+#define POLL_MSG 3 /* input message available */
244+#define POLL_ERR 4 /* i/o error */
245+#define POLL_PRI 5 /* high priority input available */
246+#define POLL_HUP 6 /* device disconnected */
270247 #define NSIGPOLL 6
271248
272249 /*
273250 * SIGSYS si_codes
274251 */
275−#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
276−#define NSIGSYS 1
252+#define SYS_SECCOMP 1 /* seccomp triggered */
253+#define NSIGSYS 1
277254
278255 /*
279256 * sigevent definitions
include/uapi/linux/capability.h+19−3
@@ -60,9 +60,13 @@ typedef struct __user_cap_data_struct { · 59 unmodified lines
6060 #define VFS_CAP_U32_2 2
6161 #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
6262
63−#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
64−#define VFS_CAP_U32 VFS_CAP_U32_2
65−#define VFS_CAP_REVISION VFS_CAP_REVISION_2
63+#define VFS_CAP_REVISION_3 0x03000000
64+#define VFS_CAP_U32_3 2
65+#define XATTR_CAPS_SZ_3 (sizeof(__le32)*(2 + 2*VFS_CAP_U32_3))
66+
67+#define XATTR_CAPS_SZ XATTR_CAPS_SZ_3
68+#define VFS_CAP_U32 VFS_CAP_U32_3
69+#define VFS_CAP_REVISION VFS_CAP_REVISION_3
6670
6771 struct vfs_cap_data {
6872 __le32 magic_etc; /* Little endian */
@@ -72,6 +76,18 @@ struct vfs_cap_data { · 3 unmodified lines
7276 } data[VFS_CAP_U32];
7377 };
7478
79+/*
80+ * same as vfs_cap_data but with a rootid at the end
81+ */
82+struct vfs_ns_cap_data {
83+ __le32 magic_etc;
84+ struct {
85+ __le32 permitted; /* Little endian */
86+ __le32 inheritable; /* Little endian */
87+ } data[VFS_CAP_U32];
88+ __le32 rootid;
89+};
90+
7591 #ifndef __KERNEL__
7692
7793 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t