Skip to content

Disable host PAC via C constructor in ARM64 cgo builds - #16911

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl1013107881
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test/cl1013107881

Conversation

@copybara-service

Copy link
Copy Markdown

Disable host PAC via C constructor in ARM64 cgo builds

In cgo builds, syscall.AllThreadsSyscall6 is unsupported and returns
ENOTSUP because libc manages thread creation and signal masks.

In such cases use a simple work-around by introducing an ELF .init_array C
constructor to disable PAC before the Go runtime or pthread spawns any
threads. All subsequently cloned threads inherit the disabled PAC key state
from the initial thread.

New pkg is named cgoextras to denote it as a collection of such hacks.

@copybara-service copybara-service Bot added the exported Issue was exported automatically label Nov 3, 2026
@copybara-service
copybara-service Bot force-pushed the test/cl1013107881 branch 3 times, most recently from f5eebdb to f3e15fc Compare November 6, 2026 01:35
In cgo builds, syscall.AllThreadsSyscall6 is unsupported and returns
ENOTSUP because libc manages thread creation and signal masks.

In such cases use a simple work-around by introducing an ELF .init_array C
constructor to disable PAC before the Go runtime or pthread spawns any
threads. All subsequently cloned threads inherit the disabled PAC key state
from the initial thread.

New pkg is named cgoextras to denote it as a collection of such hacks.

PiperOrigin-RevId: 1013107881
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant