New issue
Advanced search Search tips

Issue 835613 link

Starred by 2 users

Heap-use-after-free in blink::FloatingObject::FloatingObject

Project Member Reported by ClusterFuzz, Apr 22 2018

Issue description

Detailed report: https://clusterfuzz.com/testcase?key=6167934377132032

Fuzzer: marty_html_twiddler
Job Type: windows_asan_chrome_no_sandbox
Platform Id: windows

Crash Type: Heap-use-after-free READ 8
Crash Address: 0x12def5e25e18
Crash State:
  blink::FloatingObject::FloatingObject
  blink::FloatingObject::Create
  blink::LayoutBlockFlow::InsertFloatingObject
  
Sanitizer: address (ASAN)

Recommended Security Severity: High

Regressed: https://clusterfuzz.com/revisions?job=windows_asan_chrome_no_sandbox&range=527014:527021

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=6167934377132032

Issue filed automatically.

See https://github.com/google/clusterfuzz-tools for more information.
 
Project Member

Comment 1 by ClusterFuzz, Apr 22 2018

Components: Blink>Layout
Labels: Test-Predator-Auto-Components
Automatically applying components based on crash stacktrace and information from OWNERS files.

If this is incorrect, please apply the Test-Predator-Wrong-Components label.
Project Member

Comment 2 by ClusterFuzz, Apr 22 2018

Labels: Test-Predator-Auto-Owner
Owner: futhark@chromium.org
Status: Assigned (was: Untriaged)
Automatically assigning owner based on suspected regression changelist https://chromium.googlesource.com/chromium/src/+/ce67e40512a36401cb863ff78d59f7a28c127bf3 (Revert "Merge anonymous table boxes when appropriate.").

If this is incorrect, please let us know why and apply the Test-Predator-Wrong-CLs label. If you aren't the correct owner for this issue, please unassign yourself as soon as possible so it can be re-triaged.
Project Member

Comment 3 by sheriffbot@chromium.org, Apr 22 2018

Labels: M-66
Project Member

Comment 4 by sheriffbot@chromium.org, Apr 22 2018

Labels: Pri-1
Labels: -Pri-1 -M-66 Pri-3
Owner: ----
Status: Available (was: Assigned)
It's very likely that the suspected CL was the reason, but that was a revert, which means the problem was there before the origin CL https://chromium.googlesource.com/chromium/src/+/4766c5012f46eed5afec44dcbc10e7365eadbc1b

This issue is probably old.
Project Member

Comment 6 by sheriffbot@chromium.org, Apr 23 2018

Labels: M-66

Comment 7 by vakh@chromium.org, Apr 23 2018

Labels: Test-Predator-Wrong-CLs

Comment 8 by vakh@chromium.org, Apr 23 2018

Labels: -Test-Predator-Wrong-CLs Test-Predator-Wrong

Comment 9 by vakh@chromium.org, Apr 23 2018

Cc: chrishtr@chromium.org skobes@chromium.org e...@chromium.org tkent@chromium.org fmalita@chromium.org wangxianzhu@chromium.org pdr@chromium.org schenney@chromium.org
Owner: cbiesin...@chromium.org
Status: Assigned (was: Available)
I'm hitting Blink Reformat in all the contexts on the call stack so assigning it to the directory owners for quick triage.
If I find the culprit CL, I'll update the owner of the bug.
Project Member

Comment 10 by sheriffbot@chromium.org, May 6 2018

cbiesinger: Uh oh! This issue still open and hasn't been updated in the last 14 days. This is a serious vulnerability, and we want to ensure that there's progress. Could you please leave an update with the current status and any potential blockers?

If you're not the right owner for this issue, could you please remove yourself as soon as possible or help us find the right one?

If the issue is fixed or you can't reproduce it, please close the bug. If you've started working on a fix, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 11 by sheriffbot@chromium.org, May 20 2018

cbiesinger: Uh oh! This issue still open and hasn't been updated in the last 28 days. This is a serious vulnerability, and we want to ensure that there's progress. Could you please leave an update with the current status and any potential blockers?

If you're not the right owner for this issue, could you please remove yourself as soon as possible or help us find the right one?

If the issue is fixed or you can't reproduce it, please close the bug. If you've started working on a fix, please set the status to Started.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 12 by sheriffbot@chromium.org, May 30 2018

Labels: -M-66 M-67
cbiesinger: Ping, can you please take a look when you have a chance? 
Labels: -Pri-3 OS-Android OS-Chrome OS-Fuchsia OS-Linux OS-Mac Pri-1
M-67 has sailed, but maybe we can get it in a stable update if we're lucky. This is our second-oldest High-severity bug (45 days), and we have a commitment to ship fixes to users in 60 days (https://chromium.googlesource.com/chromium/src/+/master/docs/security/severity-guidelines.md#High-severity).

Comment 15 by wfh@chromium.org, Jun 15 2018

Hello from your friendly security sheriff. This bug is now 54 days old, which is very near to exceeding the commitments we make publicly about our timelines fox fixing security bugs.

Is a better bisect needed to try and find the bug here? What needs to be done to move this bug onwards and upwards? Please update the bug as soon as possible.

Comment 16 by pdr@chromium.org, Jun 15 2018

Cc: mstensho@chromium.org
Owner: futhark@chromium.org
Hi Rune, there hasn't been any progress on this, but it doesn't seem too difficult, even though it's an old and existing bug. Can you take a look? If not, please reassign to me.
I started on it here:

https://chromium-review.googlesource.com/c/chromium/src/+/852259

The first patch set is the change that fixed this issue but introduced others.

Comment 18 by pdr@chromium.org, Jun 16 2018

Are you sure this is a table bug? Just looking at the stack, it seems like an issue where we are forgetting to remove a LayoutObject from root_inline_box.h's floats_ when the LayoutObject is destroyed. Would it be possible to do more targeted temporary fix to squash the security bug?

READ of size 8 at 0x11c9f861d798 thread T0
#0 FloatingObject::FloatingObject
#1 FloatingObject::Create
#2 LayoutBlockFlow::InsertFloatingObject
#3 LayoutBlockFlow::LinkToEndLineIfNeeded
#4 LayoutBlockFlow::LayoutRunsAndFloats
#5 LayoutBlockFlow::LayoutInlineChildren

freed by thread T0 here:
#0 third_party/llvm/projects/compiler-rt/lib/asan/asan_malloc_win.cc:44
#1 LayoutBlockFlow::`scalar deleting destructor'
#2 LayoutObject::DestroyAndCleanupAnonymousWrappers
#3 Node::DetachLayoutTree
#4 ContainerNode::DetachLayoutTree
#5 Element::DetachLayoutTree


Cc: -mstensho@chromium.org futhark@chromium.org
Owner: mstensho@chromium.org
I'm able to reproduce the asan report with an asan build on Linux.

The reason I think it's related to tables is that my table change only changed anonymous correction for table layout and presumably fixed this issue.

I'm not familiar with inline layout or floats.

Morten, do you have any ideas?

I'll try revive my in-progress table correction and see if it still fixes this issue.

Nope, did not work.
First we need a reduction. After spending almost a day, at least I have something that fits on one page. :-P
reduction-in-progress.html
1.1 KB View Download
Attaching a minimal testcase with explanations.
tc.html
2.3 KB View Download
Hm, the test case could have been even more minimal; we don't need #emptySpan. All we have to do is take an inline-block with a float, and wrap it inside an anonymous block, and then remove the float. Requires a somewhat exotic inline layout situation, though. :)

Comment 25 by pdr@chromium.org, Jun 20 2018

I kicked off a clusterfuzz run with the minimized testcase to see if a different regression range is found: https://clusterfuzz.com/v2/testcase-detail/6095192256675840. Rune's patch may have been incorrectly blamed because the testcase had tables.
Windows ASAN64 is flaky, can you reupload to linux_asan_chrome_mp

Comment 27 by pdr@chromium.org, Jun 20 2018

Here's a clusterfuzz run on linux_asan_chrome_mp: https://clusterfuzz.com/v2/testcase-detail/5913320323022848
Thanks a lot for fixing this, Morten (hasn't landed yet, but still :-))
And thanks pdr for the fuzzer run. I can confirm that it was introduced by https://codereview.chromium.org/2828553002 (April 2017).
Project Member

Comment 30 by bugdroid1@chromium.org, Jun 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/17766b88aabf6c58a1019de65ca571afcaada2e1

commit 17766b88aabf6c58a1019de65ca571afcaada2e1
Author: Morten Stenshorne <mstensho@chromium.org>
Date: Thu Jun 21 12:17:07 2018

Line boxes hold potentially dangling pointers to FloatingObject.

And that's how it's supposed to work, apparently. We're just supposed to mark
such lines dirty when the objects get deleted, and the dangling pointers will
be cleaned up "soon enough".

When removing a FloatingObject, we need to mark the RootInlineBox object that
points to it as dirty. The case we were missing was the one where we remove ALL
floating objects. When removing just one, on the other hand, we use
LayoutBlockFlow::RemoveFloatingObject(), which already takes care of this.

Bug:  835613 
Change-Id: I2b978f1bb4c9a496a5dad4b097ef598630059a9d
Reviewed-on: https://chromium-review.googlesource.com/1108936
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569223}
[add] https://crrev.com/17766b88aabf6c58a1019de65ca571afcaada2e1/third_party/WebKit/LayoutTests/fast/block/float/remove-float-after-anonymous-block-insert-crash.html
[modify] https://crrev.com/17766b88aabf6c58a1019de65ca571afcaada2e1/third_party/blink/renderer/core/layout/layout_block_flow.cc

Status: Fixed (was: Assigned)
Project Member

Comment 32 by sheriffbot@chromium.org, Jun 21 2018

Labels: -Restrict-View-SecurityTeam Restrict-View-SecurityNotify
Project Member

Comment 33 by ClusterFuzz, Jun 22 2018

Labels: ClusterFuzz-Verified
Status: Verified (was: Fixed)
ClusterFuzz testcase 5913320323022848 is verified as fixed, so closing issue as verified.

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.
Project Member

Comment 34 by ClusterFuzz, Jun 22 2018

Labels: -Reproducible Unreproducible
ClusterFuzz testcase 6167934377132032 appears to be flaky, updating reproducibility label.
Project Member

Comment 35 by sheriffbot@chromium.org, Jun 23 2018

Labels: Merge-Request-68
Project Member

Comment 36 by sheriffbot@chromium.org, Jun 23 2018

Labels: -Merge-Request-68 Hotlist-Merge-Review Merge-Review-68
This bug requires manual review: M68 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: cmasso@(Android), kariahda@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I advise against merging this. This is not a very recent regression; see comment #c29.
Labels: -Merge-Review-68 Merge-Rejected-68
Per #37, rejecting merge to 68. 
Labels: -M-67 M-69
Labels: Release-0-M69
Project Member

Comment 41 by sheriffbot@chromium.org, Sep 27

Labels: -Restrict-View-SecurityNotify allpublic
This bug has been closed for more than 14 weeks. Removing security view restrictions.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment