-
Notifications
You must be signed in to change notification settings - Fork 191
RFE: Update syscalls.csv to kernel version v7.0-rc7 #485
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
base: main
Are you sure you want to change the base?
Changes from all commits
9e2dcd2
47c429f
fe598f0
a6b1840
3091542
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,105 @@ base, and can be enabled via the "--enable-code-coverage" configure flag and | |
| the "check-code-coverage" make target. Additional details on generating code | ||
| coverage information can be found in the .travis.yml file. | ||
|
|
||
| ## How to Update the syscalls.csv Table | ||
|
|
||
| *** NOTE - This currently can only be done on Ubuntu *** | ||
|
|
||
| 1. Install dependencies | ||
|
|
||
| In addition to the normal libseccomp package dependencies, the following | ||
| packages must also be installed: | ||
| ``` | ||
| apt install libc6-dev-x32 | ||
| ``` | ||
|
|
||
| 1. Download source packages | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the list items are numbered "1." :)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional. Github's Markdown parser converts them into correct numbers when rendered. |
||
|
|
||
| Download the following source packages: | ||
| ``` | ||
| git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git | ||
| git clone https://github.com/hrw/syscalls-table.git | ||
| git clone git@github.com:<yourrepo>/libseccomp.git | ||
| ``` | ||
|
|
||
| 1. Add new kernel version enumerations | ||
|
|
||
| The first line of [src/syscalls.csv](https://github.com/seccomp/libseccomp/blob/main/src/syscalls.csv) | ||
| contains the newest kernel version known by libseccomp. Add new kernel | ||
| version enumerations to the end of the `enum scmp_kver` enumeration in | ||
| [seccomp-kvers.h](https://github.com/seccomp/libseccomp/blob/main/include/seccomp-kvers.h). | ||
|
|
||
| Optional - Add new kernel versions to the `kernel_versions` list in | ||
| [arch-build-kver-tables.py](https://github.com/seccomp/libseccomp/blob/main/src/arch-build-kver-tables.py). | ||
|
|
||
| 1. Build the table(s) of architectures, syscalls, and syscall numbers | ||
|
|
||
| Using the [syscalls-table](https://github.com/hrw/syscalls-table) tool, | ||
| build the tables of architectures, syscalls, and syscall numbers for the | ||
| new kernel versions. | ||
|
|
||
| ``` | ||
| cd libseccomp | ||
| ./src/arch-build-kver-tables.py -d ../syscalls-table -k ../linux -V [Kernel Version(s)] | ||
|
|
||
| # example: | ||
| ./src/arch-build-kver-tables.py -d ../syscalls-table -k ../linux -V 6.14,6.15,6.16,6.17,6.18,6.19,7.0-rc7 | ||
| ``` | ||
|
|
||
| 1. Add the tables to syscalls.csv | ||
|
|
||
| Parse the tables generated in the previous step and add the data to | ||
| syscalls.csv. | ||
|
|
||
| ``` | ||
| ./src/arch-update-syscalls-csv.py -a -d ./ -k ../linux -c src/syscalls.csv -V [Kernel Version(s)] | ||
|
|
||
| # example | ||
| ./src/arch-update-syscalls-csv.py -a -d ./ -k ../linux -c src/syscalls.csv -V 6.14,6.15,6.16,6.17,6.18,6.19,7.0-rc7 | ||
| ``` | ||
|
|
||
| 1. Update seccomp-syscalls.h with new syscalls | ||
|
|
||
| Run `cd src && ./arch-syscall-check` to determine if any new syscalls were | ||
| added and if they require __PNR and/or __SNR definitions. If this tool | ||
| identifies missing definitions, add them to | ||
| [include/seccomp-syscalls.h](https://github.com/seccomp/libseccomp/blob/main/include/seccomp-syscalls.h). [Here](https://github.com/seccomp/libseccomp/commit/f01e67509e45c672f4bdd643d94d90867cc19d90) | ||
| is an example of the syscalls that were added to kernel version v6.12. | ||
|
|
||
|
|
||
| 1. Build the legacy syscalls.csv table (optional but recommended) | ||
|
|
||
| Prior to tracking the kernel version where syscalls were added, libseccomp | ||
| employed internal tools to build the syscalls.csv table. These tools can | ||
| be used to validate the syscall numbers and their architectures. Note that | ||
| they cannot be used to validate the kernel version number. | ||
|
|
||
| ``` | ||
| ./autogen.sh && ./configure --enable-python && make check-build | ||
|
|
||
| cd src | ||
| make arch-syscall-dump | ||
| ./arch-syscall-validate -c syscalls-prev.csv ../../linux/ | ||
| ``` | ||
|
|
||
| 1. Compare CSVs | ||
|
|
||
| Compare the checked-in (HEAD) CSV with the newly-generated syscalls.csv. | ||
| Verify the following: | ||
| * All new syscall names were properly added | ||
| * If a syscall number changed, it should only have transitioned from `PNR` | ||
| to a valid number. If a number changed for an architecture, verify that | ||
| its associated kernel version is correct | ||
| * No syscall rows were deleted | ||
|
|
||
| If you built `syscalls-prev.csv` in the previous step, do the same comparisons | ||
| as outlined above. Again, note that `syscalls-prev.csv` does not contain | ||
| kernel version information, so only the syscall names, syscall numbers, and | ||
| architectures can be verified. | ||
|
|
||
| There are many tools to compare CSVs. This [tool](https://www.textcompare.org/csv/) | ||
| has been especially useful. | ||
|
|
||
| ## Explain Your Work | ||
|
|
||
| At the top of every patch you should include a description of the problem you | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,6 +283,9 @@ | |
| #define __PNR_getpagesize -10249 | ||
| #define __PNR_riscv_hwprobe -10250 | ||
| #define __PNR_uretprobe -10251 | ||
| #define __PNR_uprobe -10252 | ||
| #define __PNR_rseq_slice_yield -10253 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the macros below it looks like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 32-bit s390 isn't getting updates, so it needs |
||
| #define __PNR_listns -10254 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, it looks like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. 32-bit s390 needs it. This is one reason I was tempted to ditch s390 now. The other reason is that syscalls table tool has generated some different syscall numbers from libseccomp's |
||
|
|
||
| /* | ||
| * libseccomp syscall definitions | ||
|
|
@@ -648,6 +651,9 @@ | |
|
|
||
| #define __SNR_fgetxattr __NR_fgetxattr | ||
|
|
||
| #define __SNR_file_getattr __NR_file_getattr | ||
| #define __SNR_file_setattr __NR_file_setattr | ||
|
|
||
| #define __SNR_finit_module __NR_finit_module | ||
|
|
||
| #define __SNR_flistxattr __NR_flistxattr | ||
|
|
@@ -1082,6 +1088,8 @@ | |
|
|
||
| #define __SNR_listmount __NR_listmount | ||
|
|
||
| #define __SNR_listns __NR_listns | ||
|
|
||
| #define __SNR_listxattr __NR_listxattr | ||
|
|
||
| #define __SNR_listxattrat __NR_listxattrat | ||
|
|
@@ -1356,6 +1364,8 @@ | |
| #define __SNR_open_tree __PNR_open_tree | ||
| #endif | ||
|
|
||
| #define __SNR_open_tree_attr __NR_open_tree_attr | ||
|
|
||
| #define __SNR_openat __NR_openat | ||
|
|
||
| #define __SNR_openat2 __NR_openat2 | ||
|
|
@@ -1614,6 +1624,8 @@ | |
| #define __SNR_rseq __PNR_rseq | ||
| #endif | ||
|
|
||
| #define __SNR_rseq_slice_yield __NR_rseq_slice_yield | ||
|
|
||
| #define __SNR_rt_sigaction __NR_rt_sigaction | ||
|
|
||
| #define __SNR_rt_sigpending __NR_rt_sigpending | ||
|
|
@@ -2304,6 +2316,12 @@ | |
|
|
||
| #define __SNR_unshare __NR_unshare | ||
|
|
||
| #ifdef __NR_uprobe | ||
| #define __SNR_uprobe __NR_uprobe | ||
| #else | ||
| #define __SNR_uprobe __PNR_uprobe | ||
| #endif | ||
|
|
||
| #ifdef __NR_uretprobe | ||
| #define __SNR_uretprobe __NR_uretprobe | ||
| #else | ||
|
|
||
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.
Is this just because of the package dependencies in step 1? If so, perhaps we add unordered sub-list there for various distros, e.g. Fedora/RHEL, Arch, etc.