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

Issue 4044002: Mac: block ability to stat arbitrary files in the Sandbox (Closed)

Created:
10 years, 2 months ago by jeremy
Modified:
9 years, 6 months ago
Reviewers:
Mark Mentovai
CC:
chromium-reviews, darin-cc_chromium.org, brettw-cc_chromium.org, Paweł Hajdan Jr., pam+watch_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

Mac: block ability to stat arbitrary files in the Sandbox. This change removes the ability to stat any file on disk and instead only allows stating files to which we have read access. The complication with removing the ability to stat an arbitrary path is that without extra work you get into a situation where you can stat a leaf directory, but not it's parent. e.g. stat("/foo/bar") succeeds while stat("/foo") fails with errno == EPERM. The only place we currently run into this is the utility process where the file system is off limits except for one directory. This causes problems in 2 places: 1) DirectoryExists() works it's way from / down to the leaf directory stating each directory as it goes. 2) The extension installation code calls realpath() which fails if it can't stat parent directories. The fix for the above is to explictly allow stating parent directories. We achieve this in the sandbox code by adding a function which generates the appropriate sandbox syntax. This CL also contains unit tests for the above functionality and re-enables it [bug 56765, the underlying issue appears to be unrelated to the test and previously fixed]. BUG=42989, 56765 TEST=Chrome should continue to render web pages correctly, installing extensions and themes should continue to work on OS X. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=63884

Patch Set 1 #

Patch Set 2 : extension+theme installs now work + unit tests #

Patch Set 3 : Misc. fixes #

Patch Set 4 : Reenable unit test - underlying issue fixed by Rohit a while back. #

Total comments: 16

Patch Set 5 : Fix review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -43 lines) Patch
M chrome/browser/utility.sb View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/common.sb View 1 2 3 4 1 chunk +4 lines, -6 lines 0 comments Download
M chrome/common/sandbox_mac.mm View 2 3 4 2 chunks +79 lines, -21 lines 0 comments Download
M chrome/common/sandbox_mac_diraccess_unittest.mm View 2 3 4 7 chunks +62 lines, -11 lines 0 comments Download
M chrome/renderer/renderer.sb View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
jeremy
Local testing shows this appears not to break anything major, but I'd like to release ...
10 years, 2 months ago (2010-10-21 15:19:48 UTC) #1
Mark Mentovai
LGTM
10 years, 2 months ago (2010-10-21 15:31:27 UTC) #2
jeremy
Updated, could you take another look?
10 years, 2 months ago (2010-10-25 17:01:46 UTC) #3
Mark Mentovai
http://codereview.chromium.org/4044002/diff/9001/10003 File chrome/common/sandbox_mac.mm (right): http://codereview.chromium.org/4044002/diff/9001/10003#newcode250 chrome/common/sandbox_mac.mm:250: // The main complication in this function is that ...
10 years, 2 months ago (2010-10-25 18:00:20 UTC) #4
jeremy
All fixed, ready for another look. http://codereview.chromium.org/4044002/diff/9001/10003 File chrome/common/sandbox_mac.mm (right): http://codereview.chromium.org/4044002/diff/9001/10003#newcode250 chrome/common/sandbox_mac.mm:250: // The main ...
10 years, 2 months ago (2010-10-25 18:56:35 UTC) #5
Mark Mentovai
10 years, 2 months ago (2010-10-25 20:07:47 UTC) #6
LGTM

Powered by Google App Engine
This is Rietveld 408576698