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

Issue 159025: Linux sandbox: save full list of SUID unsafe environment variables. (Closed)

Created:
11 years, 5 months ago by agl
Modified:
9 years, 7 months ago
Reviewers:
Evan Martin, fta
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Linux sandbox: save full list of SUID unsafe environment variables. r20733 added code to save LD_LIBRARY_PATH when using the SUID sandbox. That fixed a P0, show-stopper bug, however, LD_LIBRARY_PATH isn't the only variable which is stomped when using SUID binaries. This patch extends support to all variables that we so affected. BUG=16815

Patch Set 1 #

Patch Set 2 : ... #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -13 lines) Patch
M chrome/browser/zygote_host_linux.cc View 2 chunks +24 lines, -6 lines 2 comments Download
M sandbox/linux/suid/sandbox.cc View 1 2 chunks +19 lines, -7 lines 2 comments Download
A sandbox/linux/suid/suid_unsafe_environment_variables.h View 1 chunk +59 lines, -0 lines 2 comments Download
M sandbox/sandbox.gyp View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
agl
11 years, 5 months ago (2009-07-17 20:48:38 UTC) #1
fta
what about GTK_PATH? it's used as a workaround on x64 for gtk2 unable to load ...
11 years, 5 months ago (2009-07-17 20:58:15 UTC) #2
Evan Martin
fta: we pass through all variables implicitly since they inherit the parent process's environment. This ...
11 years, 5 months ago (2009-07-17 21:10:57 UTC) #3
agl
11 years, 5 months ago (2009-07-17 21:35:09 UTC) #4
http://codereview.chromium.org/159025/diff/6/1005
File chrome/browser/zygote_host_linux.cc (right):

http://codereview.chromium.org/159025/diff/6/1005#newcode42
Line 42: unsetenv(saved_envvar);
On 2009/07/17 21:10:57, Evan Martin wrote:
> I wonder if we should unsetenv() all existing SANDBOX_FOO here so that any
extra
> ones from the env don't get used by the child.  Maybe that's excessive.

We already control all the SANDBOX_ values: either we set them ourselves or we
clear them.

http://codereview.chromium.org/159025/diff/6/1006
File sandbox/linux/suid/sandbox.cc (right):

http://codereview.chromium.org/159025/diff/6/1006#newcode233
Line 233: // ld.so may have cleared several environment variable because we are
SUID.
On 2009/07/17 21:10:57, Evan Martin wrote:
> variable*s*

Done.

http://codereview.chromium.org/159025/diff/6/1007
File sandbox/linux/suid/suid_unsafe_environment_variables.h (right):

http://codereview.chromium.org/159025/diff/6/1007#newcode49
Line 49: 8 /* strlen("SANDBOX_") */;
On 2009/07/17 21:10:57, Evan Martin wrote:
> This seems like a ton of effort to go through.  Why not just
>   return std::string("SANDBOX_") + envvar;
> 
> Eliminates manual memory management on the callee side oto.

I'm currently sticking to the idea that the sandbox is pure-C99 code (although
we do compile as C++ because our build system is setup that way).

Powered by Google App Engine
This is Rietveld 408576698