This is already permitted in getpeername, and returns EFAULT on Linux
(does not crash the program).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
2718–2722 | it was a pointer to the int int addr_sz; | |
3234 | can you please add some test, e.g. clone compiler-rt/test/sanitizer_common/TestCases/Linux/recv_msg_trunc.cc and remove unnecessary stuff |
Add test
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
2718–2722 | I don't follow. Are you asking for a change to be made here? |
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
2718–2722 | yes |
Fix getsockname prototype
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | ||
---|---|---|
2718–2722 | The function prototype here is wrong; addrlen is actually socklen_t which is a typedef for unsigned. Fixed. |
Crashes on Android https://lab.llvm.org/buildbot/#/builders/77/builds/11119/steps/16/logs/stdio
FAIL: SanitizerCommon-asan-i386-Android :: Linux/get_sock_peer_name.cpp (807 of 1325) ******************** TEST 'SanitizerCommon-asan-i386-Android :: Linux/get_sock_peer_name.cpp' FAILED ******************** Script: -- : 'RUN: at line 4'; /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/android_commands/android_compile.py /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm_build64/bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address --target=i686-linux-android24 --sysroot=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --gcc-toolchain=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64 -B/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -stdlib=libc++ -fuse-ld=lld -ldl /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp -o /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.tmp && /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.tmp 2>&1 -- Exit Code: 134 Command Output (stdout): -- /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp:24: int main(): assertion "connect(fd, reinterpret_cast<const sockaddr *>(&sin), sizeof(sin)) == 0" failed Aborted -- Command Output (stderr): -- + : 'RUN: at line 4' + /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/android_commands/android_compile.py /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm_build64/bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address --target=i686-linux-android24 --sysroot=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot --gcc-toolchain=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64 -B/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/android_ndk/toolchains/llvm/prebuilt/linux-x86_64 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -stdlib=libc++ -fuse-ld=lld -ldl /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/get_sock_peer_name.cpp -o /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.tmp + /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.tmp /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.script: line 1: 14248 Aborted (core dumped) /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/sanitizer_common/asan-i386-Android/Linux/Output/get_sock_peer_name.cpp.tmp 2>&1 -- ********************
it was a pointer to the int int addr_sz;