mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
[compiler-rt] openat2 syscall interception. (#153846)
This commit is contained in:
@@ -143,6 +143,12 @@ struct sanitizer_kernel_sockaddr {
|
||||
char sa_data[14];
|
||||
};
|
||||
|
||||
struct sanitizer_kernel_open_how {
|
||||
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,18 @@ 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_open_how* 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_open_how* how, uptr howlen) {}
|
||||
|
||||
PRE_SYSCALL(newfstatat)
|
||||
(long dfd, const void *filename, void *statbuf, long flag) {
|
||||
if (filename)
|
||||
|
||||
Reference in New Issue
Block a user