Morello vDSO fixes#27
Open
heshamelmatary wants to merge 2 commits into
Open
Conversation
Map the purecap vDSO into userspace application address space, therefore providing purecap userspace applications a purecap vDSO to use, and provide a capability to it in AT_SYSINFO_EHDR by updating ARCH_DLINFO. Redefine the aarch64 vDSO as the compat vDSO, therefore allowing both regular arm64 and purecap binaries to use a vDSO under PCuABI. Now that the purecap vDSO is mapped in purecap processes, instead of the standard aarch64 vDSO one, we also need to ensure that setup_return() uses the right offset for the sigret trampoline. This is done by including only the appropriate offsets header (which is possible as signal.c is built twice, once for purecap and once for compat64). The bootstrap Morello kselftest is also amended to expect AT_SYSINFO_EHDR to be a valid capability, not a null one. -- CHERI-Linux (Hesham): cherry-picked 21ed9c7 and fixed merge conflits: * Removed VVAR * Aligned with the current purecap-vdso paths and builds -- Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com> Co-developed-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
vdso_u_time_data and vdso_u_rng_data were added after the original Morello port and purecap vDSO support. As a result, purecap users currently fall back to the generic accessors. However, the generic helpers return invalid capabilities because they derive capabilities from zero-sized linker-defined symbols. Implement purecap-specific accessors for these symbols, similar to __arch_get_vdso_data(), so tagged capabilities are returned to purecap userspace by deriving them from the valid vDSO mapping capability (PCC). Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
5093a15 to
d1ab570
Compare
kevin-brodsky-arm
requested changes
Jun 1, 2026
Collaborator
kevin-brodsky-arm
left a comment
There was a problem hiding this comment.
The commit order should be swapped, otherwise the first commit will result in a broken vDSO being mapped.
| extern int purecap_setup_additional_pages(struct linux_binprm *bprm, | ||
| int uses_interp); | ||
| #define arch_setup_additional_pages purecap_setup_additional_pages | ||
| #define ARCH_DLINFO SETUP_DLINFO(current->mm->context.vdso) |
Collaborator
There was a problem hiding this comment.
Would be better to leave a tab between ARCH_DLINFO and SETUP_DLINFO to avoid polluting the diff, like in the original commit.
| #include <generated/vdso-offsets.h> | ||
| #ifdef CONFIG_COMPAT_VDSO | ||
| #include <generated/vdso32-offsets.h> | ||
| #endif |
Collaborator
There was a problem hiding this comment.
Why are we doing this?
| mmap_write_unlock(mm); | ||
|
|
||
| return ret; | ||
| } |
Collaborator
There was a problem hiding this comment.
All of this was basically a copy/paste of the AA64 handlers below. Let's update it accordingly, now that vvar is gone this can be a lot simpler.
enum aarch64_map below should also be removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR brings an original Morello commit that was missed in CHERI-Linux which is required for purecap Morello userspace. Furthermore, it adds a couple of accessors for new vDSO pointers that got introduced after the original Morello port and purecap vDSO was done.