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

Issue 997463002: Add SetCapabilities for setting capabilities to an exact set. (Closed)

Created:
5 years, 9 months ago by rickyz (no longer on Chrome)
Modified:
5 years, 9 months ago
CC:
chromium-reviews, rickyz+watch_chromium.org, jln+watch_chromium.org, Mark Seaborn
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove sys/capability.h dependency from credentials.cc. Also adds SetCapabilities and HasCapability functions for more fine-grained control over capabilities. BUG= Committed: https://crrev.com/966f039d6f3ae4374045bddd1fbb2c0b3b8a6a9a Cr-Commit-Position: refs/heads/master@{#320878}

Patch Set 1 #

Total comments: 12

Patch Set 2 : Respond to comments. #

Total comments: 4

Patch Set 3 : Respond to comments. #

Total comments: 1

Patch Set 4 : Get rid of sys/capability.h dependency. #

Total comments: 4

Patch Set 5 : Respond to comments. #

Total comments: 19

Patch Set 6 : Respond to more comments. #

Total comments: 6

Patch Set 7 : Don't expose capability constants. #

Patch Set 8 : Update BUILD.gn. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+243 lines, -66 lines) Patch
M chrome/installer/linux/debian/expected_deps_ia32 View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M chrome/installer/linux/debian/expected_deps_x64 View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M chrome/installer/linux/rpm/expected_deps_i386 View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M chrome/installer/linux/rpm/expected_deps_x86_64 View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M sandbox/linux/BUILD.gn View 1 2 3 4 5 6 7 3 chunks +8 lines, -6 lines 0 comments Download
M sandbox/linux/sandbox_linux.gypi View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M sandbox/linux/sandbox_linux_test_sources.gypi View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M sandbox/linux/services/credentials.h View 1 2 3 4 5 6 2 chunks +20 lines, -6 lines 0 comments Download
M sandbox/linux/services/credentials.cc View 1 2 3 4 5 6 5 chunks +71 lines, -42 lines 0 comments Download
M sandbox/linux/services/credentials_unittest.cc View 1 2 3 4 5 6 4 chunks +79 lines, -6 lines 0 comments Download
M sandbox/linux/services/syscall_wrappers.h View 1 2 3 4 5 2 chunks +9 lines, -0 lines 0 comments Download
M sandbox/linux/services/syscall_wrappers.cc View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
A sandbox/linux/system_headers/capability.h View 1 2 3 4 5 6 1 chunk +42 lines, -0 lines 0 comments Download

Messages

Total messages: 48 (15 generated)
rickyz (no longer on Chrome)
Sorry for the delay here - I ended up agonizing a bit over whether to ...
5 years, 9 months ago (2015-03-10 06:33:59 UTC) #2
jln (very slow on Chromium)
Thanks Ricky! It would be nice to hide low-level libcap stuff, as I do think ...
5 years, 9 months ago (2015-03-10 17:03:35 UTC) #3
rickyz (no longer on Chrome)
https://codereview.chromium.org/997463002/diff/1/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://codereview.chromium.org/997463002/diff/1/sandbox/linux/services/credentials.cc#newcode159 sandbox/linux/services/credentials.cc:159: DCHECK_LE(0, proc_fd); On 2015/03/10 17:03:34, jln wrote: > if ...
5 years, 9 months ago (2015-03-10 20:22:14 UTC) #4
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/997463002/diff/1/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://chromiumcodereview.appspot.com/997463002/diff/1/sandbox/linux/services/credentials.cc#newcode164 sandbox/linux/services/credentials.cc:164: cap_flag_t flags[] = {CAP_EFFECTIVE, CAP_PERMITTED}; On 2015/03/10 20:22:13, rickyz ...
5 years, 9 months ago (2015-03-10 22:12:12 UTC) #5
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/997463002/diff/20001/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://chromiumcodereview.appspot.com/997463002/diff/20001/sandbox/linux/services/credentials.cc#newcode145 sandbox/linux/services/credentials.cc:145: PCHECK(0 == cap_set_proc(cap.get())); We should probably just call Credentials::SetCapabilities(proc_fd, ...
5 years, 9 months ago (2015-03-10 22:14:22 UTC) #6
jln (very slow on Chromium)
https://chromiumcodereview.appspot.com/997463002/diff/1/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://chromiumcodereview.appspot.com/997463002/diff/1/sandbox/linux/services/credentials.cc#newcode164 sandbox/linux/services/credentials.cc:164: cap_flag_t flags[] = {CAP_EFFECTIVE, CAP_PERMITTED}; On 2015/03/10 22:12:11, jln ...
5 years, 9 months ago (2015-03-10 22:18:40 UTC) #7
rickyz (no longer on Chrome)
https://codereview.chromium.org/997463002/diff/1/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://codereview.chromium.org/997463002/diff/1/sandbox/linux/services/credentials.cc#newcode164 sandbox/linux/services/credentials.cc:164: cap_flag_t flags[] = {CAP_EFFECTIVE, CAP_PERMITTED}; On 2015/03/10 22:18:40, jln ...
5 years, 9 months ago (2015-03-10 22:22:14 UTC) #8
jln (very slow on Chromium)
lgtm https://chromiumcodereview.appspot.com/997463002/diff/40001/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://chromiumcodereview.appspot.com/997463002/diff/40001/sandbox/linux/services/credentials.cc#newcode137 sandbox/linux/services/credentials.cc:137: return false; n.b. We used to never let ...
5 years, 9 months ago (2015-03-10 22:32:29 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/997463002/40001
5 years, 9 months ago (2015-03-10 22:36:17 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/997463002/40001
5 years, 9 months ago (2015-03-10 22:40:52 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/34620)
5 years, 9 months ago (2015-03-10 23:41:24 UTC) #16
jln (very slow on Chromium)
Arg, is this a newlib issue? :(
5 years, 9 months ago (2015-03-11 00:03:29 UTC) #17
mdempsky
On 2015/03/11 00:03:29, jln wrote: > Arg, is this a newlib issue? :( Looks like ...
5 years, 9 months ago (2015-03-11 00:06:57 UTC) #18
mdempsky
On 2015/03/11 00:06:57, mdempsky wrote: > On 2015/03/11 00:03:29, jln wrote: > > Arg, is ...
5 years, 9 months ago (2015-03-11 00:08:08 UTC) #19
hidehiko
On 2015/03/11 00:08:08, mdempsky wrote: > On 2015/03/11 00:06:57, mdempsky wrote: > > On 2015/03/11 ...
5 years, 9 months ago (2015-03-11 17:14:29 UTC) #20
rickyz (no longer on Chrome)
On 2015/03/11 17:14:29, hidehiko wrote: > On 2015/03/11 00:08:08, mdempsky wrote: > > On 2015/03/11 ...
5 years, 9 months ago (2015-03-11 20:01:42 UTC) #21
rickyz (no longer on Chrome)
I made the switch to using the capget/set syscalls directly as discussed, but be warned, ...
5 years, 9 months ago (2015-03-11 23:24:56 UTC) #25
jln (very slow on Chromium)
Thanks for doing this Ricky! I'll take a look very soon, but after skimming, this ...
5 years, 9 months ago (2015-03-12 00:10:47 UTC) #26
rickyz (no longer on Chrome)
https://codereview.chromium.org/997463002/diff/120001/sandbox/linux/services/syscall_wrappers.h File sandbox/linux/services/syscall_wrappers.h (right): https://codereview.chromium.org/997463002/diff/120001/sandbox/linux/services/syscall_wrappers.h#newcode53 sandbox/linux/services/syscall_wrappers.h:53: #ifndef _LINUX_CAPABILITY_VERSION_3 On 2015/03/12 00:10:47, jln wrote: > How ...
5 years, 9 months ago (2015-03-12 01:38:42 UTC) #27
jln (very slow on Chromium)
Looks good in general, but it makes me a bit nervous. - Maybe at least ...
5 years, 9 months ago (2015-03-12 19:24:15 UTC) #28
mdempsky
https://chromiumcodereview.appspot.com/997463002/diff/140001/sandbox/linux/system_headers/capability.h File sandbox/linux/system_headers/capability.h (right): https://chromiumcodereview.appspot.com/997463002/diff/140001/sandbox/linux/system_headers/capability.h#newcode40 sandbox/linux/system_headers/capability.h:40: struct cap_data { On 2015/03/12 19:24:15, jln wrote: > ...
5 years, 9 months ago (2015-03-12 20:43:42 UTC) #30
jln (very slow on Chromium)
https://codereview.chromium.org/997463002/diff/140001/sandbox/linux/services/credentials.h File sandbox/linux/services/credentials.h (right): https://codereview.chromium.org/997463002/diff/140001/sandbox/linux/services/credentials.h#newcode40 sandbox/linux/services/credentials.h:40: static bool SetCapabilities(int proc_fd, const std::vector<int>& caps) Would it ...
5 years, 9 months ago (2015-03-12 20:46:30 UTC) #31
rickyz (no longer on Chrome)
https://codereview.chromium.org/997463002/diff/140001/sandbox/linux/services/credentials.cc File sandbox/linux/services/credentials.cc (right): https://codereview.chromium.org/997463002/diff/140001/sandbox/linux/services/credentials.cc#newcode142 sandbox/linux/services/credentials.cc:142: cap_data data[_LINUX_CAPABILITY_U32S_3]; On 2015/03/12 19:24:15, jln wrote: > Even ...
5 years, 9 months ago (2015-03-12 23:36:02 UTC) #32
jln (very slow on Chromium)
lgtm I would prefer if we could completely separate our LinuxCapability values from the actual ...
5 years, 9 months ago (2015-03-16 21:38:10 UTC) #33
rickyz (no longer on Chrome)
Thanks, adding thestig@ for chrome/installer/linux expected_deps changes. https://codereview.chromium.org/997463002/diff/160001/sandbox/linux/services/credentials.h File sandbox/linux/services/credentials.h (right): https://codereview.chromium.org/997463002/diff/160001/sandbox/linux/services/credentials.h#newcode28 sandbox/linux/services/credentials.h:28: kCapSysChroot = ...
5 years, 9 months ago (2015-03-16 23:10:13 UTC) #35
Lei Zhang
chrome/installer/linux lgtm
5 years, 9 months ago (2015-03-16 23:15:19 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/997463002/180001
5 years, 9 months ago (2015-03-16 23:17:17 UTC) #39
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_gn_dbg on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_gn_dbg/builds/52878)
5 years, 9 months ago (2015-03-17 02:02:55 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/997463002/200001
5 years, 9 months ago (2015-03-17 05:25:06 UTC) #44
commit-bot: I haz the power
Committed patchset #8 (id:200001)
5 years, 9 months ago (2015-03-17 07:23:53 UTC) #45
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/966f039d6f3ae4374045bddd1fbb2c0b3b8a6a9a Cr-Commit-Position: refs/heads/master@{#320878}
5 years, 9 months ago (2015-03-17 07:24:40 UTC) #46
Ivan Podogov
On 2015/03/17 07:24:40, I haz the power (commit-bot) wrote: > Patchset 8 (id:??) landed as ...
5 years, 9 months ago (2015-03-17 09:49:53 UTC) #47
rickyz (no longer on Chrome)
5 years, 9 months ago (2015-03-17 09:51:48 UTC) #48
Message was sent while issue was closed.
On 2015/03/17 09:49:53, Ivan Podogov wrote:
> On 2015/03/17 07:24:40, I haz the power (commit-bot) wrote:
> > Patchset 8 (id:??) landed as
> > https://crrev.com/966f039d6f3ae4374045bddd1fbb2c0b3b8a6a9a
> > Cr-Commit-Position: refs/heads/master@{#320878}
> 
> This breaks device build.
> 
> ../../sandbox/linux/services/credentials.cc: In function 'int
> sandbox::{anonymous}::LinuxCapabilityToKernelValue(sandbox::LinuxCapability)':
> ../../sandbox/linux/services/credentials.cc:123:1: error: control reaches end
of
> non-void function [-Werror=return-type]
>  }
>  ^

Strange, is the compiler not aware that the LOG(FATAL) line does not return?
I'll send a change to add a return under this. Out of curiosity, is there a
trybot that would have caught this issue before the CL landed?

Powered by Google App Engine
This is Rietveld 408576698