Skip to content

Emit AT_SECURE in the auxiliary vector#29

Merged
jserv merged 1 commit into
mainfrom
at-secure
May 11, 2026
Merged

Emit AT_SECURE in the auxiliary vector#29
jserv merged 1 commit into
mainfrom
at-secure

Conversation

@jserv
Copy link
Copy Markdown
Contributor

@jserv jserv commented May 11, 2026

Bionic's __libc_init_AT_SECURE walks the auxv on startup and calls __early_abort when AT_SECURE is missing, so guest binaries linked against Bionic abort immediately under elfuse. glibc and musl tolerate a missing entry, which is why no existing test caught this.

Set the value to zero: elfuse never elevates guest privileges (no setuid/setgid or file-capability emulation), so there is no scenario in which secure-exec mode should be reported as on. Place the entry between AT_EGID and AT_HWCAP2 to match the kernel ordering.

Bump LINUX_STACK_AUXV_WORDS_MAX from 40 to 48: the previous bound sat exactly at the post-fix maximum of 20 entries / 40 words, with zero headroom for future additions.

Add a /proc/self/auxv probe to test-tier-a covering AT_SECURE presence and value. getauxval(3) returns 0 both for absent entries and for AT_SECURE=0, so the test must walk the raw auxv buffer with a partial-read-safe loop to distinguish the two cases.

Close #26


Summary by cubic

Emit AT_SECURE in the auxv with value 0 to prevent Bionic-linked guests from aborting on startup. Also expand auxv capacity and add a test to verify presence and value.

  • Bug Fixes
    • Add AT_SECURE (0) between AT_EGID and AT_HWCAP2 to match kernel ordering.
    • Increase LINUX_STACK_AUXV_WORDS_MAX from 40 to 48 for headroom.
    • Add tier-a test that reads /proc/self/auxv to confirm AT_SECURE is present and zero (handles partial reads and avoids getauxval(3) ambiguity).

Written for commit f9d0e05. Summary will update on new commits.

Bionic's __libc_init_AT_SECURE walks the auxv on startup and calls
__early_abort when AT_SECURE is missing, so guest binaries linked against
Bionic abort immediately under elfuse. glibc and musl tolerate a missing
entry, which is why no existing test caught this.

Set the value to zero: elfuse never elevates guest privileges (no
setuid/setgid or file-capability emulation), so there is no scenario in
which secure-exec mode should be reported as on. Place the entry between
AT_EGID and AT_HWCAP2 to match the kernel ordering.

Bump LINUX_STACK_AUXV_WORDS_MAX from 40 to 48: the previous bound sat
exactly at the post-fix maximum of 20 entries / 40 words, with zero
headroom for future additions.

Add a /proc/self/auxv probe to test-tier-a covering AT_SECURE presence
and value. getauxval(3) returns 0 both for absent entries and for
AT_SECURE=0, so the test must walk the raw auxv buffer with
a partial-read-safe loop to distinguish the two cases.

Reported by Doan Bao Trung <doanbaotrung@gmail.com>

Close #26
@jserv jserv mentioned this pull request May 11, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@jserv jserv merged commit 2c5e651 into main May 11, 2026
5 checks passed
@jserv jserv deleted the at-secure branch May 11, 2026 10:26
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.

Missing AT_SECURE

1 participant