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

Issue 2061593002: Fix crash when switching to a profile that cannot be opened (Closed)

Created:
4 years, 6 months ago by WC Leung
Modified:
3 years, 10 months ago
CC:
chromium-reviews, rginda+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@bug-614753-fix
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix crash for switching to a profile that cannot be opened When a profile fails to initialize, it was deleted immediately. This was causing use-after-free problems. This CL defers the destruction of such profiles to browser shutdown, which is the same time as other profiles. BUG=620312 R=pkasting@chromium.org R=anthonyvd@chromium.org R=phajdan.jr@chromium.org 1. Use a Windows version of Chromium. 2. Start Chromium with a new user data directory, e.g. chromium --user-data-dir=d:\datadir1 3. Create two extra profiles, so you have "Person 1" and "Person 2". 4. Close the window "Person 2". 5. Then close the window "Person 1". 5. Now remove the directory "Profile 1" in the user data directory. 6. Set the permission of the user data directory to deny creating new directories. (a) Right-click the directory, select "Properties". (b) Click "Advanced" (c) Click "Add" in "Permission" tab. (d) Click "Select a principal", type "EVERYONE" in the box, then press "Okay". (e) In the combo boxes, select "Type: Deny" and "Applies To: This folder only". (f) Select "Show advanced permissions". (g) Uncheck all, then check "Create folders / append data", which is at the lower left corner. (h) Click Ok in the three dialog boxes. 7. Start Chromium again. 8. Right-click on the text "Profile 1". 9. Select "Profile 2". Expected behavior: Before patch - crash. After patch - an dialog box is displayed, and the profile is NOT opened (of course we cannot do it). Anyway, if the text in the dialog box is not useful enough, please report.

Patch Set 1 #

Total comments: 28

Patch Set 2 : Rebase #

Patch Set 3 : Respond to nits, fix tests #

Total comments: 21

Patch Set 4 : WIP, do not commit #

Patch Set 5 : Updated test_file_util_win.cc % pkasting@'s comment. #

Patch Set 6 : Move DenyFilePermission to match the place in test_file_util.h #

Total comments: 24

Patch Set 7 : Respond to comments. #

Patch Set 8 : Respond to pkasting@'s comments #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -56 lines) Patch
M base/test/test_file_util.h View 7 2 chunks +7 lines, -0 lines 1 comment Download
M base/test/test_file_util_win.cc View 1 2 3 4 5 6 7 3 chunks +43 lines, -37 lines 1 comment Download
M chrome/browser/profiles/profile_io_data.cc View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/profiles/profile_manager.cc View 1 2 3 3 chunks +8 lines, -2 lines 0 comments Download
M chrome/browser/profiles/profile_manager_browsertest.cc View 1 2 9 chunks +53 lines, -13 lines 1 comment Download
M chrome/browser/profiles/profile_window.cc View 1 2 3 4 5 6 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/safe_browsing/safe_browsing_service.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/profile_error_dialog.h View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 54 (11 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2061593002/1
4 years, 6 months ago (2016-06-12 20:16:08 UTC) #2
WC Leung
This is the third (hopefully last) CL on the crash in issue 614753. Anthony: PTAL. ...
4 years, 6 months ago (2016-06-12 20:21:18 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/228599)
4 years, 6 months ago (2016-06-12 21:19:12 UTC) #5
Peter Kasting
https://codereview.chromium.org/2061593002/diff/1/base/test/test_file_util_win.cc File base/test/test_file_util_win.cc (right): https://codereview.chromium.org/2061593002/diff/1/base/test/test_file_util_win.cc#newcode82 base/test/test_file_util_win.cc:82: if (GetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), Nit: Avoid const_cast. Store this in a ...
4 years, 6 months ago (2016-06-13 04:43:21 UTC) #6
WC Leung
Replies... Anyway, I'll do a rebase in my computer to see if the test also ...
4 years, 6 months ago (2016-06-13 08:06:45 UTC) #7
WC Leung
On 2016/06/13 08:06:45, WC Leung wrote: > Replies... > Anyway, I'll do a rebase in ...
4 years, 6 months ago (2016-06-13 11:15:54 UTC) #8
Paweł Hajdan Jr.
base/test LGTM
4 years, 6 months ago (2016-06-13 15:35:17 UTC) #10
anthonyvd
c/b/profiles/* lgtm
4 years, 6 months ago (2016-06-14 13:23:18 UTC) #11
WC Leung
New patch uploaded. Peter: PTAL. Pawel: PTAL again to see if the changes to base/test ...
4 years, 6 months ago (2016-06-15 13:08:39 UTC) #13
WC Leung
Created a new issue (623012) for tracking purpose, and moved the CL to the new ...
4 years, 6 months ago (2016-06-15 13:27:58 UTC) #17
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2061593002/80001
4 years, 6 months ago (2016-06-15 13:35:06 UTC) #19
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-15 15:43:32 UTC) #21
Peter Kasting
https://codereview.chromium.org/2061593002/diff/80001/base/test/test_file_util_win.cc File base/test/test_file_util_win.cc (right): https://codereview.chromium.org/2061593002/diff/80001/base/test/test_file_util_win.cc#newcode78 base/test/test_file_util_win.cc:78: // Deny |permission| on the file |path|, for the ...
4 years, 6 months ago (2016-06-16 07:02:11 UTC) #22
WC Leung
+bauerb as owner of component/perfs Peter: just some replies to your most important comments. Bauerb: ...
4 years, 6 months ago (2016-06-16 10:04:10 UTC) #24
Peter Kasting
https://codereview.chromium.org/2061593002/diff/80001/chrome/browser/profiles/profile_manager.h File chrome/browser/profiles/profile_manager.h (right): https://codereview.chromium.org/2061593002/diff/80001/chrome/browser/profiles/profile_manager.h#newcode405 chrome/browser/profiles/profile_manager.h:405: // be deleted before shutdown. On 2016/06/16 10:04:10, WC ...
4 years, 6 months ago (2016-06-16 11:00:00 UTC) #25
Bernhard Bauer
https://codereview.chromium.org/2061593002/diff/80001/chrome/browser/profiles/profile_manager.h File chrome/browser/profiles/profile_manager.h (right): https://codereview.chromium.org/2061593002/diff/80001/chrome/browser/profiles/profile_manager.h#newcode405 chrome/browser/profiles/profile_manager.h:405: // be deleted before shutdown. On 2016/06/16 10:04:10, WC ...
4 years, 6 months ago (2016-06-16 13:40:25 UTC) #26
WC Leung
> We use JSONPrefStore in a couple of different places. Do you know which one ...
4 years, 6 months ago (2016-06-16 15:01:23 UTC) #27
Bernhard Bauer
+Gab, tracked prefs pro Okay, here's what I think is happening: * JSONPrefStore reports an ...
4 years, 6 months ago (2016-06-16 16:22:18 UTC) #29
gab
On 2016/06/16 16:22:18, Bernhard Bauer wrote: > +Gab, tracked prefs pro > > Okay, here's ...
4 years, 6 months ago (2016-06-17 18:14:06 UTC) #30
Bernhard Bauer
On 2016/06/17 18:14:06, gab wrote: > On 2016/06/16 16:22:18, Bernhard Bauer wrote: > > +Gab, ...
4 years, 6 months ago (2016-06-17 18:17:04 UTC) #31
WC Leung
On 2016/06/17 18:17:04, Bernhard Bauer wrote: > > Here's a way to avoid deletion while ...
4 years, 6 months ago (2016-06-20 16:22:02 UTC) #32
gab
On 2016/06/20 16:22:02, WC Leung wrote: > On 2016/06/17 18:17:04, Bernhard Bauer wrote: > > ...
4 years, 6 months ago (2016-06-20 16:52:10 UTC) #33
WC Leung
https://codereview.chromium.org/2061593002/diff/80001/base/test/test_file_util_win.cc File base/test/test_file_util_win.cc (right): https://codereview.chromium.org/2061593002/diff/80001/base/test/test_file_util_win.cc#newcode98 base/test/test_file_util_win.cc:98: LocalFree(security_descriptor); On 2016/06/16 10:04:10, WC Leung wrote: > On ...
4 years, 6 months ago (2016-06-20 16:54:08 UTC) #34
WC Leung
On 2016/06/20 16:52:10, gab (OOO back Monday) wrote: > On 2016/06/20 16:22:02, WC Leung wrote: ...
4 years, 5 months ago (2016-06-26 20:04:05 UTC) #35
Bernhard Bauer
On 2016/06/26 20:04:05, WC Leung wrote: > On 2016/06/20 16:52:10, gab (OOO back Monday) wrote: ...
4 years, 5 months ago (2016-06-27 08:33:40 UTC) #36
gab
On 2016/06/27 08:33:40, Bernhard Bauer wrote: > On 2016/06/26 20:04:05, WC Leung wrote: > > ...
4 years, 5 months ago (2016-06-27 18:53:04 UTC) #37
WC Leung
On 2016/06/27 18:53:04, gab wrote: > > > Just checked about JSONPrefStore. The file is ...
4 years, 5 months ago (2016-06-27 21:39:44 UTC) #38
WC Leung
On 2016/06/27 21:39:44, WC Leung wrote: > On 2016/06/27 18:53:04, gab wrote: > > > ...
4 years, 5 months ago (2016-06-27 22:07:23 UTC) #39
gab
On 2016/06/27 22:07:23, WC Leung wrote: > On 2016/06/27 21:39:44, WC Leung wrote: > > ...
4 years, 5 months ago (2016-06-30 16:06:40 UTC) #40
WC Leung
On 2016/06/30 16:06:40, gab wrote: > On 2016/06/27 22:07:23, WC Leung wrote: > > On ...
4 years, 5 months ago (2016-06-30 18:15:51 UTC) #41
gab
On 2016/06/30 18:15:51, WC Leung wrote: > On 2016/06/30 16:06:40, gab wrote: > > On ...
4 years, 5 months ago (2016-07-04 15:40:23 UTC) #42
WC Leung
Updated test_file_util_win.cc in patches #5 (for delta) and #6. Peter and Paweł: PTAL. If this ...
4 years, 5 months ago (2016-07-04 18:45:38 UTC) #43
Paweł Hajdan Jr.
base/test still looks good with comments https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h File base/test/test_file_util.h (right): https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h#newcode47 base/test/test_file_util.h:47: // Deny |permission| ...
4 years, 5 months ago (2016-07-05 09:28:08 UTC) #44
Peter Kasting
LGTM https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h File base/test/test_file_util.h (right): https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h#newcode48 base/test/test_file_util.h:48: bool DenyFilePermission(const FilePath& path, DWORD permission); On 2016/07/05 ...
4 years, 5 months ago (2016-07-11 02:35:54 UTC) #45
Bernhard Bauer
https://codereview.chromium.org/2061593002/diff/140001/chrome/browser/profiles/profile_manager_browsertest.cc File chrome/browser/profiles/profile_manager_browsertest.cc (right): https://codereview.chromium.org/2061593002/diff/140001/chrome/browser/profiles/profile_manager_browsertest.cc#newcode390 chrome/browser/profiles/profile_manager_browsertest.cc:390: base::RunLoop run_loop2; On 2016/07/11 02:35:53, Peter Kasting (OOO til ...
4 years, 5 months ago (2016-07-11 08:40:14 UTC) #46
WC Leung
Patch uploaded mainly to respond to the comments in base/test. The other parts were not ...
4 years, 5 months ago (2016-07-18 09:41:35 UTC) #47
Peter Kasting
https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h File base/test/test_file_util.h (right): https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h#newcode48 base/test/test_file_util.h:48: bool DenyFilePermission(const FilePath& path, DWORD permission); On 2016/07/18 09:41:35, ...
4 years, 5 months ago (2016-07-18 17:34:30 UTC) #48
WC Leung
New patch uploaded with small changes to base/test/*. Peter: PTAL. https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h File base/test/test_file_util.h (right): https://codereview.chromium.org/2061593002/diff/140001/base/test/test_file_util.h#newcode48 ...
4 years, 5 months ago (2016-07-19 08:00:12 UTC) #49
Peter Kasting
LGTM https://codereview.chromium.org/2061593002/diff/180001/base/test/test_file_util.h File base/test/test_file_util.h (right): https://codereview.chromium.org/2061593002/diff/180001/base/test/test_file_util.h#newcode47 base/test/test_file_util.h:47: // Deny |permission| on the file |path|, for ...
4 years, 5 months ago (2016-07-20 00:28:46 UTC) #50
Peter Kasting
What's the status here? Looks like nothing has happened since my sign-off.
4 years, 4 months ago (2016-08-20 03:04:42 UTC) #51
WC Leung
On 2016/08/20 03:04:42, Peter Kasting wrote: > What's the status here? Looks like nothing has ...
4 years, 4 months ago (2016-08-22 18:31:11 UTC) #52
Peter Kasting
On 2016/08/22 18:31:11, WC Leung wrote: > On 2016/08/20 03:04:42, Peter Kasting wrote: > > ...
3 years, 10 months ago (2017-02-11 02:00:43 UTC) #53
WC Leung
3 years, 10 months ago (2017-02-12 19:52:43 UTC) #54
On 2017/02/11 02:00:43, Peter Kasting wrote:
> On 2016/08/22 18:31:11, WC Leung wrote:
> > On 2016/08/20 03:04:42, Peter Kasting wrote:
> > > What's the status here?  Looks like nothing has happened since my
sign-off.
> > 
> > Sorry for being slow. Didn't manage to get the spare time to work on this CL
> > because family life is too busy with kids.
> > 
> > Anyway, back to the topic: some problem with the CL (crash with deleting
> > profiles) was not yet solved in the way we want. BTW, the profile error
dialog
> > had a facelift in https://codereview.chromium.org/2107493002/ and this CL as
> > affected. Which this CL is ready I'll invite afakhry@ for taking a look.
> 
> It's been almost six months here.  The CL mentioned above has landed.  Can
this
> either move forward or close?


This CL was supposed to be a part of the "fix" of bug 614753, but actually my
analyzation of that bug was wrong. So the "fix" may actually targets a problem
that no real person faces. (See bug 614753 for updates.)

Anyway, when someone clicks on the fail-to-open profile in the avatar
menu, Chromium will crash. Since some time has passed without a crash report
filed to me, I believe that no one is facing the crash.

The proposed solution (by gab in #42) is to fix DependencyManager first,
and that involves some design changes to DependencyManager. Unless we know that
someone is crashing on this bug, I don't think that it is worth the effort to
fix DependencyManager and move forward.

Powered by Google App Engine
This is Rietveld 408576698