Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: sandbox/linux/system_headers/capability.h

Issue 997463002: Add SetCapabilities for setting capabilities to an exact set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_
6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_
7
8 #include <stdint.h>
9
10 // The following macros are taken from linux/capability.h.
11 // We only support capability version 3, which was introduced in Linux 2.6.26.
12 #ifndef _LINUX_CAPABILITY_VERSION_3
13 #define _LINUX_CAPABILITY_VERSION_3 0x20080522
14 #endif
15 #ifndef _LINUX_CAPABILITY_U32S_3
16 #define _LINUX_CAPABILITY_U32S_3 2
jln (very slow on Chromium) 2015/03/12 19:24:15 Did you figure out what the comment "Backwardly c
rickyz (no longer on Chrome) 2015/03/12 23:36:02 http://git.kernel.org/cgit/linux/kernel/git/torval
17 #endif
18 #ifndef CAP_TO_INDEX
19 #define CAP_TO_INDEX(x) ((x) >> 5) // 1 << 5 == bits in __u32
20 #endif
21 #ifndef CAP_TO_MASK
22 #define CAP_TO_MASK(x) (1 << ((x) & 31)) // mask for indexed __u32
23 #endif
24 #ifndef CAP_SYS_ADMIN
25 #define CAP_SYS_ADMIN 21
26 #endif
27 #ifndef CAP_SYS_CHROOT
28 #define CAP_SYS_CHROOT 18
29 #endif
30 #ifndef CAP_LAST_CAP
31 #define CAP_LAST_CAP 36
32 #endif
33
34 struct cap_hdr {
35 cap_hdr() : version(0), pid(0) {}
36 uint32_t version;
37 int pid;
38 };
39
40 struct cap_data {
jln (very slow on Chromium) 2015/03/12 19:24:15 I'm pretty sure this should be fine, but I'm sligh
mdempsky 2015/03/12 20:43:42 Another worry is if we write code assuming that ca
rickyz (no longer on Chrome) 2015/03/12 23:36:02 That's a good point - switched to explicitly zeroi
41 cap_data() : effective(0), permitted(0), inheritable(0) {}
42 uint32_t effective;
43 uint32_t permitted;
44 uint32_t inheritable;
45 };
46
47 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_
OLDNEW
« sandbox/linux/services/syscall_wrappers.h ('K') | « sandbox/linux/services/syscall_wrappers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698