Closed Bug 1598119 Opened 5 years ago Closed 5 years ago

WindowsDllNopSpacePatcher fails CFG checks

Categories

(Core :: Security, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: away, Assigned: away)

References

Details

Attachments

(1 file)

When a nop-space hook jumps back to the original API, at ntdll!Whatever+2, that address is not a registered jump target, so we crash with a CFG failure.

I think this is just a matter of annotating operator() with __attribute__((nocf_check)).

Interestingly it doesn't happen on 64-bit hooks, I guess because mOrigFunc points into a dynamically-allocated trampoline instead of 2 bytes into a real function?

Assignee: nobody → dmajor
Assignee: dmajor → nobody

The priority flag is not set for this bug.
:wleung, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(wleung)

P2 since this is something I think dmajor is working on without a specific target date.

Flags: needinfo?(wleung)
Priority: -- → P2

We need a fix upstream...

Under the stronger Control Flow Guard scheme coming in clang 10, when a nop-space hook jumps back to the original API, at ntdll!Whatever+2, that address is not a registered jump target, so we crash with a CFG failure. Since this is a deliberate violation of the rules, let's disable CFG for these calls.

Some notes about the commit: Based on my testing, this is the only place we need to use this attribute, so I placed its definition close to the use. (Had we needed more of these, I would have put it in mfbt/.) Second, to avoid -Werror'ing people with older compilers, I put in a version check. Generally the wisdom is to use a feature check with __has_attribute instead of a hardcoded version number, but since nocf is a sub-sub-attribute of __declspec, the testing machinery isn't granular enough.

Assignee: nobody → dmajor
Status: NEW → ASSIGNED
Pushed by dmajor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5400fdfe2a49 Disable Control Flow Guard for WindowsDllInterceptor returns r=handyman
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: