void __sanitizer_syscall_pre_waitpid(int pid, int *status, int options);
void __sanitizer_syscall_pre_clock_gettime(int clk_id, void *tp);
void __sanitizer_syscall_pre_clock_getres(int clk_id, void *tp);
+void __sanitizer_syscall_pre_read(unsigned int fd, char *buf, size_t count);
void __sanitizer_syscall_post_rt_sigpending(long res, void *p, size_t s);
void __sanitizer_syscall_post_getdents(long res, int fd, void *dirp, int count);
int options);
void __sanitizer_syscall_post_clock_gettime(long res, int clk_id, void *tp);
void __sanitizer_syscall_post_clock_getres(long res, int clk_id, void *tp);
+void __sanitizer_syscall_post_read(long res, unsigned int fd, char *buf, size_t count);
// And now a few syscalls we don't handle yet.
#define __sanitizer_syscall_pre_pwritev(...)
#define __sanitizer_syscall_pre_query_module(...)
#define __sanitizer_syscall_pre_quotactl(...)
-#define __sanitizer_syscall_pre_read(...)
#define __sanitizer_syscall_pre_readahead(...)
#define __sanitizer_syscall_pre_readdir(...)
#define __sanitizer_syscall_pre_readlink(...)
#define __sanitizer_syscall_post_readdir(res, ...)
#define __sanitizer_syscall_post_readlinkat(res, ...)
#define __sanitizer_syscall_post_readlink(res, ...)
-#define __sanitizer_syscall_post_read(res, ...)
#define __sanitizer_syscall_post_readv(res, ...)
#define __sanitizer_syscall_post_reboot(res, ...)
#define __sanitizer_syscall_post_recvfrom(res, ...)
__msan_poison(buf, sizeof(buf));
__sanitizer_syscall_post_clock_gettime(-1, 0, buf);
assert(__msan_test_shadow(buf, sizeof(buf)) == 0);
+
+ __msan_poison(buf, sizeof(buf));
+ __sanitizer_syscall_post_read(5, 42, buf, 10);
+ assert(__msan_test_shadow(buf, sizeof(buf)) == 5);
+
return 0;
}
struct sanitizer_kernel_timespec *tp) {
if (res == 0 && tp) POST_WRITE(tp, sizeof(*tp));
}
+
+PRE_SYSCALL(read)(unsigned int fd, char *buf, uptr count) {
+ if (buf) PRE_WRITE(buf, count);
+}
+
+POST_SYSCALL(read)(long res, unsigned int fd, char *buf, uptr count) {
+ if (res > 0 && buf) POST_WRITE(buf, res);
+}
+
} // extern "C"
#undef PRE_SYSCALL