Skip to content

Conversation

@devnexen
Copy link
Member

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Aug 15, 2025

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

Author: David CARLIER (devnexen)

Changes

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

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc (+17)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 521fc116f2888..5813a86054462 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -143,6 +143,12 @@ struct sanitizer_kernel_sockaddr {
   char sa_data[14];
 };
 
+struct sanitizer_kernel_how_to {
+  u64 flags;
+  u64 mode;
+  u64 resolve;
+};
+
 // Real sigset size is always passed as a syscall argument.
 // Declare it "void" to catch sizeof(kernel_sigset_t).
 typedef void kernel_sigset_t;
@@ -2843,6 +2849,17 @@ PRE_SYSCALL(openat)(long dfd, const void *filename, long flags, long mode) {
 POST_SYSCALL(openat)
 (long res, long dfd, const void *filename, long flags, long mode) {}
 
+PRE_SYSCALL(openat2)(long dfd, const void *filename, const sanitizer_kernel_how_to *how, uptr howlen) {
+  if (filename)
+    PRE_READ(filename,
+             __sanitizer::internal_strlen((const char *)filename) + 1);
+
+  if (how)
+    PRE_READ(how, howlen);
+}
+
+POST_SYSCALL(openat2)(long res, long dfd, const void *filename, const sanitizer_kernel_how_to *how, uptr howlen) {}
+
 PRE_SYSCALL(newfstatat)
 (long dfd, const void *filename, void *statbuf, long flag) {
   if (filename)

@github-actions
Copy link

github-actions bot commented Aug 15, 2025

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

@devnexen devnexen force-pushed the compiler_rt_openat2 branch from bac64e0 to 8bd0dc6 Compare August 15, 2025 17:52
@devnexen devnexen requested a review from mysterymath August 15, 2025 18:02
@mysterymath mysterymath requested review from vitalybuka and removed request for mysterymath August 21, 2025 21:13
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be how_to -> how?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it s neither, it is open_how.

@devnexen devnexen force-pushed the compiler_rt_openat2 branch 2 times, most recently from 1706cfb to 767a7c4 Compare September 6, 2025 01:13
@devnexen devnexen force-pushed the compiler_rt_openat2 branch from 767a7c4 to cc8d88c Compare September 6, 2025 01:19
@devnexen devnexen merged commit d949ac6 into llvm:main Sep 6, 2025
9 checks passed
@devnexen devnexen deleted the compiler_rt_openat2 branch September 6, 2025 01:30
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.

3 participants