-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
gcc: disable libsanitizer on mips64n32 #228296
Merged
Merged
Conversation
This file contains 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
ghost
mentioned this pull request
Apr 26, 2023
16 tasks
ofborg
bot
added
10.rebuild-darwin: 0
This PR does not cause any packages to rebuild on Darwin
10.rebuild-linux: 0
This PR does not cause any packages to rebuild on Linux
2.status: merge conflict
This PR has merge conflicts with the target branch
and removed
2.status: merge conflict
This PR has merge conflicts with the target branch
labels
Apr 26, 2023
On MIPS, libsanitizer appears to have very detailed knowledge of the Linux system call ABI manually encoded, by hand, into the library. This encoding covers the o32 and 64 abis, but does not cover n32. Adding support for n32 would be a major undertaking. Without adding this encoding, builds of gcc will fail with errors including (but not limited to) the following: ``` In file included from ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:21: ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38: error: static assertion failed 75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat)); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK' 348 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38: note: the comparison reduces to '(144 == 160)' 75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct stat)); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44: note: in definition of macro 'COMPILER_CHECK' 348 | #define COMPILER_CHECK(pred) static_assert(pred, "") | ^~~~ ... In file included from ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:184: ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: In function '__sanitizer::uptr __sanitizer::internal_mmap(void*, uptr, int, int, int, u64)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:19:24: error: '__NR_mmap2' was not declared in this scope 19 | # define SYSCALL(name) __NR_ ## name | ^~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:198:27: note: in expansion of macro 'SYSCALL' 198 | return internal_syscall(SYSCALL(mmap2), addr, length, prot, flags, fd, | ^~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: In function 'void __sanitizer::stat64_to_stat(stat64*, stat*)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:279:23: error: 'struct stat64' has no member named 'st_atim'; did you mean 'st_atime'? 279 | out->st_atime = in->st_atime; | ^~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:280:23: error: 'struct stat64' has no member named 'st_mtim'; did you mean 'st_mtime'? 280 | out->st_mtime = in->st_mtime; | ^~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:281:23: error: 'struct stat64' has no member named 'st_ctim'; did you mean 'st_ctime'? 281 | out->st_ctime = in->st_ctime; | ^~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: In function '__sanitizer::uptr __sanitizer::internal_stat(const char*, void*)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:19:24: error: '__NR_stat64' was not declared in this scope 19 | # define SYSCALL(name) __NR_ ## name | ^~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:353:30: note: in expansion of macro 'SYSCALL' 353 | int res = internal_syscall(SYSCALL(stat64), path, &buf64); | ^~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: In function '__sanitizer::uptr __sanitizer::internal_lstat(const char*, void*)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:19:24: error: '__NR_lstat64' was not declared in this scope 19 | # define SYSCALL(name) __NR_ ## name | ^~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:378:30: note: in expansion of macro 'SYSCALL' 378 | int res = internal_syscall(SYSCALL(lstat64), path, &buf64); | ^~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: In function '__sanitizer::uptr __sanitizer::internal_fstat(fd_t, void*)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_syscall_generic.inc:19:24: error: '__NR_fstat64' was not declared in this scope 19 | # define SYSCALL(name) __NR_ ## name | ^~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:397:30: note: in expansion of macro 'SYSCALL' 397 | int res = internal_syscall(SYSCALL(fstat64), fd, &buf64); | ^~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp: At global scope: ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:303:13: warning: 'void __sanitizer::kernel_stat_to_stat(kernel_stat*, stat*)' defined but not used [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-function-Wunused-function8;;] 303 | static void kernel_stat_to_stat(struct kernel_stat *in, struct stat *out) { | ^~~~~~~~~~~~~~~~~~~ mv -f .deps/sanitizer_mutex.Tpo .deps/sanitizer_mutex.Plo make[4]: *** [Makefile:617: sanitizer_linux.lo] Error 1 mv -f .deps/sancov_flags.Tpo .deps/sancov_flags.Plo ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_posix.cpp: In function '__sanitizer::fd_t __sanitizer::OpenFile(const char*, FileAccessMode, error_t*)': ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_posix.cpp:162:27: warning: 'flags' may be used uninitialized [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmaybe-uninitialized-Wmaybe-uninitialized8;;] 162 | fd_t res = internal_open(filename, flags, 0660); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ ../../../../gcc-12.2.0/libsanitizer/sanitizer_common/sanitizer_posix.cpp:156:7: note: 'flags' was declared here 156 | int flags; | ^~~~~ ```
ghost
marked this pull request as ready for review
April 27, 2023 04:57
alyssais
approved these changes
Apr 30, 2023
figsoda
added
the
12.approvals: 1
This PR was reviewed and approved by one reputable person
label
Apr 30, 2023
ghost
deleted the
pr/gcc/libsanitizer/mips64n32
branch
May 5, 2023 06:54
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
10.rebuild-darwin: 0
This PR does not cause any packages to rebuild on Darwin
10.rebuild-linux: 0
This PR does not cause any packages to rebuild on Linux
12.approvals: 1
This PR was reviewed and approved by one reputable person
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.
Description of changes
On MIPS, libsanitizer appears to have very detailed knowledge of the Linux system call ABI manually encoded, by hand, into the library. This encoding covers the o32 and 64 abis, but does not cover n32. Adding support for n32 would be a major undertaking.
Without adding this encoding, builds of gcc will fail with errors including (but not limited to) the following:
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)