Closed Bug 1734642 Opened 3 years ago Closed 3 years ago

x86/arm32: MacroAssembler::load64 does not consider whether its address overlaps the output register

Categories

(Core :: JavaScript Engine: JIT, defect)

x86
Unspecified
defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

load64 on arm32 and x86 may overlap the 64-bit output register with registers in the address expression, but does not consider this possibility. (There are two variants, aligned and unaligned load, but the latter delegates to the former.) Thus the pointer may be clobbered by the first word load and the second word load will go wrong. I just ran into this with some unshipped code.

This looks like a potential mess to fix - for Address it's not so hard, we can reverse the loads if we need to. For BaseIndex, the address has two registers and may both overlap the output register.

The problem can sometimes be fixed higher up in the stack by not reusing an input.

This is not currently an actual problem. I have vetted every use of load64(), and there is only one latent problem in the code generator: WasmLoadTls has an unconditional useRegisterAtStart(tlsPtr) and here the pointer register will potentially overlap with the output register when a 64-bit value is loaded on a 32-bit system. But that situation does not arise, because the only such 64-bit value is the bounds check limit and on 32-bit systems that is always a 32-bit value and we never load more than the low word of it. So the only real bug is in a patch stack that is still under development.

It doesn't look like I'm able to open this bug up. :dveditz, can you take care of that? Thanks.

Flags: needinfo?(dveditz)
Keywords: sec-high
Attachment #9244799 - Attachment description: WIP: Bug 1734642 → Bug 1734642 - Make load64() resilient on 32-bit. r?nbp
Group: core-security
Flags: needinfo?(dveditz)
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/052b313e7c71
Make load64() resilient on 32-bit. r=nbp
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: