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

Issue 676873004: Intercept file Open/Close (Closed)

Created:
6 years, 1 month ago by pasko
Modified:
6 years, 1 month ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, erikwright+watch_chromium.org, gavinp+disk_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Intercept base::File Open/Close When a file descriptor is opened by the base::File, all calls to close(3) from the same dynamic library will hit a CHECK unless they are made from a whitelist of callsites belonging to base::File. There is a handy protect_file_posix.gypi introduced to make it easy to enable on Chrome-for-Android. This 'linker magic' is somewhat crazy, so: 1. it will be *removed *when crbug.com/424562 is fixed 2. it should only be used by a whitelist of binaries/libraries (in the opensource part: libchromeshell only) BUG=424562 Committed: https://crrev.com/45a0dc0b75b52e026eb15526ef441edc5dbe9ba5 Cr-Commit-Position: refs/heads/master@{#304592}

Patch Set 1 #

Patch Set 2 : Moved the logic to file_posix.cc, need some magic in GYP yet #

Patch Set 3 : with moar GYP magic #

Patch Set 4 : disable linker magic for component build #

Total comments: 24

Patch Set 5 : addressed most comments #

Patch Set 6 : More careful protection in constructors #

Patch Set 7 : Added base/files/file_posix_hooks_internal.h #

Patch Set 8 : gn #

Total comments: 5

Patch Set 9 : nits #

Patch Set 10 : Add more TODOs for removal. #

Patch Set 11 : . #

Patch Set 12 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+225 lines, -1 line) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M base/base.gyp View 1 2 3 4 5 6 7 8 9 1 chunk +12 lines, -0 lines 0 comments Download
M base/files/file.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +10 lines, -0 lines 0 comments Download
M base/files/file_posix.cc View 1 2 3 4 5 6 chunks +16 lines, -1 line 0 comments Download
A base/files/file_posix_hooks_internal.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +31 lines, -0 lines 0 comments Download
A base/files/protect_file_posix.cc View 1 2 3 4 5 6 7 8 9 1 chunk +106 lines, -0 lines 0 comments Download
A base/files/protect_file_posix.gypi View 1 2 3 4 5 6 7 8 1 chunk +31 lines, -0 lines 0 comments Download
M chrome/android/BUILD.gn View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
M chrome/chrome_shell.gypi View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (7 generated)
gavinp
Alternative architecture idea: interpose on close as you do in this CL, and save the ...
6 years, 1 month ago (2014-10-30 18:40:03 UTC) #2
gavinp
On 2014/10/30 18:40:03, gavinp wrote: > Alternative architecture idea: interpose on close as you do ...
6 years, 1 month ago (2014-10-31 12:05:43 UTC) #3
pasko
On 2014/10/31 12:05:43, gavinp wrote: > On 2014/10/30 18:40:03, gavinp wrote: > > Alternative architecture ...
6 years, 1 month ago (2014-10-31 13:33:15 UTC) #4
pasko
fdegans: can you please do a first pass sanity check? Especially for GYP. In the ...
6 years, 1 month ago (2014-11-04 14:34:21 UTC) #5
pasko
fdegans: can you please do a first pass sanity check? Especially for GYP. In the ...
6 years, 1 month ago (2014-11-04 14:34:56 UTC) #7
gavinp
This is really good. Awesome! Do you think this deserves a unit test? It will ...
6 years, 1 month ago (2014-11-04 15:02:02 UTC) #8
Fabrice (no longer in Chrome)
If this is only for Android shared library targets, you can disregard my comments. https://codereview.chromium.org/676873004/diff/60001/base/files/file_posix.cc ...
6 years, 1 month ago (2014-11-04 15:37:22 UTC) #9
pasko
gavinp, fdegans: thanks for review. I addressed all your comments, PTAL. A few more things ...
6 years, 1 month ago (2014-11-04 17:48:06 UTC) #10
gavinp
This looks pretty good to me. I do wonder if a lot of the code ...
6 years, 1 month ago (2014-11-04 18:34:14 UTC) #11
pasko
OK, debugging revealed that I did not properly Protect in constructors, where it is necessary. ...
6 years, 1 month ago (2014-11-05 19:37:29 UTC) #12
pasko
On 2014/11/05 19:37:29, pasko wrote: > OK, debugging revealed that I did not properly Protect ...
6 years, 1 month ago (2014-11-06 16:55:04 UTC) #13
gavinp
This lgtm, assuming you write the GN and get good try results using it. I ...
6 years, 1 month ago (2014-11-06 17:48:30 UTC) #14
pasko
+owners thakis: base brettw: GN This is a really crazy attempt to catch abuses of ...
6 years, 1 month ago (2014-11-07 18:00:42 UTC) #17
gavinp
It seems that death tests do run on Android. See http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/26166/steps/base_unittests/logs/stdio . FileTest.MemoryCorruption is only ...
6 years, 1 month ago (2014-11-10 19:24:13 UTC) #18
pasko
On 2014/11/10 19:24:13, gavinp wrote: > It seems that death tests do run on Android. ...
6 years, 1 month ago (2014-11-12 12:30:12 UTC) #19
Fabrice (no longer in Chrome)
Just a few nits on the gyp, other than that gyp lgtm if the bots ...
6 years, 1 month ago (2014-11-17 16:10:54 UTC) #20
pasko
https://codereview.chromium.org/676873004/diff/140001/base/base.gyp File base/base.gyp (right): https://codereview.chromium.org/676873004/diff/140001/base/base.gyp#newcode380 base/base.gyp:380: 'target_name': 'protect_file_posix', On 2014/11/17 16:10:54, Fabrice wrote: > Nit: ...
6 years, 1 month ago (2014-11-17 16:25:57 UTC) #21
Nico
Please make it clear in both commit message and patch that this is temporary code ...
6 years, 1 month ago (2014-11-17 23:55:02 UTC) #22
pasko
On 2014/11/17 23:55:02, Nico wrote: > Please make it clear in both commit message and ...
6 years, 1 month ago (2014-11-18 11:04:30 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/676873004/200001
6 years, 1 month ago (2014-11-18 11:05:24 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: win_gpu on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/win_gpu/builds/87710)
6 years, 1 month ago (2014-11-18 11:36:54 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/676873004/220001
6 years, 1 month ago (2014-11-18 12:52:03 UTC) #29
commit-bot: I haz the power
Committed patchset #12 (id:220001)
6 years, 1 month ago (2014-11-18 13:31:44 UTC) #30
commit-bot: I haz the power
6 years, 1 month ago (2014-11-18 13:32:33 UTC) #31
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/45a0dc0b75b52e026eb15526ef441edc5dbe9ba5
Cr-Commit-Position: refs/heads/master@{#304592}

Powered by Google App Engine
This is Rietveld 408576698