Skip to content

linux_raw: add an opt-in vdso-static-table feature - #1759

Open
Ignalina wants to merge 1 commit into
bytecodealliance:mainfrom
Ignalina:vdso-static-table
Open

Ignalina wants to merge 1 commit into
bytecodealliance:mainfrom
Ignalina:vdso-static-table

Conversation

@Ignalina

@Ignalina Ignalina commented Dec 1, 2026

Copy link
Copy Markdown

With the feature, the vDSO function pointers live in one table, the .rustix_vdso section.
They start null, init writes each at most once (compare-exchange) from the vDSO that
AT_SYSINFO_EHDR names, and nothing else writes them; without a vDSO entry the
system-call fallback is called directly instead of stored. Without the feature nothing changes.

Why: a syscall filter made statically from the binary has to prove every target of an
indirect call, and that needs one provable writer of the vDSO pointers.
We use it in Heimdall, a dynamic per-thread syscall filter: a state machine generated from
a graph of the program (https://www.gunnar.rs/nordisk/heimdall).

With the feature, the vDSO function pointers are statics in their own
section, .rustix_vdso. They start null, init writes each at most once
(compare-exchange) from the vDSO named by AT_SYSINFO_EHDR, and the
system-call fallback is called directly instead of being stored. A static
analysis of the binary can then prove every target of the vDSO calls.

Without the feature nothing changes.
@sunfishcode

Copy link
Copy Markdown
Member

This adds a fair amount of complexity to an already complex piece of code. As an alternative, could users that need to avoid rustix's vDSO code use the use-libc feature instead?

@Ignalina

Ignalina commented Dec 2, 2026

Copy link
Copy Markdown
Author

No. We have no C library. Our libc is c-scape on rustix's linux_raw backend (our fork of Eyra).

We need one writer of the vDSO pointers. Heimdall derives a state machine of the allowed system calls from a graph of the Rust program, so it must know every target of an indirect call.

If the table is too much, a no-vdso feature (plain system calls) is enough for us. I can change the PR to that.

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.

2 participants