Repository navigation
update-tables: do not silently generate bogus tables - #153
Merged
Merged
Conversation
If list-syscalls fails to compile for an architecture (e.g. for x32 when the x32 glibc headers are not installed), the old table for that architecture is kept, and a message is printed, but the script still exits with 0, so the callers can not tell the tables are incomplete. Keep processing the remaining architectures, but exit with 1 at the end if any table failed to be generated. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The output of "make headers_install" is discarded, and so is its exit status. If it fails, list-syscalls is compiled against the headers installed for the previous architecture, or the host's system headers, silently generating a bogus table. This is common when processing old kernels with a modern toolchain, as these can not build their host tools any more; e.g. with GCC 16, the tables for Linux v3.0 are generated from the host's (v7.x) kernel headers, e.g. listing clone3 for x86_64 and i386. Skip the architecture if its headers can not be installed, keeping its old table as when list-syscalls fails to compile. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
The x32 ABI was added in Linux 3.4. For older kernels, asm/unistd.h does not handle __ILP32__, and provides the x86_64 system calls, so the generated x32 table is the same as the x86_64 one. Only generate the x32 table if the kernel provides asm/unistd_x32.h. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Owner
|
Thanks @kolyshkin for fixes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update-tables.shsilently generates wrong tables in a few cases, which I found while using it to build per-kernel-version tables for libseccomp (seccomp/libseccomp#502):make headers_installfailure is ignored. Its exit status is discarded, solist-syscallsis compiled against the headers installed for the previous architecture, or against the host's system headers. This is common when processing old kernels with a modern toolchain, which can no longer build their host tools. For example, with GCC 16 the v3.0 tables are generated from the host's v7.x headers, soclone3is listed for x86_64 and i386. It also happens regardless of the toolchain for cris in Linux v3.x, whoseheaders_installis broken.With this PR, such an architecture is skipped and its old table is kept, as is already done when
list-syscallsfails to compile.x32 before Linux 3.4. For older kernels
asm/unistd.hdoes not handle__ILP32__, so the generated x32 table is a copy of the x86_64 one.With this PR, the x32 table is only generated if
asm/unistd_x32.hexists.The exit status is always 0. Callers can't tell the tables are incomplete.
With this PR, all the architectures are still processed, but the script exits with 1 at the end if any table could not be generated. The CI workflow installs
libc6-dev-x32, so it is not affected.Tested with:
libc6-dev-x32): v3.3 skips x32; v3.4 generates a proper x32 table (readis1073741824); v3.3 and v3.4 report the cris headers failure; v7.2 exits with 0.