Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support aarch64 in walredo seccomp code #3996

Merged
merged 2 commits into from
Apr 11, 2023
Merged

Support aarch64 in walredo seccomp code #3996

merged 2 commits into from
Apr 11, 2023

Conversation

kelvich
Copy link
Contributor

@kelvich kelvich commented Apr 10, 2023

Aarch64 doesn't implement some old syscalls like open and select. Use openat instead of open to check if seccomp is supported. Leave both select and pselect6 in the allowlist since we don't call select syscall directly and may hope that libc will call pselect6 on aarch64.

To check whether some syscall is supported it is possible to use scmp_sys_resolver from seccopm package:

> apt install seccopm
> scmp_sys_resolver -a x86_64 select
23
> scmp_sys_resolver -a aarch64 select
-10101
> scmp_sys_resolver -a aarch64 pselect6
72

Negative value means that syscall is not supported.

Another cross-check is to look up for the actuall syscall table in unistd.h. To resolve all the macroses one can use gcc -E as it is done in dump_sys_aarch64() function in libseccomp/src/arch-syscall-validate.

@kelvich kelvich requested a review from a team as a code owner April 10, 2023 21:15
@kelvich kelvich requested review from MMeent and removed request for a team April 10, 2023 21:15
@kelvich kelvich force-pushed the sk/walredo_aarch64 branch 2 times, most recently from 01965b6 to 6c5a50a Compare April 10, 2023 21:19
@github-actions
Copy link

github-actions bot commented Apr 10, 2023

Test results for 25d8b3b:


debug build: 212 tests run: 202 passed, 0 failed, 10 (full report)


release build: 212 tests run: 202 passed, 0 failed, 10 (full report)


@kelvich kelvich requested a review from hlinnaka April 10, 2023 22:16
@kelvich
Copy link
Contributor Author

kelvich commented Apr 10, 2023

should fix #3852 and #3847

@kelvich kelvich requested a review from knizhnik April 11, 2023 07:10
Copy link
Contributor

@hlinnaka hlinnaka left a comment

Choose a reason for hiding this comment

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

There's comment in the TODO section in seccomp.c:

    • Test on any arch other than amd64 to see if it works there.

Please remove/update that too.

pgxn/neon_walredo/seccomp.c Outdated Show resolved Hide resolved
Aarch64 doesn't implement some old syscalls like open and select. Use
openat instead of open to check if seccomp is supported. Leave both
select and pselect6 in the allowlist since we don't call select syscall
directly and may hope that libc will call pselect6 on aarch64.

To check whether some syscall is supported it is possible to use
`scmp_sys_resolver` from seccopm package:

```
> apt install seccopm
> scmp_sys_resolver -a x86_64 select
23
> scmp_sys_resolver -a aarch64 select
-10101
> scmp_sys_resolver -a aarch64 pselect6
72
```

Negative value means that syscall is not supported.

Another cross-check is to look up for the actuall syscall table
in `unistd.h`. To resolve all the macroses one can use `gcc -E` as
it is done in `dump_sys_aarch64()` function in
libseccomp/src/arch-syscall-validate.
pgxn/neon_walredo/seccomp.c Outdated Show resolved Hide resolved
Co-authored-by: Heikki Linnakangas <heikki@neon.tech>
@kelvich kelvich enabled auto-merge (squash) April 11, 2023 19:21
@kelvich kelvich merged commit 3c9f42a into main Apr 11, 2023
@kelvich kelvich deleted the sk/walredo_aarch64 branch April 11, 2023 19:28
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