Skip to content

[compiler-rt][sanitizer_common] copy_file_range syscall interception. #125816

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

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Feb 5, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 5, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/125816.diff

2 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc (+20)
  • (added) compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c (+40)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 29fe4721ba40dc..b68b3c2ba86fea 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -3205,6 +3205,26 @@ POST_SYSCALL(futex)
   COMMON_SYSCALL_BLOCKING_END();
 }
 
+PRE_SYSCALL(copy_file_range)
+(int fdin, __sanitizer___kernel_off_t *offin, int fdout, __sanitizer___kernel_off_t *offout, SIZE_T size, unsigned int flags) {
+  if (offin != nullptr) {
+    PRE_READ(offin, sizeof(*offin));
+  }
+  if (offout != nullptr) {
+    PRE_READ(offout, sizeof(*offout));
+  }
+}
+
+POST_SYSCALL(copy_file_range)
+(SSIZE_T, int fdin, __sanitizer___kernel_off_t *offin, int fdout, __sanitizer___kernel_off_t *offout, SIZE_T size, unsigned int flags) {
+  if (offin != nullptr) {
+    POST_WRITE(offin, sizeof(*offin));
+  }
+  if (offout != nullptr) {
+    POST_WRITE(offout, sizeof(*offout));
+  }
+}
+
 }  // extern "C"
 
 #  undef PRE_SYSCALL
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c
new file mode 100644
index 00000000000000..a53e6773cf2892
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c
@@ -0,0 +1,40 @@
+// RUN: %clangxx -O0 %s -o %t
+
+// REQUIRES: glibc
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <assert.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#if !defined(__GLIBC_PREREQ)
+#define __GLIBC_PREREQ(a, b) 0
+#endif
+
+#if !__GLIBC_PREREQ(2, 27)
+#define copy_file_range(a, b, c, d, e) (ssize_t)syscall(__NR_copy_file_range, a, b, c, d, e) 
+#endif
+
+int main(void) {
+  int fdin = open("/proc/self/maps", O_RDONLY);
+  assert(fdin > 0);
+  char tmp[] = "/tmp/map.XXXXXX";
+  int fdout = mkstemp(tmp);
+  assert(fdout > 0);
+  off_t offin = -1, offout = 0;
+  ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
+  assert(cpy < 0);
+  offin = 0;
+  offout = 16;
+  cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
+  assert(cpy < 0);
+  offout = 0;
+  cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
+  assert(cpy == 8);
+  close(fdout);
+  close(fdin);
+  return 0;
+}

Copy link

github-actions bot commented Feb 5, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@devnexen devnexen force-pushed the copy_file_range_sanitizer branch from 2ae9928 to 65131bf Compare February 5, 2025 07:51
@devnexen devnexen force-pushed the copy_file_range_sanitizer branch from 65131bf to 4cd82e3 Compare February 5, 2025 08:05
@devnexen devnexen requested a review from vitalybuka February 22, 2025 07:17
@devnexen devnexen merged commit 5f6a3e6 into llvm:main Feb 27, 2025
7 checks passed
@devnexen
Copy link
Member Author

buildbot issue here. Looking.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 27, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux running on sanitizer-buildbot1 while building compiler-rt at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/10465

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10666 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c (5152 of 10666)
******************** TEST 'SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -m32 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -m32 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:17: error: no matching function for call to 'copy_file_range'
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                 ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:9: error: no matching function for call to 'copy_file_range'
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:9: error: no matching function for call to 'copy_file_range'
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
3 errors generated.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c (5878 of 10666)
******************** TEST 'SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10666 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c (5152 of 10666)
******************** TEST 'SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -m32 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -m32 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:17: error: no matching function for call to 'copy_file_range'
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                 ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:9: error: no matching function for call to 'copy_file_range'
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:9: error: no matching function for call to 'copy_file_range'
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
3 errors generated.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c (5878 of 10666)
******************** TEST 'SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
Step 11 (test compiler-rt debug) failure: test compiler-rt debug (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 4863 of 10649 tests, 88 workers --
Testing:  0.. 10.. 20.. 30..
FAIL: SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c (1878 of 4863)
******************** TEST 'SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=leak  -m32 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-i386-Linux/Linux/Output/copy_file_range.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=leak -m32 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/lsan-i386-Linux/Linux/Output/copy_file_range.c.tmp
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:17: error: no matching function for call to 'copy_file_range'
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                 ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:9: error: no matching function for call to 'copy_file_range'
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:9: error: no matching function for call to 'copy_file_range'
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
3 errors generated.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..

8 warning(s) in tests
Slowest Tests:
--------------------------------------------------------------------------
137.08s: ThreadSanitizer-x86_64 :: deadlock_detector_stress_test.cpp
117.16s: libFuzzer-x86_64-default-Linux :: out-of-process-fuzz.test
Step 14 (test compiler-rt default) failure: test compiler-rt default (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/i386-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:237: warning: Compiler lib dir != compiler-rt lib dir
Compiler libdir:     "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/i386-unknown-linux-gnu"
compiler-rt libdir:  "/home/b/sanitizer-x86_64-linux/build/build_default/lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:248: warning: COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=ON, but this test suite does not support testing the just-built runtime libraries when the test compiler is configured to use different runtime libraries. Either modify this test suite to support this test configuration, or set COMPILER_RT_TEST_STANDALONE_BUILD_LIBS=OFF to test the runtime libraries included in the compiler instead.
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/lit.common.cfg.py:259: note: Testing using libraries in "/home/b/sanitizer-x86_64-linux/build/build_default/./lib/../lib/clang/21/lib/x86_64-unknown-linux-gnu"
llvm-lit: /home/b/sanitizer-x86_64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 10666 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40..
FAIL: SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c (5147 of 10666)
******************** TEST 'SanitizerCommon-asan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -m32 -funwind-tables  -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
+ /home/b/sanitizer-x86_64-linux/build/build_default/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -m32 -funwind-tables -I/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test -ldl -O0 /home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /home/b/sanitizer-x86_64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-i386-Linux/Linux/Output/copy_file_range.c.tmp
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:17: error: no matching function for call to 'copy_file_range'
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                 ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:9: error: no matching function for call to 'copy_file_range'
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
/home/b/sanitizer-x86_64-linux/build/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:9: error: no matching function for call to 'copy_file_range'
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^~~~~~~~~~~~~~~
/usr/lib/gcc-cross/i686-linux-gnu/14/../../../../i686-linux-gnu/include/unistd.h:1142:9: note: candidate function not viable: no known conversion from 'off_t *' (aka 'long *') to '__off64_t *' (aka 'long long *') for 2nd argument
 1142 | ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
      |         ^                            ~~~~~~~~~~~~~~~~~~~
3 errors generated.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50
FAIL: SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c (5874 of 10666)
******************** TEST 'SanitizerCommon-lsan-i386-Linux :: Linux/copy_file_range.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--

devnexen added a commit that referenced this pull request Feb 27, 2025
@mysterymath
Copy link
Contributor

This broke the compiler-rt build for the Fuchsia Linux toolchain. This was not fixed by the follow-up patch. Accordingly, I'm issuing a revert.


Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /b/s/w/ir/x/w/llvm_build/./bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -funwind-tables --sysroot=/b/s/w/ir/x/w/cipd/linux  -I/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test -ldl -O0 /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/copy_file_range.c.tmp
+ /b/s/w/ir/x/w/llvm_build/./bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -funwind-tables --sysroot=/b/s/w/ir/x/w/cipd/linux -I/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test -ldl -O0 /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/copy_file_range.c.tmp
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:66: error: too many arguments provided to function-like macro invocation
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                                                                  ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:19:11: note: macro 'copy_file_range' defined here
   19 | #  define copy_file_range(a, b, c, d, e)                                       \
      |           ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:30:17: error: use of undeclared identifier 'copy_file_range'
   30 |   ssize_t cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                 ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:58: error: too many arguments provided to function-like macro invocation
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                                                          ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:19:11: note: macro 'copy_file_range' defined here
   19 | #  define copy_file_range(a, b, c, d, e)                                       \
      |           ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:34:9: error: use of undeclared identifier 'copy_file_range'
   34 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:58: error: too many arguments provided to function-like macro invocation
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |                                                          ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:19:11: note: macro 'copy_file_range' defined here
   19 | #  define copy_file_range(a, b, c, d, e)                                       \
      |           ^
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c:37:9: error: use of undeclared identifier 'copy_file_range'
   37 |   cpy = copy_file_range(fdin, &offin, fdout, &offout, 8, 0);
      |         ^
6 errors generated.

mysterymath added a commit that referenced this pull request Feb 27, 2025
…ception. (#125816)" and fix

This reverts commit 7521207.
This reverts commit 5f6a3e6.
@devnexen
Copy link
Member Author

I see ... seems to me it is a matter of missing argument in the macro ?

devnexen added a commit to devnexen/llvm-project that referenced this pull request Feb 27, 2025
@mysterymath
Copy link
Contributor

I see ... seems to me it is a matter of missing argument in the macro ?

Yes, but I wasn't sure what the intended semantics were, otherwise I would have fixed forward.

joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Mar 3, 2025
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants