-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add SYS_pidfd_open and SYS_clone3 #1897
Add SYS_pidfd_open and SYS_clone3 #1897
Conversation
r? @JohnTitor (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! :)
@@ -973,6 +973,9 @@ pub const SYS_copy_file_range: ::c_long = 357; | |||
pub const SYS_preadv2: ::c_long = 358; | |||
pub const SYS_pwritev2: ::c_long = 359; | |||
pub const SYS_statx: ::c_long = 360; | |||
pub const SYS_pidfd_open: ::c_long = 434; | |||
// Reserved in the kernel, but not actually implemented yet | |||
pub const SYS_clone3: ::c_long = 435; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, but this is fine since I marked 435
as reserved for all architectures that do not implement clone3()
yet and so you're guaranteed that we don't take that number for another system call!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're in the process of updating our kernel docs where @cyphar and I will add a line like:
+In the past, syscall numbers were completely inconsistent
+between architectures, but a lot of work has gone into trying to unify the
+syscall tables. If you do not wish to enable your syscall on all architectures,
+add a comment to all other architectures' syscall tables to make it clear that
+the number has been reserved for your syscall.
Can you also add |
Indeed. The ones up until 5.8 that are missing are:
|
These syscalls were added recently, and therefore have consistent numbers across different architetures (other than the weird offsetting on some platforms).
c8dff52
to
8e58e82
Compare
|
Ah yeah, I got |
@JohnTitor: Would you prefer separate PRs for additional syscall numbers like |
I'd really like to have these constants available as well. |
I don't mind either way! I'll wait for a few days if you want to add them, but I'll just merge this if you want to use the items added by this PR as soon as possible. |
Closing and reopening to kick CI and doublecheck this. |
I'm going to go ahead and merge this, since further additions can easily happen via further PRs, and since there's active work going on in rust-lang/rust that may end up using this. |
Add missing SYS_clone3 for linux musl targets In #1897 `SYS_clone3` was added for linux gnu targets. This PR adds the constant for musl targets. rust-lang/rust#81825 is currently blocked on this. `SYS_clone3` is added to the following architectures: - [arm](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/arm/tools/syscall.tbl#L451) - [mips](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/mips/kernel/syscalls/syscall_n32.tbl#L376) - [powerpc](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/powerpc/kernel/syscalls/syscall.tbl#L517) - [x86](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/x86/entry/syscalls/syscall_32.tbl#L442) - aarch64 - [mips64](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/mips/kernel/syscalls/syscall_n64.tbl#L352) - powerpc64 - [x86_64](https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/arch/x86/entry/syscalls/syscall_64.tbl#L359) It was already added for s390x in 88de388. cc `@joshtriplett`
Add more syscall constansts for Linux In #1897 (comment), there was interest in adding constants for recently added Linux syscalls. I went ahead and added consts for syscalls up until (the currently unreleased) Linux 5.12. Here is an overview: | Syscall | NR | since | | ----------------- | --- | ----- | | pidfd_send_signal | 424 | 5.1 | | io_uring_setup | 425 | 5.1 | | io_uring_enter | 426 | 5.1 | | io_uring_register | 427 | 5.1 | | open_tree | 428 | 5.2 | | move_mount | 429 | 5.2 | | fsopen | 430 | 5.2 | | fsconfig | 431 | 5.2 | | fsmount | 432 | 5.2 | | fspick | 433 | 5.2 | | pidfd_open | 434 | 5.3 | | clone3 | 435 | 5.3 | | close_range | 436 | 5.9 | | openat2 | 437 | 5.9 | | pidfd_getfd | 438 | 5.9 | | faccessat2 | 439 | 5.9 | | process_madvise | 440 | 5.10 | | epoll_pwait2 | 441 | 5.11 | | mount_setattr | 442 | 5.12 | ([source](https://github.com/torvalds/linux/blob/1e28eed17697bcf343c6743f0028cc3b5dd88bf0/include/uapi/asm-generic/unistd.h#L825-L865)) The constants are added for `-gnu` and `-musl` targets. I'm unsure to what extend they are actually present in the headers of these libraries. Support is added for all architectures except hexagon.
Add more syscall constansts for Linux In #1897 (comment), there was interest in adding constants for recently added Linux syscalls. I went ahead and added consts for syscalls up until (the currently unreleased) Linux 5.12. Here is an overview: | Syscall | NR | since | | ----------------- | --- | ----- | | pidfd_send_signal | 424 | 5.1 | | io_uring_setup | 425 | 5.1 | | io_uring_enter | 426 | 5.1 | | io_uring_register | 427 | 5.1 | | open_tree | 428 | 5.2 | | move_mount | 429 | 5.2 | | fsopen | 430 | 5.2 | | fsconfig | 431 | 5.2 | | fsmount | 432 | 5.2 | | fspick | 433 | 5.2 | | pidfd_open | 434 | 5.3 | | clone3 | 435 | 5.3 | | close_range | 436 | 5.9 | | openat2 | 437 | 5.9 | | pidfd_getfd | 438 | 5.9 | | faccessat2 | 439 | 5.9 | | process_madvise | 440 | 5.10 | | epoll_pwait2 | 441 | 5.11 | | mount_setattr | 442 | 5.12 | ([source](https://github.com/torvalds/linux/blob/1e28eed17697bcf343c6743f0028cc3b5dd88bf0/include/uapi/asm-generic/unistd.h#L825-L865)) The constants are added for `-gnu` and `-musl` targets. I'm unsure to what extend they are actually present in the headers of these libraries. Support is added for all architectures except hexagon.
These syscalls were added recently, and therefore have consistent
numbers across different architetures (other than the weird offsetting
on some platforms).