|
|
Chromium Code Reviews|
Created:
3 years, 6 months ago by Greg K Modified:
3 years, 6 months ago Reviewers:
Robert Sesek CC:
chromium-reviews, mac-reviews_chromium.org Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionAdd IsSandboxed() function to seatbelt wrapper.
This adds a function that checks whether or not the process is currently
sandboxed. It uses the underlying sandbox_check() functionality,
which is not yet further exposed.
BUG=689306
Review-Url: https://codereview.chromium.org/2914693002
Cr-Commit-Position: refs/heads/master@{#476370}
Committed: https://chromium.googlesource.com/chromium/src/+/60afdae0e313e3af409e9c13776520525f34c0bc
Patch Set 1 #
Total comments: 7
Patch Set 2 : Switch to IsSandboxed() #Patch Set 3 : Improve function documentation #
Messages
Total messages: 30 (19 generated)
The CQ bit was checked by kerrnel@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
kerrnel@chromium.org changed reviewers: + rsesek@chromium.org
PTAL. Thanks, Greg
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:16: enum sandbox_filter_type { Why is this extern C? I don't see this in /usr/include. This could instead be: enum class SandboxFilter { NONE, PATH, GLOBAL_NAME, … }; https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, Rather than exposing this as a C function, let's wrap it via a Seatbelt static method.
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, On 2017/05/31 17:31:08, Robert Sesek wrote: > Rather than exposing this as a C function, let's wrap it via a Seatbelt static > method. I wanted to do this, but I'm not sure how to pass along the "..." to the C function. I can convert the `...` to a va_list, but I'm not aware of a version of sandbox_check() that consumes a va_list. Are they the same thing?
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, On 2017/05/31 17:36:25, Greg K wrote: > On 2017/05/31 17:31:08, Robert Sesek wrote: > > Rather than exposing this as a C function, let's wrap it via a Seatbelt static > > method. > > I wanted to do this, but I'm not sure how to pass along the "..." to the C > function. I can convert the `...` to a va_list, but I'm not aware of a version > of sandbox_check() that consumes a va_list. Are they the same thing? Argh yeah the varargs is frustrating. Unless there were a variant that takes a va_list (I don't see one...) you can't forward a varargs function. Do you intend to use the varargs, because if not, then the Seatbelt method could simply not take it. If you do, you could also overload it with non-varargs arguments, e.g.: Seatbelt::Check(pid_t, const char* op, SandboxFilter) Seatbelt::Check(pid_t, const char* op, SandboxFilter, const char* right)
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, On 2017/05/31 18:09:58, Robert Sesek wrote: > On 2017/05/31 17:36:25, Greg K wrote: > > On 2017/05/31 17:31:08, Robert Sesek wrote: > > > Rather than exposing this as a C function, let's wrap it via a Seatbelt > static > > > method. > > > > I wanted to do this, but I'm not sure how to pass along the "..." to the C > > function. I can convert the `...` to a va_list, but I'm not aware of a version > > of sandbox_check() that consumes a va_list. Are they the same thing? > > Argh yeah the varargs is frustrating. Unless there were a variant that takes a > va_list (I don't see one...) you can't forward a varargs function. Do you intend > to use the varargs, because if not, then the Seatbelt method could simply not > take it. If you do, you could also overload it with non-varargs arguments, e.g.: > > Seatbelt::Check(pid_t, const char* op, SandboxFilter) > Seatbelt::Check(pid_t, const char* op, SandboxFilter, const char* right) Right now I only plan to use it to check if it's sandboxed. Maybe I should just add Seatbelt::IsSandboxed() and expose the generic function later if appropriate.
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, On 2017/05/31 18:14:37, Greg K wrote: > On 2017/05/31 18:09:58, Robert Sesek wrote: > > On 2017/05/31 17:36:25, Greg K wrote: > > > On 2017/05/31 17:31:08, Robert Sesek wrote: > > > > Rather than exposing this as a C function, let's wrap it via a Seatbelt > > static > > > > method. > > > > > > I wanted to do this, but I'm not sure how to pass along the "..." to the C > > > function. I can convert the `...` to a va_list, but I'm not aware of a > version > > > of sandbox_check() that consumes a va_list. Are they the same thing? > > > > Argh yeah the varargs is frustrating. Unless there were a variant that takes a > > va_list (I don't see one...) you can't forward a varargs function. Do you > intend > > to use the varargs, because if not, then the Seatbelt method could simply not > > take it. If you do, you could also overload it with non-varargs arguments, > e.g.: > > > > Seatbelt::Check(pid_t, const char* op, SandboxFilter) > > Seatbelt::Check(pid_t, const char* op, SandboxFilter, const char* right) > > Right now I only plan to use it to check if it's sandboxed. Maybe I should just > add Seatbelt::IsSandboxed() and expose the generic function later if > appropriate. That sounds good. Keeping APIs minimal is always the right call.
The CQ bit was checked by kerrnel@chromium.org to run a CQ dry run
The CQ bit was checked by kerrnel@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Description was changed from ========== Add sandbox_check function to seatbelt wrapper. Adds the sandbox_check function to the seatbelt wrapper files. BUG=689306 ========== to ========== Add IsSandboxed() function to seatbelt wrapper. This adds a function that checks whether or not the process is currently sandboxed. It uses the underlying sandbox_check() functionality, which is not yet further exposed. BUG=689306 ==========
Description was changed from ========== Add IsSandboxed() function to seatbelt wrapper. This adds a function that checks whether or not the process is currently sandboxed. It uses the underlying sandbox_check() functionality, which is not yet further exposed. BUG=689306 ========== to ========== Add IsSandboxed() function to seatbelt wrapper. This adds a function that checks whether or not the process is currently sandboxed. It uses the underlying sandbox_check() functionality, which is not yet further exposed. BUG=689306 ==========
The CQ bit was checked by kerrnel@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2017/05/31 18:19:08, Robert Sesek wrote: > https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h > File sandbox/mac/seatbelt.h (right): > > https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... > sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, > On 2017/05/31 18:14:37, Greg K wrote: > > On 2017/05/31 18:09:58, Robert Sesek wrote: > > > On 2017/05/31 17:36:25, Greg K wrote: > > > > On 2017/05/31 17:31:08, Robert Sesek wrote: > > > > > Rather than exposing this as a C function, let's wrap it via a Seatbelt > > > static > > > > > method. > > > > > > > > I wanted to do this, but I'm not sure how to pass along the "..." to the C > > > > function. I can convert the `...` to a va_list, but I'm not aware of a > > version > > > > of sandbox_check() that consumes a va_list. Are they the same thing? > > > > > > Argh yeah the varargs is frustrating. Unless there were a variant that takes > a > > > va_list (I don't see one...) you can't forward a varargs function. Do you > > intend > > > to use the varargs, because if not, then the Seatbelt method could simply > not > > > take it. If you do, you could also overload it with non-varargs arguments, > > e.g.: > > > > > > Seatbelt::Check(pid_t, const char* op, SandboxFilter) > > > Seatbelt::Check(pid_t, const char* op, SandboxFilter, const char* right) > > > > Right now I only plan to use it to check if it's sandboxed. Maybe I should > just > > add Seatbelt::IsSandboxed() and expose the generic function later if > > appropriate. > > That sounds good. Keeping APIs minimal is always the right call. PTAL. I switched to IsSandboxed() and noticed that there was no documentation for the class methods.
LGTM
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by kerrnel@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h File sandbox/mac/seatbelt.h (right): https://codereview.chromium.org/2914693002/diff/1/sandbox/mac/seatbelt.h#newc... sandbox/mac/seatbelt.h:35: int sandbox_check(pid_t pid, On 2017/05/31 18:19:08, Robert Sesek wrote: > On 2017/05/31 18:14:37, Greg K wrote: > > On 2017/05/31 18:09:58, Robert Sesek wrote: > > > On 2017/05/31 17:36:25, Greg K wrote: > > > > On 2017/05/31 17:31:08, Robert Sesek wrote: > > > > > Rather than exposing this as a C function, let's wrap it via a Seatbelt > > > static > > > > > method. > > > > > > > > I wanted to do this, but I'm not sure how to pass along the "..." to the C > > > > function. I can convert the `...` to a va_list, but I'm not aware of a > > version > > > > of sandbox_check() that consumes a va_list. Are they the same thing? > > > > > > Argh yeah the varargs is frustrating. Unless there were a variant that takes > a > > > va_list (I don't see one...) you can't forward a varargs function. Do you > > intend > > > to use the varargs, because if not, then the Seatbelt method could simply > not > > > take it. If you do, you could also overload it with non-varargs arguments, > > e.g.: > > > > > > Seatbelt::Check(pid_t, const char* op, SandboxFilter) > > > Seatbelt::Check(pid_t, const char* op, SandboxFilter, const char* right) > > > > Right now I only plan to use it to check if it's sandboxed. Maybe I should > just > > add Seatbelt::IsSandboxed() and expose the generic function later if > > appropriate. > > That sounds good. Keeping APIs minimal is always the right call. Done.
CQ is committing da patch.
Bot data: {"patchset_id": 40001, "attempt_start_ts": 1496342394238920,
"parent_rev": "04b5424ac2e113a8ddbd18584b0e86a3a03299ae", "commit_rev":
"60afdae0e313e3af409e9c13776520525f34c0bc"}
Message was sent while issue was closed.
Description was changed from ========== Add IsSandboxed() function to seatbelt wrapper. This adds a function that checks whether or not the process is currently sandboxed. It uses the underlying sandbox_check() functionality, which is not yet further exposed. BUG=689306 ========== to ========== Add IsSandboxed() function to seatbelt wrapper. This adds a function that checks whether or not the process is currently sandboxed. It uses the underlying sandbox_check() functionality, which is not yet further exposed. BUG=689306 Review-Url: https://codereview.chromium.org/2914693002 Cr-Commit-Position: refs/heads/master@{#476370} Committed: https://chromium.googlesource.com/chromium/src/+/60afdae0e313e3af409e9c137765... ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/60afdae0e313e3af409e9c137765... |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
