Closed
Bug 1375842
Opened 8 years ago
Closed 8 years ago
AddressSanitizer: heap-buffer-overflow [@ hsw::convolve_vertically] with READ of size 32
Categories
(Core :: Graphics, defect, P1)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | unaffected |
firefox54 | --- | unaffected |
firefox55 | --- | unaffected |
firefox56 | --- | fixed |
People
(Reporter: truber, Assigned: lsalzman)
References
(Blocks 2 open bugs)
Details
(5 keywords, Whiteboard: [gfx-noted])
Attachments
(4 files, 1 obsolete file)
182 bytes,
text/html
|
Details | |
18.38 KB,
text/plain
|
Details | |
4.75 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
1.39 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
The attached testcase causes a heap-buffer-overflow in mozilla-central rev 594cc32b6323.
==2513==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000f2c9f at pc 0x7f5820327599 bp 0x7f580afd5350 sp 0x7f580afd5348
READ of size 32 at 0x6060000f2c9f thread T17 (ImgDecoder #2)
#0 0x7f5820327598 in hsw::convolve_vertically(short const*, int, unsigned char* const*, int, unsigned char*, bool) /home/worker/workspace/build/src/gfx/skia/skia/src/opts/SkOpts_hsw.cpp:57:54
#1 0x7f5819c9e84d in operator() /home/worker/workspace/build/src/image/DownscalingFilter.h:283:16
#2 0x7f5819c9e84d in WriteUnsafeComputedRow<unsigned int, (lambda at /home/worker/workspace/build/src/image/DownscalingFilter.h:281:53)> /home/worker/workspace/build/src/image/SurfacePipe.h:386
#3 0x7f5819c9e84d in mozilla::image::DownscalingFilter<mozilla::image::SurfaceSink>::DownscaleInputRow() /home/worker/workspace/build/src/image/DownscalingFilter.h:281
#4 0x7f5819c9e307 in mozilla::image::DownscalingFilter<mozilla::image::SurfaceSink>::DoAdvanceRow() /home/worker/workspace/build/src/image/DownscalingFilter.h:245:7
#5 0x7f5819c97928 in AdvanceRow /home/worker/workspace/build/src/image/SurfacePipe.h:131:19
#6 0x7f5819c97928 in DoWritePixelsToRow<unsigned int, (lambda at /home/worker/workspace/build/src/image/decoders/nsPNGDecoder.cpp:913:49)> /home/worker/workspace/build/src/image/SurfacePipe.h:499
#7 0x7f5819c97928 in WritePixelsToRow<unsigned int, (lambda at /home/worker/workspace/build/src/image/decoders/nsPNGDecoder.cpp:913:49)> /home/worker/workspace/build/src/image/SurfacePipe.h:209
#8 0x7f5819c97928 in WritePixelsToRow<unsigned int, (lambda at /home/worker/workspace/build/src/image/decoders/nsPNGDecoder.cpp:913:49)> /home/worker/workspace/build/src/image/SurfacePipe.h:619
#9 0x7f5819c97928 in mozilla::image::nsPNGDecoder::WriteRow(unsigned char*) /home/worker/workspace/build/src/image/decoders/nsPNGDecoder.cpp:913
Flags: in-testsuite?
Reporter | ||
Comment 1•8 years ago
|
||
Comment 3•8 years ago
|
||
Fallout from bug 1371689 maybe?
Assignee | ||
Comment 4•8 years ago
|
||
I have an idea of the source of this issue related to SIMD padding. This would imply there is a bug in Skia's own code related to the usage of convolution filters. I'll investigate this more thoroughly soon and post a fix.
Bug 1377427 should also be a dup of this, but I'll just mark it as a see also until I have time to verify for sure.
See Also: → 1377427
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Flags: needinfo?(lsalzman)
Priority: -- → P1
Whiteboard: [gfx-noted]
Updated•8 years ago
|
Keywords: csectype-bounds,
sec-high
Comment 5•8 years ago
|
||
This seems to be happening on launch now.
I just grabbed m-c
Build ID: 20170704154817
Changeset: acbd9a64c0fa4e1980c7732735d4f4c2761ca4c9
Updated•8 years ago
|
Keywords: regressionwindow-wanted
Comment 8•8 years ago
|
||
From bug 1378393 this appears to be triggerable from web content (in an ASAN build):
"while testing http://legiaodosherois.uol.com.br/2017/vingadores-guerra-infinita-foto-pode-ter-revelado-detalhe-importante-sobre-o-homem-de-ferro-no-filme.html the asan-opt build run into a heap after use"
Assignee | ||
Comment 9•8 years ago
|
||
Skia optionally uses 256 bit AVX for convolution, which means we need to increase our SIMD padding to accommodate this. Also centralizes the padding code so we only have to change it in one place.
Attachment #8884051 -
Flags: review?(jmuizelaar)
Assignee | ||
Comment 10•8 years ago
|
||
Remove erroneous const.
Attachment #8884051 -
Attachment is obsolete: true
Attachment #8884051 -
Flags: review?(jmuizelaar)
Attachment #8884052 -
Flags: review?(jmuizelaar)
Assignee | ||
Comment 11•8 years ago
|
||
Does this patch fix things for you?
Flags: needinfo?(jschwartzentruber)
Updated•8 years ago
|
Attachment #8884052 -
Flags: review?(jmuizelaar) → review+
Reporter | ||
Comment 12•8 years ago
|
||
(In reply to Lee Salzman [:lsalzman] from comment #11)
> Does this patch fix things for you?
Built on 20f32734df750bddada9d1edca665c2ea53946f0 and the testcase no longer repros with your patch.
Flags: needinfo?(jschwartzentruber)
Assignee | ||
Comment 15•8 years ago
|
||
Comment on attachment 8884052 [details] [diff] [review]
increase SIMD padding for convolution filter to 31 bytes
[Security approval request comment]
> How easily could an exploit be constructed based on the patch?
Only affects AVX2 (which is Haswell+). Can be used to do some small (no more than 15 bytes) memory overreads past the end of heap-allocated buffers.
> Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
The patch only mentions that we need to increase padding for SIMD operations with convolution filters, but it does not specifically point out that we're overreading.
> Which older supported branches are affected by this flaw?
> If not all supported branches, which bug introduced the flaw?
Bug 1371689, so only affects 56+, and is thus strictly confined to nightly for now.
> Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
Only affects nightly, so it would be advisable to deploy the fix now before a train flip so we can avoid having to backport.
> How likely is this patch to cause regressions; how much testing does it need?
Extremely unlikely. Just adds some more padding to the end of image buffers. Verified by reporter to fix issue.
Attachment #8884052 -
Flags: sec-approval?
Comment 16•8 years ago
|
||
Comment on attachment 8884052 [details] [diff] [review]
increase SIMD padding for convolution filter to 31 bytes
Bugs that only affect m-c don't need sec-approval. Just land it.
Attachment #8884052 -
Flags: sec-approval?
Updated•8 years ago
|
status-firefox54:
--- → unaffected
status-firefox55:
--- → unaffected
status-firefox56:
--- → affected
status-firefox-esr52:
--- → unaffected
Comment 17•8 years ago
|
||
Can we land a test too please? :)
Assignee | ||
Comment 18•8 years ago
|
||
Just turns reporter's testcase into a crashtest. Nothing fancy.
Attachment #8884343 -
Flags: review?(jmuizelaar)
Updated•8 years ago
|
Attachment #8884343 -
Flags: review?(jmuizelaar) → review+
https://hg.mozilla.org/mozilla-central/rev/31f3099d7082
https://hg.mozilla.org/mozilla-central/rev/b501fbc1bbb0
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Updated•8 years ago
|
Flags: in-testsuite? → in-testsuite+
Updated•8 years ago
|
Group: gfx-core-security → core-security-release
Updated•7 years ago
|
Group: core-security-release
Updated•5 years ago
|
Blocks: asan-maintenance
You need to log in
before you can comment on or make changes to this bug.
Description
•