Skip to content

Morello vDSO fixes#27

Open
heshamelmatary wants to merge 2 commits into
codasip-cheri-riscv-7.0from
vdso_fixes
Open

Morello vDSO fixes#27
heshamelmatary wants to merge 2 commits into
codasip-cheri-riscv-7.0from
vdso_fixes

Conversation

@heshamelmatary
Copy link
Copy Markdown
Collaborator

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.

aditya-deshpande-arm and others added 2 commits May 29, 2026 11:59
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>
Copy link
Copy Markdown
Collaborator

@kevin-brodsky-arm kevin-brodsky-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing this?

Comment thread arch/arm64/kernel/vdso.c
mmap_write_unlock(mm);

return ret;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

3 participants