Skip to content

AArch64: ldraa/ldrab use wrong pointer authentication diversifier #2275

@droe

Description

@droe

Unicorn based on qemu 5.0 contains a PAuth bug where the "load with pointer authentication" instructions ldraa and ldrab use the stack pointer register as diversifier, when they should be using the zero register. Both sp and xzr are encoded in instructions as register 31, but in the context of authenticated loads, 31 means zxr, not sp.

The issue causes spurious pointer authentication failures for code using ldraa or ldrab with the respective data key enabled, and as such is a showstopper for using Unicorn with data pointer authentication.

I have a regression test and an isolated fix, battle-tested in a real-world project. Landing a fix looks to be complicated right now, due to other changes in flight:

The best course forward is probably to keep this issue open until after qemu 5.1 lands, and then land a regression test separately. In case qemu 5.1 will take long to land, we'd want a fix to land sooner, to unblock the use of PAuth with Unicorn. Happy to provide a PR with the isolated fix plus a regression test in that case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions