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

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 23:48:14 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 79762a10e454f7d966e131ab9109c4444fe976e6 2ae9928809674ebb806a71e61143b6c542ffea10 --extensions inc,c -- compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
index b68b3c2ba8..521fc116f2 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -3206,7 +3206,8 @@ POST_SYSCALL(futex)
 }
 
 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) {
+(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));
   }
@@ -3216,7 +3217,8 @@ PRE_SYSCALL(copy_file_range)
 }
 
 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) {
+(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));
   }
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
index a53e6773cf..3fa309022e 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/copy_file_range.c
@@ -3,7 +3,7 @@
 // REQUIRES: glibc
 
 #ifndef _GNU_SOURCE
-#define _GNU_SOURCE
+#  define _GNU_SOURCE
 #endif
 #include <assert.h>
 #include <fcntl.h>
@@ -11,11 +11,12 @@
 #include <unistd.h>
 
 #if !defined(__GLIBC_PREREQ)
-#define __GLIBC_PREREQ(a, b) 0
+#  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) 
+#  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) {

``````````

</details>


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


More information about the llvm-commits mailing list