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

Issue 6327020: Instantiate HttpRequestInfo before HttpNetworkTransaction in unit tests. (Closed)

Created:
9 years, 11 months ago by Satish
Modified:
9 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, Timur Iskhodzhanov, Alexander Potapenko, pam+watch_chromium.org, Paweł Hajdan Jr., stuartmorgan+watch_chromium.org
Visibility:
Public.

Description

The HttpRequestInfo object must outlive the HttpNetworkTransaction object because HttpRequestInfo is passed to HttpNetworkTransaction::Start() and HttpNetworkTransaction access the request info object in many places. With the current code UploadData gets deleted before HttpStreamParser and that causes read-after-free cases as shown in the below bug. BUG=70825 TEST=verify that the valgrind issue mentioned in the bug gets fixed Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=72954

Patch Set 1 #

Patch Set 2 : . #

Total comments: 1

Patch Set 3 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+309 lines, -325 lines) Patch
M net/http/http_network_transaction_unittest.cc View 1 2 96 chunks +309 lines, -309 lines 0 comments Download
M tools/valgrind/memcheck/suppressions.txt View 1 1 chunk +0 lines, -16 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Satish
9 years, 11 months ago (2011-01-26 12:52:13 UTC) #1
wtc
I added vandebo and willchan as backup reviewers because I may not be able to ...
9 years, 11 months ago (2011-01-26 18:35:17 UTC) #2
Nico
Can you remove the suppression for this in tools/valgrind/memcheck/suppressions.txt in this CL as well?
9 years, 11 months ago (2011-01-26 19:48:04 UTC) #3
Satish
> We should understand why UploadData is deleted before UploadDataStream. > That seems wrong, and ...
9 years, 11 months ago (2011-01-27 13:55:17 UTC) #4
vandebo (ex-Chrome)
I drew out the ownership data, and Satish's explanation makes sense. UploadData is already a ...
9 years, 11 months ago (2011-01-27 18:36:45 UTC) #5
willchan no longer on Chromium
On Thu, Jan 27, 2011 at 5:55 AM, <satish@chromium.org> wrote: > We should understand why ...
9 years, 11 months ago (2011-01-27 18:54:45 UTC) #6
Satish
> Any place where the transaction outlives the HttpRequestInfo is a bug. If > you ...
9 years, 11 months ago (2011-01-27 20:32:19 UTC) #7
willchan no longer on Chromium
On Thu, Jan 27, 2011 at 12:32 PM, <satish@chromium.org> wrote: > Any place where the ...
9 years, 11 months ago (2011-01-27 20:34:07 UTC) #8
Satish
Thanks. I'll wait for wtc@ to confirm as well before uploading a new patch with ...
9 years, 11 months ago (2011-01-27 20:46:11 UTC) #9
Satish
New patch uploaded fixing all places in that unit test.
9 years, 11 months ago (2011-01-27 22:17:34 UTC) #10
willchan no longer on Chromium
LGTM if valgrind looks good
9 years, 11 months ago (2011-01-27 22:53:14 UTC) #11
Satish
I see valgrind fails on 2 other unrelated tests which are not part of this ...
9 years, 11 months ago (2011-01-27 23:06:02 UTC) #12
willchan no longer on Chromium
Sounds good. On 2011/01/27 23:06:02, Satish wrote: > I see valgrind fails on 2 other ...
9 years, 11 months ago (2011-01-27 23:08:01 UTC) #13
wtc
LGTM. Excellent work! IMPORTANT: in the CL's description, please point out that the HttpRequestInfo object ...
9 years, 11 months ago (2011-01-28 01:00:38 UTC) #14
wtc
On 2011/01/27 18:54:45, willchan wrote: > > Any place where the transaction outlives the HttpRequestInfo ...
9 years, 11 months ago (2011-01-28 01:06:15 UTC) #15
wtc
9 years, 11 months ago (2011-01-29 01:43:03 UTC) #16
On 2011/01/28 01:00:38, wtc wrote:
>
> A related minor problem: the HttpStreamParser destructor
> accesses UploadDataStream unnecessarily.  I will create a
> CL to fix that.

I was mistaken.  Please ignore this comment.

Unless we can guarantee UploadData::AppendChunk won't be
called after HttpStreamParser is destroyed, it is safer
to call request_body_->set_chunk_callback(NULL) in the
HttpStreamParser destructor.

Powered by Google App Engine
This is Rietveld 408576698