Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix field order for INVPCID descriptor #508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Commits on Nov 3, 2024

  1. fix field order for INVPCID descriptor

    Both Intel's and AMD's manuals describe the INVPCID descriptor as a
    128-bit value with the linear address stored in the upper half and the
    PCID stored in the lower half. x86 uses little-endian byte ordering and
    so the lower half (pcid) should be stored before the upper half
    (address). Previously, our `InvpcidDescriptor` type stored the halves
    in the opposite order with the address before the pcid. This patch
    fixes the order, so that the pcid is stored before the address. This
    new order is also the order used by Linux and OpenBSD:
    https://github.com/torvalds/linux/blob/3e5e6c9900c3d71895e8bdeacfb579462e98eba1/arch/x86/include/asm/invpcid.h#L8
    https://github.com/openbsd/src/blob/4e368faebf86e9a349446b5839c333bc17bd3f9a/sys/arch/amd64/include/cpufunc.h#L173
    It's beyond me how this wasn't noticed earlier. The previous incorrect
    layout could lead to TLB entries not being flushed and #GP faults.
    Freax13 committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    4bd1973 View commit details
    Browse the repository at this point in the history