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

aarch64: Save/Restore PAC keys #3569

Closed
wants to merge 1 commit into from
Closed

aarch64: Save/Restore PAC keys #3569

wants to merge 1 commit into from

Conversation

Keno
Copy link
Member

@Keno Keno commented Aug 5, 2023

Should fix #3568.

@Keno
Copy link
Member Author

Keno commented Aug 5, 2023

We'll look into getting a buildkite agent set up on an M1, so we can actually test this.

@Keno
Copy link
Member Author

Keno commented Aug 5, 2023

Seeing the following test failures on an M1 with this PR on Fedora Asahi Remix, so I think it's mostly working:

        1128 - vdso_clock_gettime_stack (Failed)
        1132 - vdso_time_stack (Failed)
        1230 - fork_exec_info_thr (Failed)
        1231 - fork_exec_info_thr-no-syscallbuf (Failed)
        1260 - record_replay (Failed)
        1261 - record_replay-no-syscallbuf (Failed)
        1266 - replay_serve_files (Failed)
        1267 - replay_serve_files-no-syscallbuf (Failed)
        1346 - vfork_done_clone (Failed)
        1347 - vfork_done_clone-no-syscallbuf (Failed)

@Keno
Copy link
Member Author

Keno commented Aug 5, 2023

I guess to fix record_replay, I should add ptrace emulation support for these regsets.

@GitMensch
Copy link
Contributor

GitMensch commented Aug 28, 2023

From the testing that Ben did rr replay chrashes without and works with this PR included - is there anything that needs to be done now or can this be pulled in and follow-up PRs be created for things that are considered to be missing?

@GitMensch
Copy link
Contributor

Friendly ping @Keno to possibly merge as is (existing tests that failed before on aarch64 now pass) and add follow-up PRs if/as necessary.

@Keno
Copy link
Member Author

Keno commented Nov 26, 2023

I was hoping to get the M1 buildkite up, so we can actually test this. Let me follow up on that.

@BenWibking
Copy link

@Keno Just wanted to ping about this. Is the testing infrastructure in place for this now?

@pcc
Copy link
Contributor

pcc commented Apr 17, 2024

Ping; this also fixed my PAC issue.

Note that in addition to the keys themselves, we'll also need to save/restore the key enabled state, which is available via NT_ARM_PAC_ENABLED_KEYS.

@jvoisin
Copy link

jvoisin commented May 12, 2024

Yup, fixing things here as well :)

@eggyal
Copy link

eggyal commented Jul 2, 2024

Is there anything that the community can do to help move this forward?

@pcc
Copy link
Contributor

pcc commented Jul 2, 2024

There are a few known missing aspects of PAC support that I'm aware of:

  • ptrace emulation (needed for rr to run under itself)
  • PR_PAC_SET_ENABLED_KEYS support
  • Support for detecting attempts to replay on incompatible systems. For example, FEAT_FPAC controls the semantics of the AUT* instructions, so a trace captured on a machine without FEAT_FPAC cannot be replayed on a machine with FEAT_FPAC and vice versa. There are also several incompatible signing schemes that would prevent replay on a system that implements a different one (I know of at least 3: two standardized ones and a non-standard one that Apple CPUs implement).

But these are fairly minor features: for 99+% of users who record and replay on the same system, rr will work fine. And if replay fails due to missing PAC support, it will not be obvious what the issue is unless you already know about PAC. So I think this should land as is, and the remaining features can be added in followup changes and the CI support can be added asynchronously. Since there's no PAC support in CI, at worst we introduce a bug that breaks PAC and then we're in the same position as if this patch didn't land.

@rocallahan
Copy link
Collaborator

I merged this with a small tweak to fix the non-ARM builds.

Please file issues for the followup work. Thanks!

@rocallahan rocallahan closed this Jul 4, 2024
@rocallahan rocallahan deleted the kf/pac branch July 4, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aarch64: rr crashes immediately upon replay -e
7 participants