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

Issue 9700038: ScopedProcessInformation protects against process/thread handle leaks from CreateProcess calls. (Closed)

Created:
8 years, 9 months ago by erikwright (departed)
Modified:
8 years, 8 months ago
CC:
grt (UTC plus 2), cpu_(ooo_6.6-7.5), chromium-reviews, jamiewalch+watch_chromium.org, dcaiafa+watch_chromium.org, simonmorris+watch_chromium.org, hclam+watch_chromium.org, wez+watch_chromium.org, amit, sanjeevr, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, brettw-cc_chromium.org, alexeypa+watch_chromium.org, sergeyu+watch_chromium.org
Visibility:
Public.

Description

ScopedProcessInformation protects against process/thread handle leaks from CreateProcess calls. This CL includes the definition of the class along with changes to clients of CreateProcess. Please see http://codereview.chromium.org/9959018/ for the most substantial usages I propose introducing. This was motivated by realizing that my previous fix to LaunchProcess actually still had a leak of the thread handle. BUG=None TEST=tests added in base_unittests Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=130710

Patch Set 1 #

Patch Set 2 : A missing access to hProcess. #

Patch Set 3 : Remove changes from another CL. #

Total comments: 19

Patch Set 4 : Respond to comments. #

Total comments: 8

Patch Set 5 : Respond to comments. #

Patch Set 6 : Merge with master. #

Patch Set 7 : Move definition of ScopedProcessInformation to a .cc file. #

Patch Set 8 : Respond to comments. #

Patch Set 9 : Fix log message. #

Patch Set 10 : Fix include guard comment. #

Patch Set 11 : Remove extra blank line. #

Patch Set 12 : Remove inheritance relationship with ScopedHandle. #

Patch Set 13 : Touch a previously missed use of PROCESS_INFORMATION #

Total comments: 14

Patch Set 14 : Remove sandbox/ and chrome/installer to separate CLs. #

Patch Set 15 : Add missing include. #

Patch Set 16 : Add tests for new functions. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+423 lines, -28 lines) Patch
M base/base.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M base/base.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M base/process_util_win.cc View 1 2 3 4 5 6 7 8 chunks +15 lines, -24 lines 0 comments Download
A base/win/scoped_process_information.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +94 lines, -0 lines 0 comments Download
A base/win/scoped_process_information.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +126 lines, -0 lines 2 comments Download
A base/win/scoped_process_information_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +181 lines, -0 lines 0 comments Download
M remoting/host/wts_session_process_launcher_win.cc View 1 2 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
erikwright (departed)
8 years, 9 months ago (2012-03-15 01:43:37 UTC) #1
alexeypa (please no reviews)
http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_handle.h File base/win/scoped_handle.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_handle.h#newcode105 base/win/scoped_handle.h:105: static bool IsSame(HANDLE lhs, HANDLE rhs) { We will ...
8 years, 9 months ago (2012-03-15 02:41:31 UTC) #2
alexeypa (please no reviews)
More comments. http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h File base/win/scoped_process_information.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h#newcode21 base/win/scoped_process_information.h:21: static bool CloseHandle(PROCESS_INFORMATION handle) { You really ...
8 years, 9 months ago (2012-03-15 02:49:16 UTC) #3
grt (UTC plus 2)
http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h File base/win/scoped_process_information.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h#newcode51 base/win/scoped_process_information.h:51: class ScopedProcessInformation : public GenericScopedHandle<ProcessInfoTraits> { did you consider ...
8 years, 9 months ago (2012-03-15 02:59:30 UTC) #4
erikwright (departed)
http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_handle.h File base/win/scoped_handle.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_handle.h#newcode105 base/win/scoped_handle.h:105: static bool IsSame(HANDLE lhs, HANDLE rhs) { On 2012/03/15 ...
8 years, 9 months ago (2012-03-15 03:29:16 UTC) #5
alexeypa (please no reviews)
A few more "const reference" comments. This CL looks good to me. However I'm not ...
8 years, 9 months ago (2012-03-15 16:38:27 UTC) #6
sanjeevr
http://codereview.chromium.org/9700038/diff/3007/base/win/scoped_process_information.h File base/win/scoped_process_information.h (right): http://codereview.chromium.org/9700038/diff/3007/base/win/scoped_process_information.h#newcode71 base/win/scoped_process_information.h:71: process_info.dwProcessId = 0; Drive-by: Zeroing out the process id ...
8 years, 9 months ago (2012-03-15 17:42:55 UTC) #7
grt (UTC plus 2)
http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h File base/win/scoped_process_information.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h#newcode51 base/win/scoped_process_information.h:51: class ScopedProcessInformation : public GenericScopedHandle<ProcessInfoTraits> { On 2012/03/15 03:29:17, ...
8 years, 9 months ago (2012-03-15 18:01:09 UTC) #8
erikwright (departed)
http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h File base/win/scoped_process_information.h (right): http://codereview.chromium.org/9700038/diff/3002/base/win/scoped_process_information.h#newcode66 base/win/scoped_process_information.h:66: Set(process_info); On 2012/03/15 16:38:27, alexeypa wrote: > I would ...
8 years, 9 months ago (2012-03-15 18:02:43 UTC) #9
brettw
I feel like deriving from GenericScopedHandle isn't really appropriate here. It's not a handle, it's ...
8 years, 9 months ago (2012-03-16 19:35:32 UTC) #10
cpu_(ooo_6.6-7.5)
I second brettw@ idea. I don't think this struct "is a" scoped handle. Just looking ...
8 years, 9 months ago (2012-03-19 00:49:00 UTC) #11
cpu_(ooo_6.6-7.5)
you missed content/common/sandbox_policy.cc
8 years, 9 months ago (2012-03-19 01:00:03 UTC) #12
erikwright (departed)
Hi Brett, I removed the derivation from ScopedHandle. In this revision, I chose not to ...
8 years, 8 months ago (2012-03-28 19:30:07 UTC) #13
cpu_(ooo_6.6-7.5)
sandbox files lgtm.
8 years, 8 months ago (2012-03-29 02:39:55 UTC) #14
alexeypa (please no reviews)
LGTM for remoting. http://codereview.chromium.org/9700038/diff/11020/base/win/scoped_process_information.cc File base/win/scoped_process_information.cc (right): http://codereview.chromium.org/9700038/diff/11020/base/win/scoped_process_information.cc#newcode27 base/win/scoped_process_information.cc:27: process_information_.dwProcessId || process_information_.dwThreadId; I think that ...
8 years, 8 months ago (2012-03-29 04:51:34 UTC) #15
brettw
This looks nice, I just have a few questions: http://codereview.chromium.org/9700038/diff/28004/base/win/scoped_process_information.cc File base/win/scoped_process_information.cc (right): http://codereview.chromium.org/9700038/diff/28004/base/win/scoped_process_information.cc#newcode69 base/win/scoped_process_information.cc:69: ...
8 years, 8 months ago (2012-03-30 17:23:09 UTC) #16
erikwright (departed)
On 2012/03/30 17:23:09, brettw wrote: > This looks nice, I just have a few questions: ...
8 years, 8 months ago (2012-03-30 17:27:34 UTC) #17
erikwright (departed)
I separated the changes in sandbox/ and chrome/installer/ into new CLs as I thought they ...
8 years, 8 months ago (2012-03-30 17:30:27 UTC) #18
brettw
Okay, if you have a need for these, they're both fine. LGTM
8 years, 8 months ago (2012-03-30 17:31:33 UTC) #19
erikwright (departed)
On 2012/03/30 17:31:33, brettw wrote: > Okay, if you have a need for these, they're ...
8 years, 8 months ago (2012-03-30 17:40:44 UTC) #20
alexeypa (please no reviews)
Just an FYI. http://codereview.chromium.org/9700038/diff/11020/base/win/scoped_process_information.cc File base/win/scoped_process_information.cc (right): http://codereview.chromium.org/9700038/diff/11020/base/win/scoped_process_information.cc#newcode27 base/win/scoped_process_information.cc:27: process_information_.dwProcessId || process_information_.dwThreadId; On 2012/03/30 17:30:27, ...
8 years, 8 months ago (2012-03-30 18:26:39 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/9700038/28004
8 years, 8 months ago (2012-04-04 15:11:48 UTC) #22
commit-bot: I haz the power
Presubmit check for 9700038-28004 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 8 months ago (2012-04-04 15:11:55 UTC) #23
simonmorris
LGTM for remoting.
8 years, 8 months ago (2012-04-04 15:38:33 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/erikwright@chromium.org/9700038/28004
8 years, 8 months ago (2012-04-04 15:39:31 UTC) #25
commit-bot: I haz the power
8 years, 8 months ago (2012-04-04 16:46:52 UTC) #26
Try job failure for 9700038-28004 (retry) on win for step "compile" (clobber
build).
It's a second try, previously, step "compile" failed.
http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win&number...

Powered by Google App Engine
This is Rietveld 408576698