Project

General

Profile

Actions

Submit #3263

closed

[PATCH] Add memory barriers on some ASM functions

Added by Anonymous almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Kernel
Target version:
Start date:
01/15/2021
Due date:
% Done:

0%

Estimated time:

Description

Certain instructions have memory side effects and having the compiler reorder
them is generally not a good thing. Eg modifying CR4_SMAP changes the way memory
fetches are done afterwards. Same with WRMSR on certain MSRs such as PAT, etc.

In practice I don't think there are conditions where they make a difference, but
for correctness, add memory barriers.


Files

1-add-memory-barriers.diff (3.01 KB) 1-add-memory-barriers.diff Anonymous, 01/15/2021 11:41 PM
Actions #1

Updated by dillon almost 4 years ago

  • Status changed from New to Resolved
  • Assignee set to dillon

Committed. Totally reasonable to give these __asm functions memory barriers (prevents the compiler from reordering instructions around the functions).

-Matt

Actions

Also available in: Atom PDF