Closed
Bug 1478623
Opened 8 years ago
Closed 8 years ago
mpi_arm.c functions yield miscompilations when inlined by LTO
Categories
(NSS :: Libraries, defect)
NSS
Libraries
Tracking
(Not tracked)
RESOLVED
FIXED
3.39
People
(Reporter: glandium, Assigned: glandium)
References
Details
Attachments
(1 file, 2 obsolete files)
|
5.71 KB,
patch
|
franziskus
:
review+
|
Details | Diff | Splinter Review |
Bug 1477929 was an obvious build error, this one was only detected because it made Firefox crash at runtime. Details will be in the patch commit message.
| Assignee | ||
Comment 1•8 years ago
|
||
While bug 1477929 fixed the obvious build failure, it still allowed the
compiler to break things when it inlines the mpi_arm.c functions into
its callers via LTO.
The problem is that all those assembly blocks take a length as input in
a register, and decrement that register. But the constraints are not
explicit about those writes to the register, so the compiler may decide
to reuse them as the original value for the length in code following the
inlined code. It actually happily does so, which leads to interesting
crashes.
Attachment #8995164 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Comment 2•8 years ago
|
||
Comment on attachment 8995164 [details] [diff] [review]
Add a r/w constraint to a_len in all asm blocks in mpi_arm.c
Looks like this is not enough. Many Android tests still fail with this patch, while they don't if I add __attribute__((noinline)) to all these functions.
Attachment #8995164 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Comment 3•8 years ago
|
||
While bug 1477929 fixed the obvious build failure, it still allowed the
compiler to break things when it inlines the mpi_arm.c functions into
its callers via LTO.
The problem is that all those assembly blocks take a length as input in
a register, and decrement that register. They also update both registers
they're passed in with pointers, via post-indexed offsets on ldr and str.
But the constraints are not explicit about those writes to the
registers, so the compiler may decide to reuse them as if they had their
original value in code following the inlined code. It actually happily
does so, which leads to interesting crashes.
Attachment #8995164 -
Attachment is obsolete: true
Attachment #8995466 -
Flags: review?(franziskuskiefer)
Comment 4•8 years ago
|
||
Comment on attachment 8995466 [details] [diff] [review]
Add r/w constraints to modified registers to asm blocks in mpi_arm.c
Review of attachment 8995466 [details] [diff] [review]:
-----------------------------------------------------------------
It would be great to have a little more context in the patch here. Can you put this on phabricator?
Attachment #8995466 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Comment 5•8 years ago
|
||
How would phabricator make a difference here? The patch has all the same information I'd put there.
| Assignee | ||
Comment 6•8 years ago
|
||
Oh, more patch context, as in -U8. I don't have arcanist, so phabricator wouldn't help there anyways. I can update the patch to have more context lines, though.
| Assignee | ||
Comment 7•8 years ago
|
||
Attachment #8995466 -
Attachment is obsolete: true
Attachment #8995897 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Updated•8 years ago
|
Blocks: android-lto
Comment 8•8 years ago
|
||
Comment on attachment 8995897 [details] [diff] [review]
Add r/w constraints to modified registers to asm blocks in mpi_arm.c
Review of attachment 8995897 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me (with my limited ARM assembly foo). Thanks!
Attachment #8995897 -
Flags: review?(franziskuskiefer) → review+
| Assignee | ||
Comment 9•8 years ago
|
||
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Target Milestone: --- → 3.39
You need to log in
before you can comment on or make changes to this bug.
Description
•