1 //===-- sanitizer_common_syscalls.inc ---------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Common syscalls handlers for tools like AddressSanitizer,
10 // ThreadSanitizer, MemorySanitizer, etc.
12 // This file should be included into the tool's interceptor file,
13 // which has to define it's own macros:
14 // COMMON_SYSCALL_PRE_READ_RANGE
15 // Called in prehook for regions that will be read by the kernel and
16 // must be initialized.
17 // COMMON_SYSCALL_PRE_WRITE_RANGE
18 // Called in prehook for regions that will be written to by the kernel
19 // and must be addressable. The actual write range may be smaller than
20 // reported in the prehook. See POST_WRITE_RANGE.
21 // COMMON_SYSCALL_POST_READ_RANGE
22 // Called in posthook for regions that were read by the kernel. Does
23 // not make much sense.
24 // COMMON_SYSCALL_POST_WRITE_RANGE
25 // Called in posthook for regions that were written to by the kernel
26 // and are now initialized.
27 // COMMON_SYSCALL_ACQUIRE(addr)
28 // Acquire memory visibility from addr.
29 // COMMON_SYSCALL_RELEASE(addr)
30 // Release memory visibility to addr.
31 // COMMON_SYSCALL_FD_CLOSE(fd)
32 // Called before closing file descriptor fd.
33 // COMMON_SYSCALL_FD_ACQUIRE(fd)
34 // Acquire memory visibility from fd.
35 // COMMON_SYSCALL_FD_RELEASE(fd)
36 // Release memory visibility to fd.
37 // COMMON_SYSCALL_PRE_FORK()
38 // Called before fork syscall.
39 // COMMON_SYSCALL_POST_FORK(long res)
40 // Called after fork syscall.
41 //===----------------------------------------------------------------------===//
43 #include "sanitizer_platform.h"
46 # include "sanitizer_libc.h"
48 # define PRE_SYSCALL(name) \
49 SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_syscall_pre_impl_##name
50 # define PRE_READ(p, s) COMMON_SYSCALL_PRE_READ_RANGE(p, s)
51 # define PRE_WRITE(p, s) COMMON_SYSCALL_PRE_WRITE_RANGE(p, s)
53 # define POST_SYSCALL(name) \
54 SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_syscall_post_impl_##name
55 # define POST_READ(p, s) COMMON_SYSCALL_POST_READ_RANGE(p, s)
56 # define POST_WRITE(p, s) COMMON_SYSCALL_POST_WRITE_RANGE(p, s)
58 # ifndef COMMON_SYSCALL_ACQUIRE
59 # define COMMON_SYSCALL_ACQUIRE(addr) ((void)(addr))
62 # ifndef COMMON_SYSCALL_RELEASE
63 # define COMMON_SYSCALL_RELEASE(addr) ((void)(addr))
66 # ifndef COMMON_SYSCALL_FD_CLOSE
67 # define COMMON_SYSCALL_FD_CLOSE(fd) ((void)(fd))
70 # ifndef COMMON_SYSCALL_FD_ACQUIRE
71 # define COMMON_SYSCALL_FD_ACQUIRE(fd) ((void)(fd))
74 # ifndef COMMON_SYSCALL_FD_RELEASE
75 # define COMMON_SYSCALL_FD_RELEASE(fd) ((void)(fd))
78 # ifndef COMMON_SYSCALL_PRE_FORK
79 # define COMMON_SYSCALL_PRE_FORK() \
83 # ifndef COMMON_SYSCALL_POST_FORK
84 # define COMMON_SYSCALL_POST_FORK(res) \
88 // FIXME: do some kind of PRE_READ for all syscall arguments (int(s) and such).
91 struct sanitizer_kernel_iovec {
93 unsigned long iov_len;
96 struct sanitizer_kernel_msghdr {
99 struct sanitizer_kernel_iovec *msg_iov;
100 unsigned long msg_iovlen;
102 unsigned long msg_controllen;
106 struct sanitizer_kernel_mmsghdr {
107 struct sanitizer_kernel_msghdr msg_hdr;
111 struct sanitizer_kernel_timespec {
116 struct sanitizer_kernel_timeval {
121 struct sanitizer_kernel_rusage {
122 struct sanitizer_kernel_timeval ru_timeval[2];
126 struct sanitizer_kernel_sockaddr {
127 unsigned short sa_family;
131 // Real sigset size is always passed as a syscall argument.
132 // Declare it "void" to catch sizeof(kernel_sigset_t).
133 typedef void kernel_sigset_t;
135 static void kernel_write_iovec(const __sanitizer_iovec *iovec, SIZE_T iovlen,
137 for (SIZE_T i = 0; i < iovlen && maxlen; ++i) {
138 SSIZE_T sz = Min(iovec[i].iov_len, maxlen);
139 POST_WRITE(iovec[i].iov_base, sz);
144 // This functions uses POST_READ, because it needs to run after syscall to know
145 // the real read range.
146 static void kernel_read_iovec(const __sanitizer_iovec *iovec, SIZE_T iovlen,
148 POST_READ(iovec, sizeof(*iovec) * iovlen);
149 for (SIZE_T i = 0; i < iovlen && maxlen; ++i) {
150 SSIZE_T sz = Min(iovec[i].iov_len, maxlen);
151 POST_READ(iovec[i].iov_base, sz);
156 PRE_SYSCALL(recvmsg)(long sockfd, sanitizer_kernel_msghdr *msg, long flags) {
157 PRE_READ(msg, sizeof(*msg));
160 POST_SYSCALL(recvmsg)
161 (long res, long sockfd, sanitizer_kernel_msghdr *msg, long flags) {
164 for (unsigned long i = 0; i < msg->msg_iovlen; ++i) {
165 POST_WRITE(msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len);
167 POST_WRITE(msg->msg_control, msg->msg_controllen);
172 PRE_SYSCALL(recvmmsg)
173 (long fd, sanitizer_kernel_mmsghdr *msg, long vlen, long flags, void *timeout) {
174 PRE_READ(msg, vlen * sizeof(*msg));
177 POST_SYSCALL(recvmmsg)
178 (long res, long fd, sanitizer_kernel_mmsghdr *msg, long vlen, long flags,
182 for (unsigned long i = 0; i < msg->msg_hdr.msg_iovlen; ++i) {
183 POST_WRITE(msg->msg_hdr.msg_iov[i].iov_base,
184 msg->msg_hdr.msg_iov[i].iov_len);
186 POST_WRITE(msg->msg_hdr.msg_control, msg->msg_hdr.msg_controllen);
187 POST_WRITE(&msg->msg_len, sizeof(msg->msg_len));
190 POST_WRITE(timeout, struct_timespec_sz);
194 PRE_SYSCALL(read)(long fd, void *buf, uptr count) {
196 PRE_WRITE(buf, count);
200 POST_SYSCALL(read)(long res, long fd, void *buf, uptr count) {
201 if (res > 0 && buf) {
202 POST_WRITE(buf, res);
206 PRE_SYSCALL(time)(void *tloc) {}
208 POST_SYSCALL(time)(long res, void *tloc) {
211 POST_WRITE(tloc, sizeof(long));
215 PRE_SYSCALL(stime)(void *tptr) {}
217 POST_SYSCALL(stime)(long res, void *tptr) {
220 POST_WRITE(tptr, sizeof(long));
224 PRE_SYSCALL(gettimeofday)(void *tv, void *tz) {}
226 POST_SYSCALL(gettimeofday)(long res, void *tv, void *tz) {
229 POST_WRITE(tv, timeval_sz);
231 POST_WRITE(tz, struct_timezone_sz);
235 PRE_SYSCALL(settimeofday)(void *tv, void *tz) {}
237 POST_SYSCALL(settimeofday)(long res, void *tv, void *tz) {
240 POST_WRITE(tv, timeval_sz);
242 POST_WRITE(tz, struct_timezone_sz);
246 # if !SANITIZER_ANDROID
247 PRE_SYSCALL(adjtimex)(void *txc_p) {}
249 POST_SYSCALL(adjtimex)(long res, void *txc_p) {
252 POST_WRITE(txc_p, struct_timex_sz);
257 PRE_SYSCALL(times)(void *tbuf) {}
259 POST_SYSCALL(times)(long res, void *tbuf) {
262 POST_WRITE(tbuf, struct_tms_sz);
266 PRE_SYSCALL(gettid)() {}
268 POST_SYSCALL(gettid)(long res) {}
270 PRE_SYSCALL(nanosleep)(void *rqtp, void *rmtp) {}
272 POST_SYSCALL(nanosleep)(long res, void *rqtp, void *rmtp) {
275 POST_WRITE(rqtp, struct_timespec_sz);
277 POST_WRITE(rmtp, struct_timespec_sz);
281 PRE_SYSCALL(alarm)(long seconds) {}
283 POST_SYSCALL(alarm)(long res, long seconds) {}
285 PRE_SYSCALL(getpid)() {}
287 POST_SYSCALL(getpid)(long res) {}
289 PRE_SYSCALL(getppid)() {}
291 POST_SYSCALL(getppid)(long res) {}
293 PRE_SYSCALL(getuid)() {}
295 POST_SYSCALL(getuid)(long res) {}
297 PRE_SYSCALL(geteuid)() {}
299 POST_SYSCALL(geteuid)(long res) {}
301 PRE_SYSCALL(getgid)() {}
303 POST_SYSCALL(getgid)(long res) {}
305 PRE_SYSCALL(getegid)() {}
307 POST_SYSCALL(getegid)(long res) {}
309 PRE_SYSCALL(getresuid)(void *ruid, void *euid, void *suid) {}
311 POST_SYSCALL(getresuid)(long res, void *ruid, void *euid, void *suid) {
314 POST_WRITE(ruid, sizeof(unsigned));
316 POST_WRITE(euid, sizeof(unsigned));
318 POST_WRITE(suid, sizeof(unsigned));
322 PRE_SYSCALL(getresgid)(void *rgid, void *egid, void *sgid) {}
324 POST_SYSCALL(getresgid)(long res, void *rgid, void *egid, void *sgid) {
327 POST_WRITE(rgid, sizeof(unsigned));
329 POST_WRITE(egid, sizeof(unsigned));
331 POST_WRITE(sgid, sizeof(unsigned));
335 PRE_SYSCALL(getpgid)(long pid) {}
337 POST_SYSCALL(getpgid)(long res, long pid) {}
339 PRE_SYSCALL(getpgrp)() {}
341 POST_SYSCALL(getpgrp)(long res) {}
343 PRE_SYSCALL(getsid)(long pid) {}
345 POST_SYSCALL(getsid)(long res, long pid) {}
347 PRE_SYSCALL(getgroups)(long gidsetsize, void *grouplist) {}
349 POST_SYSCALL(getgroups)
350 (long res, long gidsetsize, __sanitizer___kernel_gid_t *grouplist) {
353 POST_WRITE(grouplist, res * sizeof(*grouplist));
357 PRE_SYSCALL(setregid)(long rgid, long egid) {}
359 POST_SYSCALL(setregid)(long res, long rgid, long egid) {}
361 PRE_SYSCALL(setgid)(long gid) {}
363 POST_SYSCALL(setgid)(long res, long gid) {}
365 PRE_SYSCALL(setreuid)(long ruid, long euid) {}
367 POST_SYSCALL(setreuid)(long res, long ruid, long euid) {}
369 PRE_SYSCALL(setuid)(long uid) {}
371 POST_SYSCALL(setuid)(long res, long uid) {}
373 PRE_SYSCALL(setresuid)(long ruid, long euid, long suid) {}
375 POST_SYSCALL(setresuid)(long res, long ruid, long euid, long suid) {}
377 PRE_SYSCALL(setresgid)(long rgid, long egid, long sgid) {}
379 POST_SYSCALL(setresgid)(long res, long rgid, long egid, long sgid) {}
381 PRE_SYSCALL(setfsuid)(long uid) {}
383 POST_SYSCALL(setfsuid)(long res, long uid) {}
385 PRE_SYSCALL(setfsgid)(long gid) {}
387 POST_SYSCALL(setfsgid)(long res, long gid) {}
389 PRE_SYSCALL(setpgid)(long pid, long pgid) {}
391 POST_SYSCALL(setpgid)(long res, long pid, long pgid) {}
393 PRE_SYSCALL(setsid)() {}
395 POST_SYSCALL(setsid)(long res) {}
397 PRE_SYSCALL(setgroups)(long gidsetsize, __sanitizer___kernel_gid_t *grouplist) {
399 POST_WRITE(grouplist, gidsetsize * sizeof(*grouplist));
402 POST_SYSCALL(setgroups)
403 (long res, long gidsetsize, __sanitizer___kernel_gid_t *grouplist) {}
405 PRE_SYSCALL(acct)(const void *name) {
407 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
410 POST_SYSCALL(acct)(long res, const void *name) {}
412 PRE_SYSCALL(capget)(void *header, void *dataptr) {
414 PRE_READ(header, __user_cap_header_struct_sz);
417 POST_SYSCALL(capget)(long res, void *header, void *dataptr) {
420 POST_WRITE(dataptr, __user_cap_data_struct_sz);
423 PRE_SYSCALL(capset)(void *header, const void *data) {
425 PRE_READ(header, __user_cap_header_struct_sz);
427 PRE_READ(data, __user_cap_data_struct_sz);
430 POST_SYSCALL(capset)(long res, void *header, const void *data) {}
432 PRE_SYSCALL(personality)(long personality) {}
434 POST_SYSCALL(personality)(long res, long personality) {}
436 PRE_SYSCALL(sigpending)(void *set) {}
438 POST_SYSCALL(sigpending)(long res, void *set) {
441 POST_WRITE(set, old_sigset_t_sz);
445 PRE_SYSCALL(sigprocmask)(long how, void *set, void *oset) {}
447 POST_SYSCALL(sigprocmask)(long res, long how, void *set, void *oset) {
450 POST_WRITE(set, old_sigset_t_sz);
452 POST_WRITE(oset, old_sigset_t_sz);
456 PRE_SYSCALL(getitimer)(long which, void *value) {}
458 POST_SYSCALL(getitimer)(long res, long which, void *value) {
461 POST_WRITE(value, struct_itimerval_sz);
465 PRE_SYSCALL(setitimer)(long which, void *value, void *ovalue) {}
467 POST_SYSCALL(setitimer)(long res, long which, void *value, void *ovalue) {
470 POST_WRITE(value, struct_itimerval_sz);
472 POST_WRITE(ovalue, struct_itimerval_sz);
476 PRE_SYSCALL(timer_create)
477 (long which_clock, void *timer_event_spec, void *created_timer_id) {}
479 POST_SYSCALL(timer_create)
480 (long res, long which_clock, void *timer_event_spec, void *created_timer_id) {
482 if (timer_event_spec)
483 POST_WRITE(timer_event_spec, struct_sigevent_sz);
484 if (created_timer_id)
485 POST_WRITE(created_timer_id, sizeof(long));
489 PRE_SYSCALL(timer_gettime)(long timer_id, void *setting) {}
491 POST_SYSCALL(timer_gettime)(long res, long timer_id, void *setting) {
494 POST_WRITE(setting, struct_itimerspec_sz);
498 PRE_SYSCALL(timer_getoverrun)(long timer_id) {}
500 POST_SYSCALL(timer_getoverrun)(long res, long timer_id) {}
502 PRE_SYSCALL(timer_settime)
503 (long timer_id, long flags, const void *new_setting, void *old_setting) {
505 PRE_READ(new_setting, struct_itimerspec_sz);
508 POST_SYSCALL(timer_settime)
509 (long res, long timer_id, long flags, const void *new_setting,
513 POST_WRITE(old_setting, struct_itimerspec_sz);
517 PRE_SYSCALL(timer_delete)(long timer_id) {}
519 POST_SYSCALL(timer_delete)(long res, long timer_id) {}
521 PRE_SYSCALL(clock_settime)(long which_clock, const void *tp) {
523 PRE_READ(tp, struct_timespec_sz);
526 POST_SYSCALL(clock_settime)(long res, long which_clock, const void *tp) {}
528 PRE_SYSCALL(clock_gettime)(long which_clock, void *tp) {}
530 POST_SYSCALL(clock_gettime)(long res, long which_clock, void *tp) {
533 POST_WRITE(tp, struct_timespec_sz);
537 # if !SANITIZER_ANDROID
538 PRE_SYSCALL(clock_adjtime)(long which_clock, void *tx) {}
540 POST_SYSCALL(clock_adjtime)(long res, long which_clock, void *tx) {
543 POST_WRITE(tx, struct_timex_sz);
548 PRE_SYSCALL(clock_getres)(long which_clock, void *tp) {}
550 POST_SYSCALL(clock_getres)(long res, long which_clock, void *tp) {
553 POST_WRITE(tp, struct_timespec_sz);
557 PRE_SYSCALL(clock_nanosleep)
558 (long which_clock, long flags, const void *rqtp, void *rmtp) {
560 PRE_READ(rqtp, struct_timespec_sz);
563 POST_SYSCALL(clock_nanosleep)
564 (long res, long which_clock, long flags, const void *rqtp, void *rmtp) {
567 POST_WRITE(rmtp, struct_timespec_sz);
571 PRE_SYSCALL(nice)(long increment) {}
573 POST_SYSCALL(nice)(long res, long increment) {}
575 PRE_SYSCALL(sched_setscheduler)(long pid, long policy, void *param) {}
577 POST_SYSCALL(sched_setscheduler)(long res, long pid, long policy, void *param) {
580 POST_WRITE(param, struct_sched_param_sz);
584 PRE_SYSCALL(sched_setparam)(long pid, void *param) {
586 PRE_READ(param, struct_sched_param_sz);
589 POST_SYSCALL(sched_setparam)(long res, long pid, void *param) {}
591 PRE_SYSCALL(sched_getscheduler)(long pid) {}
593 POST_SYSCALL(sched_getscheduler)(long res, long pid) {}
595 PRE_SYSCALL(sched_getparam)(long pid, void *param) {}
597 POST_SYSCALL(sched_getparam)(long res, long pid, void *param) {
600 POST_WRITE(param, struct_sched_param_sz);
604 PRE_SYSCALL(sched_setaffinity)(long pid, long len, void *user_mask_ptr) {
606 PRE_READ(user_mask_ptr, len);
609 POST_SYSCALL(sched_setaffinity)
610 (long res, long pid, long len, void *user_mask_ptr) {}
612 PRE_SYSCALL(sched_getaffinity)(long pid, long len, void *user_mask_ptr) {}
614 POST_SYSCALL(sched_getaffinity)
615 (long res, long pid, long len, void *user_mask_ptr) {
618 POST_WRITE(user_mask_ptr, len);
622 PRE_SYSCALL(sched_yield)() {}
624 POST_SYSCALL(sched_yield)(long res) {}
626 PRE_SYSCALL(sched_get_priority_max)(long policy) {}
628 POST_SYSCALL(sched_get_priority_max)(long res, long policy) {}
630 PRE_SYSCALL(sched_get_priority_min)(long policy) {}
632 POST_SYSCALL(sched_get_priority_min)(long res, long policy) {}
634 PRE_SYSCALL(sched_rr_get_interval)(long pid, void *interval) {}
636 POST_SYSCALL(sched_rr_get_interval)(long res, long pid, void *interval) {
639 POST_WRITE(interval, struct_timespec_sz);
643 PRE_SYSCALL(setpriority)(long which, long who, long niceval) {}
645 POST_SYSCALL(setpriority)(long res, long which, long who, long niceval) {}
647 PRE_SYSCALL(getpriority)(long which, long who) {}
649 POST_SYSCALL(getpriority)(long res, long which, long who) {}
651 PRE_SYSCALL(shutdown)(long arg0, long arg1) {}
653 POST_SYSCALL(shutdown)(long res, long arg0, long arg1) {}
655 PRE_SYSCALL(reboot)(long magic1, long magic2, long cmd, void *arg) {}
657 POST_SYSCALL(reboot)(long res, long magic1, long magic2, long cmd, void *arg) {}
659 PRE_SYSCALL(restart_syscall)() {}
661 POST_SYSCALL(restart_syscall)(long res) {}
663 PRE_SYSCALL(kexec_load)
664 (long entry, long nr_segments, void *segments, long flags) {}
666 POST_SYSCALL(kexec_load)
667 (long res, long entry, long nr_segments, void *segments, long flags) {
670 POST_WRITE(segments, struct_kexec_segment_sz);
674 PRE_SYSCALL(exit)(long error_code) {}
676 POST_SYSCALL(exit)(long res, long error_code) {}
678 PRE_SYSCALL(exit_group)(long error_code) {}
680 POST_SYSCALL(exit_group)(long res, long error_code) {}
682 PRE_SYSCALL(wait4)(long pid, void *stat_addr, long options, void *ru) {}
685 (long res, long pid, void *stat_addr, long options, void *ru) {
688 POST_WRITE(stat_addr, sizeof(int));
690 POST_WRITE(ru, struct_rusage_sz);
695 (long which, long pid, void *infop, long options, void *ru) {}
698 (long res, long which, long pid, void *infop, long options, void *ru) {
701 POST_WRITE(infop, siginfo_t_sz);
703 POST_WRITE(ru, struct_rusage_sz);
707 PRE_SYSCALL(waitpid)(long pid, void *stat_addr, long options) {}
709 POST_SYSCALL(waitpid)(long res, long pid, void *stat_addr, long options) {
712 POST_WRITE(stat_addr, sizeof(int));
716 PRE_SYSCALL(set_tid_address)(void *tidptr) {}
718 POST_SYSCALL(set_tid_address)(long res, void *tidptr) {
721 POST_WRITE(tidptr, sizeof(int));
725 PRE_SYSCALL(init_module)(void *umod, long len, const void *uargs) {
727 PRE_READ(uargs, __sanitizer::internal_strlen((const char *)uargs) + 1);
730 POST_SYSCALL(init_module)(long res, void *umod, long len, const void *uargs) {}
732 PRE_SYSCALL(delete_module)(const void *name_user, long flags) {
735 __sanitizer::internal_strlen((const char *)name_user) + 1);
738 POST_SYSCALL(delete_module)(long res, const void *name_user, long flags) {}
740 PRE_SYSCALL(rt_sigprocmask)(long how, void *set, void *oset, long sigsetsize) {}
742 POST_SYSCALL(rt_sigprocmask)
743 (long res, long how, kernel_sigset_t *set, kernel_sigset_t *oset,
747 POST_WRITE(set, sigsetsize);
749 POST_WRITE(oset, sigsetsize);
753 PRE_SYSCALL(rt_sigpending)(void *set, long sigsetsize) {}
755 POST_SYSCALL(rt_sigpending)(long res, kernel_sigset_t *set, long sigsetsize) {
758 POST_WRITE(set, sigsetsize);
762 PRE_SYSCALL(rt_sigtimedwait)
763 (const kernel_sigset_t *uthese, void *uinfo, const void *uts, long sigsetsize) {
765 PRE_READ(uthese, sigsetsize);
767 PRE_READ(uts, struct_timespec_sz);
770 POST_SYSCALL(rt_sigtimedwait)
771 (long res, const void *uthese, void *uinfo, const void *uts, long sigsetsize) {
774 POST_WRITE(uinfo, siginfo_t_sz);
778 PRE_SYSCALL(rt_tgsigqueueinfo)(long tgid, long pid, long sig, void *uinfo) {}
780 POST_SYSCALL(rt_tgsigqueueinfo)
781 (long res, long tgid, long pid, long sig, void *uinfo) {
784 POST_WRITE(uinfo, siginfo_t_sz);
788 PRE_SYSCALL(kill)(long pid, long sig) {}
790 POST_SYSCALL(kill)(long res, long pid, long sig) {}
792 PRE_SYSCALL(tgkill)(long tgid, long pid, long sig) {}
794 POST_SYSCALL(tgkill)(long res, long tgid, long pid, long sig) {}
796 PRE_SYSCALL(tkill)(long pid, long sig) {}
798 POST_SYSCALL(tkill)(long res, long pid, long sig) {}
800 PRE_SYSCALL(rt_sigqueueinfo)(long pid, long sig, void *uinfo) {}
802 POST_SYSCALL(rt_sigqueueinfo)(long res, long pid, long sig, void *uinfo) {
805 POST_WRITE(uinfo, siginfo_t_sz);
809 PRE_SYSCALL(sgetmask)() {}
811 POST_SYSCALL(sgetmask)(long res) {}
813 PRE_SYSCALL(ssetmask)(long newmask) {}
815 POST_SYSCALL(ssetmask)(long res, long newmask) {}
817 PRE_SYSCALL(signal)(long sig, long handler) {}
819 POST_SYSCALL(signal)(long res, long sig, long handler) {}
821 PRE_SYSCALL(pause)() {}
823 POST_SYSCALL(pause)(long res) {}
825 PRE_SYSCALL(sync)() {}
827 POST_SYSCALL(sync)(long res) {}
829 PRE_SYSCALL(fsync)(long fd) {}
831 POST_SYSCALL(fsync)(long res, long fd) {}
833 PRE_SYSCALL(fdatasync)(long fd) {}
835 POST_SYSCALL(fdatasync)(long res, long fd) {}
837 PRE_SYSCALL(bdflush)(long func, long data) {}
839 POST_SYSCALL(bdflush)(long res, long func, long data) {}
842 (void *dev_name, void *dir_name, void *type, long flags, void *data) {}
845 (long res, void *dev_name, void *dir_name, void *type, long flags, void *data) {
849 __sanitizer::internal_strlen((const char *)dev_name) + 1);
852 __sanitizer::internal_strlen((const char *)dir_name) + 1);
854 POST_WRITE(type, __sanitizer::internal_strlen((const char *)type) + 1);
858 PRE_SYSCALL(umount)(void *name, long flags) {}
860 POST_SYSCALL(umount)(long res, void *name, long flags) {
863 POST_WRITE(name, __sanitizer::internal_strlen((const char *)name) + 1);
867 PRE_SYSCALL(oldumount)(void *name) {}
869 POST_SYSCALL(oldumount)(long res, void *name) {
872 POST_WRITE(name, __sanitizer::internal_strlen((const char *)name) + 1);
876 PRE_SYSCALL(truncate)(const void *path, long length) {
878 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
881 POST_SYSCALL(truncate)(long res, const void *path, long length) {}
883 PRE_SYSCALL(ftruncate)(long fd, long length) {}
885 POST_SYSCALL(ftruncate)(long res, long fd, long length) {}
887 PRE_SYSCALL(stat)(const void *filename, void *statbuf) {
890 __sanitizer::internal_strlen((const char *)filename) + 1);
893 POST_SYSCALL(stat)(long res, const void *filename, void *statbuf) {
896 POST_WRITE(statbuf, struct___old_kernel_stat_sz);
900 # if !SANITIZER_ANDROID
901 PRE_SYSCALL(statfs)(const void *path, void *buf) {
903 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
906 POST_SYSCALL(statfs)(long res, const void *path, void *buf) {
909 POST_WRITE(buf, struct_statfs_sz);
913 PRE_SYSCALL(statfs64)(const void *path, long sz, void *buf) {
915 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
918 POST_SYSCALL(statfs64)(long res, const void *path, long sz, void *buf) {
921 POST_WRITE(buf, struct_statfs64_sz);
925 PRE_SYSCALL(fstatfs)(long fd, void *buf) {}
927 POST_SYSCALL(fstatfs)(long res, long fd, void *buf) {
930 POST_WRITE(buf, struct_statfs_sz);
934 PRE_SYSCALL(fstatfs64)(long fd, long sz, void *buf) {}
936 POST_SYSCALL(fstatfs64)(long res, long fd, long sz, void *buf) {
939 POST_WRITE(buf, struct_statfs64_sz);
942 # endif // !SANITIZER_ANDROID
944 PRE_SYSCALL(lstat)(const void *filename, void *statbuf) {
947 __sanitizer::internal_strlen((const char *)filename) + 1);
950 POST_SYSCALL(lstat)(long res, const void *filename, void *statbuf) {
953 POST_WRITE(statbuf, struct___old_kernel_stat_sz);
957 PRE_SYSCALL(fstat)(long fd, void *statbuf) {}
959 POST_SYSCALL(fstat)(long res, long fd, void *statbuf) {
962 POST_WRITE(statbuf, struct___old_kernel_stat_sz);
966 PRE_SYSCALL(newstat)(const void *filename, void *statbuf) {
969 __sanitizer::internal_strlen((const char *)filename) + 1);
972 POST_SYSCALL(newstat)(long res, const void *filename, void *statbuf) {
975 POST_WRITE(statbuf, struct_kernel_stat_sz);
979 PRE_SYSCALL(newlstat)(const void *filename, void *statbuf) {
982 __sanitizer::internal_strlen((const char *)filename) + 1);
985 POST_SYSCALL(newlstat)(long res, const void *filename, void *statbuf) {
988 POST_WRITE(statbuf, struct_kernel_stat_sz);
992 PRE_SYSCALL(newfstat)(long fd, void *statbuf) {}
994 POST_SYSCALL(newfstat)(long res, long fd, void *statbuf) {
997 POST_WRITE(statbuf, struct_kernel_stat_sz);
1001 # if !SANITIZER_ANDROID
1002 PRE_SYSCALL(ustat)(long dev, void *ubuf) {}
1004 POST_SYSCALL(ustat)(long res, long dev, void *ubuf) {
1007 POST_WRITE(ubuf, struct_ustat_sz);
1010 # endif // !SANITIZER_ANDROID
1012 PRE_SYSCALL(stat64)(const void *filename, void *statbuf) {
1015 __sanitizer::internal_strlen((const char *)filename) + 1);
1018 POST_SYSCALL(stat64)(long res, const void *filename, void *statbuf) {
1021 POST_WRITE(statbuf, struct_kernel_stat64_sz);
1025 PRE_SYSCALL(fstat64)(long fd, void *statbuf) {}
1027 POST_SYSCALL(fstat64)(long res, long fd, void *statbuf) {
1030 POST_WRITE(statbuf, struct_kernel_stat64_sz);
1034 PRE_SYSCALL(lstat64)(const void *filename, void *statbuf) {
1037 __sanitizer::internal_strlen((const char *)filename) + 1);
1040 POST_SYSCALL(lstat64)(long res, const void *filename, void *statbuf) {
1043 POST_WRITE(statbuf, struct_kernel_stat64_sz);
1047 PRE_SYSCALL(setxattr)
1048 (const void *path, const void *name, const void *value, long size, long flags) {
1050 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1052 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1054 PRE_READ(value, size);
1057 POST_SYSCALL(setxattr)
1058 (long res, const void *path, const void *name, const void *value, long size,
1061 PRE_SYSCALL(lsetxattr)
1062 (const void *path, const void *name, const void *value, long size, long flags) {
1064 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1066 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1068 PRE_READ(value, size);
1071 POST_SYSCALL(lsetxattr)
1072 (long res, const void *path, const void *name, const void *value, long size,
1075 PRE_SYSCALL(fsetxattr)
1076 (long fd, const void *name, const void *value, long size, long flags) {
1078 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1080 PRE_READ(value, size);
1083 POST_SYSCALL(fsetxattr)
1084 (long res, long fd, const void *name, const void *value, long size,
1087 PRE_SYSCALL(getxattr)
1088 (const void *path, const void *name, void *value, long size) {
1090 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1092 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1095 POST_SYSCALL(getxattr)
1096 (long res, const void *path, const void *name, void *value, long size) {
1097 if (size && res > 0) {
1099 POST_WRITE(value, res);
1103 PRE_SYSCALL(lgetxattr)
1104 (const void *path, const void *name, void *value, long size) {
1106 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1108 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1111 POST_SYSCALL(lgetxattr)
1112 (long res, const void *path, const void *name, void *value, long size) {
1113 if (size && res > 0) {
1115 POST_WRITE(value, res);
1119 PRE_SYSCALL(fgetxattr)(long fd, const void *name, void *value, long size) {
1121 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1124 POST_SYSCALL(fgetxattr)
1125 (long res, long fd, const void *name, void *value, long size) {
1126 if (size && res > 0) {
1128 POST_WRITE(value, res);
1132 PRE_SYSCALL(listxattr)(const void *path, void *list, long size) {
1134 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1137 POST_SYSCALL(listxattr)(long res, const void *path, void *list, long size) {
1138 if (size && res > 0) {
1140 POST_WRITE(list, res);
1144 PRE_SYSCALL(llistxattr)(const void *path, void *list, long size) {
1146 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1149 POST_SYSCALL(llistxattr)(long res, const void *path, void *list, long size) {
1150 if (size && res > 0) {
1152 POST_WRITE(list, res);
1156 PRE_SYSCALL(flistxattr)(long fd, void *list, long size) {}
1158 POST_SYSCALL(flistxattr)(long res, long fd, void *list, long size) {
1159 if (size && res > 0) {
1161 POST_WRITE(list, res);
1165 PRE_SYSCALL(removexattr)(const void *path, const void *name) {
1167 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1169 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1172 POST_SYSCALL(removexattr)(long res, const void *path, const void *name) {}
1174 PRE_SYSCALL(lremovexattr)(const void *path, const void *name) {
1176 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1178 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1181 POST_SYSCALL(lremovexattr)(long res, const void *path, const void *name) {}
1183 PRE_SYSCALL(fremovexattr)(long fd, const void *name) {
1185 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
1188 POST_SYSCALL(fremovexattr)(long res, long fd, const void *name) {}
1190 PRE_SYSCALL(brk)(long brk) {}
1192 POST_SYSCALL(brk)(long res, long brk) {}
1194 PRE_SYSCALL(mprotect)(long start, long len, long prot) {}
1196 POST_SYSCALL(mprotect)(long res, long start, long len, long prot) {}
1199 (long addr, long old_len, long new_len, long flags, long new_addr) {}
1201 POST_SYSCALL(mremap)
1202 (long res, long addr, long old_len, long new_len, long flags, long new_addr) {}
1204 PRE_SYSCALL(remap_file_pages)
1205 (long start, long size, long prot, long pgoff, long flags) {}
1207 POST_SYSCALL(remap_file_pages)
1208 (long res, long start, long size, long prot, long pgoff, long flags) {}
1210 PRE_SYSCALL(msync)(long start, long len, long flags) {}
1212 POST_SYSCALL(msync)(long res, long start, long len, long flags) {}
1214 PRE_SYSCALL(munmap)(long addr, long len) {}
1216 POST_SYSCALL(munmap)(long res, long addr, long len) {}
1218 PRE_SYSCALL(mlock)(long start, long len) {}
1220 POST_SYSCALL(mlock)(long res, long start, long len) {}
1222 PRE_SYSCALL(munlock)(long start, long len) {}
1224 POST_SYSCALL(munlock)(long res, long start, long len) {}
1226 PRE_SYSCALL(mlockall)(long flags) {}
1228 POST_SYSCALL(mlockall)(long res, long flags) {}
1230 PRE_SYSCALL(munlockall)() {}
1232 POST_SYSCALL(munlockall)(long res) {}
1234 PRE_SYSCALL(madvise)(long start, long len, long behavior) {}
1236 POST_SYSCALL(madvise)(long res, long start, long len, long behavior) {}
1238 PRE_SYSCALL(mincore)(long start, long len, void *vec) {}
1240 POST_SYSCALL(mincore)(long res, long start, long len, void *vec) {
1243 POST_WRITE(vec, (len + GetPageSizeCached() - 1) / GetPageSizeCached());
1248 PRE_SYSCALL(pivot_root)(const void *new_root, const void *put_old) {
1251 __sanitizer::internal_strlen((const char *)new_root) + 1);
1253 PRE_READ(put_old, __sanitizer::internal_strlen((const char *)put_old) + 1);
1256 POST_SYSCALL(pivot_root)(long res, const void *new_root, const void *put_old) {}
1258 PRE_SYSCALL(chroot)(const void *filename) {
1261 __sanitizer::internal_strlen((const char *)filename) + 1);
1264 POST_SYSCALL(chroot)(long res, const void *filename) {}
1266 PRE_SYSCALL(mknod)(const void *filename, long mode, long dev) {
1269 __sanitizer::internal_strlen((const char *)filename) + 1);
1272 POST_SYSCALL(mknod)(long res, const void *filename, long mode, long dev) {}
1274 PRE_SYSCALL(link)(const void *oldname, const void *newname) {
1276 PRE_READ(oldname, __sanitizer::internal_strlen((const char *)oldname) + 1);
1278 PRE_READ(newname, __sanitizer::internal_strlen((const char *)newname) + 1);
1281 POST_SYSCALL(link)(long res, const void *oldname, const void *newname) {}
1283 PRE_SYSCALL(symlink)(const void *old, const void *new_) {
1285 PRE_READ(old, __sanitizer::internal_strlen((const char *)old) + 1);
1287 PRE_READ(new_, __sanitizer::internal_strlen((const char *)new_) + 1);
1290 POST_SYSCALL(symlink)(long res, const void *old, const void *new_) {}
1292 PRE_SYSCALL(unlink)(const void *pathname) {
1295 __sanitizer::internal_strlen((const char *)pathname) + 1);
1298 POST_SYSCALL(unlink)(long res, const void *pathname) {}
1300 PRE_SYSCALL(rename)(const void *oldname, const void *newname) {
1302 PRE_READ(oldname, __sanitizer::internal_strlen((const char *)oldname) + 1);
1304 PRE_READ(newname, __sanitizer::internal_strlen((const char *)newname) + 1);
1307 POST_SYSCALL(rename)(long res, const void *oldname, const void *newname) {}
1309 PRE_SYSCALL(chmod)(const void *filename, long mode) {
1312 __sanitizer::internal_strlen((const char *)filename) + 1);
1315 POST_SYSCALL(chmod)(long res, const void *filename, long mode) {}
1317 PRE_SYSCALL(fchmod)(long fd, long mode) {}
1319 POST_SYSCALL(fchmod)(long res, long fd, long mode) {}
1321 PRE_SYSCALL(fcntl)(long fd, long cmd, long arg) {}
1323 POST_SYSCALL(fcntl)(long res, long fd, long cmd, long arg) {}
1325 PRE_SYSCALL(fcntl64)(long fd, long cmd, long arg) {}
1327 POST_SYSCALL(fcntl64)(long res, long fd, long cmd, long arg) {}
1329 PRE_SYSCALL(pipe)(void *fildes) {}
1331 POST_SYSCALL(pipe)(long res, void *fildes) {
1334 POST_WRITE(fildes, sizeof(int) * 2);
1337 PRE_SYSCALL(pipe2)(void *fildes, long flags) {}
1339 POST_SYSCALL(pipe2)(long res, void *fildes, long flags) {
1342 POST_WRITE(fildes, sizeof(int) * 2);
1345 PRE_SYSCALL(dup)(long fildes) {}
1347 POST_SYSCALL(dup)(long res, long fildes) {}
1349 PRE_SYSCALL(dup2)(long oldfd, long newfd) {}
1351 POST_SYSCALL(dup2)(long res, long oldfd, long newfd) {}
1353 PRE_SYSCALL(dup3)(long oldfd, long newfd, long flags) {}
1355 POST_SYSCALL(dup3)(long res, long oldfd, long newfd, long flags) {}
1357 PRE_SYSCALL(ioperm)(long from, long num, long on) {}
1359 POST_SYSCALL(ioperm)(long res, long from, long num, long on) {}
1361 PRE_SYSCALL(ioctl)(long fd, long cmd, long arg) {}
1363 POST_SYSCALL(ioctl)(long res, long fd, long cmd, long arg) {}
1365 PRE_SYSCALL(flock)(long fd, long cmd) {}
1367 POST_SYSCALL(flock)(long res, long fd, long cmd) {}
1369 PRE_SYSCALL(io_setup)(long nr_reqs, void **ctx) {
1371 PRE_WRITE(ctx, sizeof(*ctx));
1374 POST_SYSCALL(io_setup)(long res, long nr_reqs, void **ctx) {
1377 POST_WRITE(ctx, sizeof(*ctx));
1378 // (*ctx) is actually a pointer to a kernel mapped page, and there are
1379 // people out there who are crazy enough to peek into that page's 32-byte
1382 POST_WRITE(*ctx, 32);
1386 PRE_SYSCALL(io_destroy)(long ctx) {}
1388 POST_SYSCALL(io_destroy)(long res, long ctx) {}
1390 PRE_SYSCALL(io_getevents)
1391 (long ctx_id, long min_nr, long nr, __sanitizer_io_event *ioevpp,
1394 PRE_READ(timeout, struct_timespec_sz);
1397 POST_SYSCALL(io_getevents)
1398 (long res, long ctx_id, long min_nr, long nr, __sanitizer_io_event *ioevpp,
1402 POST_WRITE(ioevpp, res * sizeof(*ioevpp));
1404 POST_WRITE(timeout, struct_timespec_sz);
1406 for (long i = 0; i < res; i++) {
1407 // We synchronize io_submit -> io_getevents/io_cancel using the
1408 // user-provided data context. Data is not necessary a pointer, it can be
1409 // an int, 0 or whatever; acquire/release will correctly handle this.
1410 // This scheme can lead to false negatives, e.g. when all operations
1411 // synchronize on 0. But there does not seem to be a better solution
1412 // (except wrapping all operations in own context, which is unreliable).
1413 // We can not reliably extract fildes in io_getevents.
1414 COMMON_SYSCALL_ACQUIRE((void *)ioevpp[i].data);
1418 PRE_SYSCALL(io_submit)(long ctx_id, long nr, __sanitizer_iocb **iocbpp) {
1419 for (long i = 0; i < nr; ++i) {
1420 uptr op = iocbpp[i]->aio_lio_opcode;
1421 void *data = (void *)iocbpp[i]->aio_data;
1422 void *buf = (void *)iocbpp[i]->aio_buf;
1423 uptr len = (uptr)iocbpp[i]->aio_nbytes;
1424 if (op == iocb_cmd_pwrite && buf && len) {
1426 } else if (op == iocb_cmd_pread && buf && len) {
1427 POST_WRITE(buf, len);
1428 } else if (op == iocb_cmd_pwritev) {
1429 __sanitizer_iovec *iovec = (__sanitizer_iovec *)buf;
1430 for (uptr v = 0; v < len; v++)
1431 PRE_READ(iovec[v].iov_base, iovec[v].iov_len);
1432 } else if (op == iocb_cmd_preadv) {
1433 __sanitizer_iovec *iovec = (__sanitizer_iovec *)buf;
1434 for (uptr v = 0; v < len; v++)
1435 POST_WRITE(iovec[v].iov_base, iovec[v].iov_len);
1437 // See comment in io_getevents.
1438 COMMON_SYSCALL_RELEASE(data);
1442 POST_SYSCALL(io_submit)
1443 (long res, long ctx_id, long nr, __sanitizer_iocb **iocbpp) {}
1445 PRE_SYSCALL(io_cancel)
1446 (long ctx_id, __sanitizer_iocb *iocb, __sanitizer_io_event *result) {}
1448 POST_SYSCALL(io_cancel)
1449 (long res, long ctx_id, __sanitizer_iocb *iocb, __sanitizer_io_event *result) {
1452 // See comment in io_getevents.
1453 COMMON_SYSCALL_ACQUIRE((void *)result->data);
1454 POST_WRITE(result, sizeof(*result));
1457 POST_WRITE(iocb, sizeof(*iocb));
1461 PRE_SYSCALL(sendfile)(long out_fd, long in_fd, void *offset, long count) {}
1463 POST_SYSCALL(sendfile)
1464 (long res, long out_fd, long in_fd, __sanitizer___kernel_off_t *offset,
1468 POST_WRITE(offset, sizeof(*offset));
1472 PRE_SYSCALL(sendfile64)(long out_fd, long in_fd, void *offset, long count) {}
1474 POST_SYSCALL(sendfile64)
1475 (long res, long out_fd, long in_fd, __sanitizer___kernel_loff_t *offset,
1479 POST_WRITE(offset, sizeof(*offset));
1483 PRE_SYSCALL(readlink)(const void *path, void *buf, long bufsiz) {
1485 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
1488 POST_SYSCALL(readlink)(long res, const void *path, void *buf, long bufsiz) {
1491 POST_WRITE(buf, __sanitizer::internal_strlen((const char *)buf) + 1);
1495 PRE_SYSCALL(creat)(const void *pathname, long mode) {
1498 __sanitizer::internal_strlen((const char *)pathname) + 1);
1501 POST_SYSCALL(creat)(long res, const void *pathname, long mode) {}
1503 PRE_SYSCALL(open)(const void *filename, long flags, long mode) {
1506 __sanitizer::internal_strlen((const char *)filename) + 1);
1509 POST_SYSCALL(open)(long res, const void *filename, long flags, long mode) {}
1511 PRE_SYSCALL(close)(long fd) { COMMON_SYSCALL_FD_CLOSE((int)fd); }
1513 POST_SYSCALL(close)(long res, long fd) {}
1515 PRE_SYSCALL(access)(const void *filename, long mode) {
1518 __sanitizer::internal_strlen((const char *)filename) + 1);
1521 POST_SYSCALL(access)(long res, const void *filename, long mode) {}
1523 PRE_SYSCALL(vhangup)() {}
1525 POST_SYSCALL(vhangup)(long res) {}
1527 PRE_SYSCALL(chown)(const void *filename, long user, long group) {
1530 __sanitizer::internal_strlen((const char *)filename) + 1);
1533 POST_SYSCALL(chown)(long res, const void *filename, long user, long group) {}
1535 PRE_SYSCALL(lchown)(const void *filename, long user, long group) {
1538 __sanitizer::internal_strlen((const char *)filename) + 1);
1541 POST_SYSCALL(lchown)(long res, const void *filename, long user, long group) {}
1543 PRE_SYSCALL(fchown)(long fd, long user, long group) {}
1545 POST_SYSCALL(fchown)(long res, long fd, long user, long group) {}
1547 # if SANITIZER_USES_UID16_SYSCALLS
1548 PRE_SYSCALL(chown16)(const void *filename, long user, long group) {
1551 __sanitizer::internal_strlen((const char *)filename) + 1);
1554 POST_SYSCALL(chown16)(long res, const void *filename, long user, long group) {}
1556 PRE_SYSCALL(lchown16)(const void *filename, long user, long group) {
1559 __sanitizer::internal_strlen((const char *)filename) + 1);
1562 POST_SYSCALL(lchown16)(long res, const void *filename, long user, long group) {}
1564 PRE_SYSCALL(fchown16)(long fd, long user, long group) {}
1566 POST_SYSCALL(fchown16)(long res, long fd, long user, long group) {}
1568 PRE_SYSCALL(setregid16)(long rgid, long egid) {}
1570 POST_SYSCALL(setregid16)(long res, long rgid, long egid) {}
1572 PRE_SYSCALL(setgid16)(long gid) {}
1574 POST_SYSCALL(setgid16)(long res, long gid) {}
1576 PRE_SYSCALL(setreuid16)(long ruid, long euid) {}
1578 POST_SYSCALL(setreuid16)(long res, long ruid, long euid) {}
1580 PRE_SYSCALL(setuid16)(long uid) {}
1582 POST_SYSCALL(setuid16)(long res, long uid) {}
1584 PRE_SYSCALL(setresuid16)(long ruid, long euid, long suid) {}
1586 POST_SYSCALL(setresuid16)(long res, long ruid, long euid, long suid) {}
1588 PRE_SYSCALL(getresuid16)(void *ruid, void *euid, void *suid) {}
1590 POST_SYSCALL(getresuid16)
1591 (long res, __sanitizer___kernel_old_uid_t *ruid,
1592 __sanitizer___kernel_old_uid_t *euid, __sanitizer___kernel_old_uid_t *suid) {
1595 POST_WRITE(ruid, sizeof(*ruid));
1597 POST_WRITE(euid, sizeof(*euid));
1599 POST_WRITE(suid, sizeof(*suid));
1603 PRE_SYSCALL(setresgid16)(long rgid, long egid, long sgid) {}
1605 POST_SYSCALL(setresgid16)(long res, long rgid, long egid, long sgid) {}
1607 PRE_SYSCALL(getresgid16)(void *rgid, void *egid, void *sgid) {}
1609 POST_SYSCALL(getresgid16)
1610 (long res, __sanitizer___kernel_old_gid_t *rgid,
1611 __sanitizer___kernel_old_gid_t *egid, __sanitizer___kernel_old_gid_t *sgid) {
1614 POST_WRITE(rgid, sizeof(*rgid));
1616 POST_WRITE(egid, sizeof(*egid));
1618 POST_WRITE(sgid, sizeof(*sgid));
1622 PRE_SYSCALL(setfsuid16)(long uid) {}
1624 POST_SYSCALL(setfsuid16)(long res, long uid) {}
1626 PRE_SYSCALL(setfsgid16)(long gid) {}
1628 POST_SYSCALL(setfsgid16)(long res, long gid) {}
1630 PRE_SYSCALL(getgroups16)
1631 (long gidsetsize, __sanitizer___kernel_old_gid_t *grouplist) {}
1633 POST_SYSCALL(getgroups16)
1634 (long res, long gidsetsize, __sanitizer___kernel_old_gid_t *grouplist) {
1637 POST_WRITE(grouplist, res * sizeof(*grouplist));
1641 PRE_SYSCALL(setgroups16)
1642 (long gidsetsize, __sanitizer___kernel_old_gid_t *grouplist) {
1644 POST_WRITE(grouplist, gidsetsize * sizeof(*grouplist));
1647 POST_SYSCALL(setgroups16)
1648 (long res, long gidsetsize, __sanitizer___kernel_old_gid_t *grouplist) {}
1650 PRE_SYSCALL(getuid16)() {}
1652 POST_SYSCALL(getuid16)(long res) {}
1654 PRE_SYSCALL(geteuid16)() {}
1656 POST_SYSCALL(geteuid16)(long res) {}
1658 PRE_SYSCALL(getgid16)() {}
1660 POST_SYSCALL(getgid16)(long res) {}
1662 PRE_SYSCALL(getegid16)() {}
1664 POST_SYSCALL(getegid16)(long res) {}
1665 # endif // SANITIZER_USES_UID16_SYSCALLS
1667 PRE_SYSCALL(utime)(void *filename, void *times) {}
1669 POST_SYSCALL(utime)(long res, void *filename, void *times) {
1672 POST_WRITE(filename,
1673 __sanitizer::internal_strlen((const char *)filename) + 1);
1675 POST_WRITE(times, struct_utimbuf_sz);
1679 PRE_SYSCALL(utimes)(void *filename, void *utimes) {}
1681 POST_SYSCALL(utimes)(long res, void *filename, void *utimes) {
1684 POST_WRITE(filename,
1685 __sanitizer::internal_strlen((const char *)filename) + 1);
1687 POST_WRITE(utimes, timeval_sz);
1691 PRE_SYSCALL(lseek)(long fd, long offset, long origin) {}
1693 POST_SYSCALL(lseek)(long res, long fd, long offset, long origin) {}
1696 (long fd, long offset_high, long offset_low, void *result, long origin) {}
1698 POST_SYSCALL(llseek)
1699 (long res, long fd, long offset_high, long offset_low, void *result,
1703 POST_WRITE(result, sizeof(long long));
1707 PRE_SYSCALL(readv)(long fd, const __sanitizer_iovec *vec, long vlen) {}
1710 (long res, long fd, const __sanitizer_iovec *vec, long vlen) {
1713 kernel_write_iovec(vec, vlen, res);
1717 PRE_SYSCALL(write)(long fd, const void *buf, long count) {
1719 PRE_READ(buf, count);
1722 POST_SYSCALL(write)(long res, long fd, const void *buf, long count) {}
1724 PRE_SYSCALL(writev)(long fd, const __sanitizer_iovec *vec, long vlen) {}
1726 POST_SYSCALL(writev)
1727 (long res, long fd, const __sanitizer_iovec *vec, long vlen) {
1730 kernel_read_iovec(vec, vlen, res);
1735 PRE_SYSCALL(pread64)(long fd, void *buf, long count, long pos) {}
1737 POST_SYSCALL(pread64)(long res, long fd, void *buf, long count, long pos) {
1740 POST_WRITE(buf, res);
1744 PRE_SYSCALL(pwrite64)(long fd, const void *buf, long count, long pos) {
1746 PRE_READ(buf, count);
1749 POST_SYSCALL(pwrite64)
1750 (long res, long fd, const void *buf, long count, long pos) {}
1752 PRE_SYSCALL(pread64)(long fd, void *buf, long count, long pos0, long pos1) {}
1754 POST_SYSCALL(pread64)
1755 (long res, long fd, void *buf, long count, long pos0, long pos1) {
1758 POST_WRITE(buf, res);
1762 PRE_SYSCALL(pwrite64)
1763 (long fd, const void *buf, long count, long pos0, long pos1) {
1765 PRE_READ(buf, count);
1768 POST_SYSCALL(pwrite64)
1769 (long res, long fd, const void *buf, long count, long pos0, long pos1) {}
1773 (long fd, const __sanitizer_iovec *vec, long vlen, long pos_l, long pos_h) {}
1775 POST_SYSCALL(preadv)
1776 (long res, long fd, const __sanitizer_iovec *vec, long vlen, long pos_l,
1780 kernel_write_iovec(vec, vlen, res);
1784 PRE_SYSCALL(pwritev)
1785 (long fd, const __sanitizer_iovec *vec, long vlen, long pos_l, long pos_h) {}
1787 POST_SYSCALL(pwritev)
1788 (long res, long fd, const __sanitizer_iovec *vec, long vlen, long pos_l,
1792 kernel_read_iovec(vec, vlen, res);
1796 PRE_SYSCALL(getcwd)(void *buf, long size) {}
1798 POST_SYSCALL(getcwd)(long res, void *buf, long size) {
1801 POST_WRITE(buf, __sanitizer::internal_strlen((const char *)buf) + 1);
1805 PRE_SYSCALL(mkdir)(const void *pathname, long mode) {
1808 __sanitizer::internal_strlen((const char *)pathname) + 1);
1811 POST_SYSCALL(mkdir)(long res, const void *pathname, long mode) {}
1813 PRE_SYSCALL(chdir)(const void *filename) {
1816 __sanitizer::internal_strlen((const char *)filename) + 1);
1819 POST_SYSCALL(chdir)(long res, const void *filename) {}
1821 PRE_SYSCALL(fchdir)(long fd) {}
1823 POST_SYSCALL(fchdir)(long res, long fd) {}
1825 PRE_SYSCALL(rmdir)(const void *pathname) {
1828 __sanitizer::internal_strlen((const char *)pathname) + 1);
1831 POST_SYSCALL(rmdir)(long res, const void *pathname) {}
1833 PRE_SYSCALL(lookup_dcookie)(u64 cookie64, void *buf, long len) {}
1835 POST_SYSCALL(lookup_dcookie)(long res, u64 cookie64, void *buf, long len) {
1838 POST_WRITE(buf, __sanitizer::internal_strlen((const char *)buf) + 1);
1842 PRE_SYSCALL(quotactl)(long cmd, const void *special, long id, void *addr) {
1844 PRE_READ(special, __sanitizer::internal_strlen((const char *)special) + 1);
1847 POST_SYSCALL(quotactl)
1848 (long res, long cmd, const void *special, long id, void *addr) {}
1850 PRE_SYSCALL(getdents)(long fd, void *dirent, long count) {}
1852 POST_SYSCALL(getdents)(long res, long fd, void *dirent, long count) {
1855 POST_WRITE(dirent, res);
1859 PRE_SYSCALL(getdents64)(long fd, void *dirent, long count) {}
1861 POST_SYSCALL(getdents64)(long res, long fd, void *dirent, long count) {
1864 POST_WRITE(dirent, res);
1868 PRE_SYSCALL(setsockopt)
1869 (long fd, long level, long optname, void *optval, long optlen) {}
1871 POST_SYSCALL(setsockopt)
1872 (long res, long fd, long level, long optname, void *optval, long optlen) {
1876 __sanitizer::internal_strlen((const char *)optval) + 1);
1880 PRE_SYSCALL(getsockopt)
1881 (long fd, long level, long optname, void *optval, void *optlen) {}
1883 POST_SYSCALL(getsockopt)
1884 (long res, long fd, long level, long optname, void *optval, void *optlen) {
1888 __sanitizer::internal_strlen((const char *)optval) + 1);
1890 POST_WRITE(optlen, sizeof(int));
1894 PRE_SYSCALL(bind)(long arg0, sanitizer_kernel_sockaddr *arg1, long arg2) {}
1897 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, long arg2) {
1900 POST_WRITE(arg1, sizeof(*arg1));
1904 PRE_SYSCALL(connect)(long arg0, sanitizer_kernel_sockaddr *arg1, long arg2) {}
1906 POST_SYSCALL(connect)
1907 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, long arg2) {
1910 POST_WRITE(arg1, sizeof(*arg1));
1914 PRE_SYSCALL(accept)(long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {}
1916 POST_SYSCALL(accept)
1917 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {
1920 POST_WRITE(arg1, sizeof(*arg1));
1922 POST_WRITE(arg2, sizeof(unsigned));
1926 PRE_SYSCALL(accept4)
1927 (long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2, long arg3) {}
1929 POST_SYSCALL(accept4)
1930 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2, long arg3) {
1933 POST_WRITE(arg1, sizeof(*arg1));
1935 POST_WRITE(arg2, sizeof(unsigned));
1939 PRE_SYSCALL(getsockname)
1940 (long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {}
1942 POST_SYSCALL(getsockname)
1943 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {
1946 POST_WRITE(arg1, sizeof(*arg1));
1948 POST_WRITE(arg2, sizeof(unsigned));
1952 PRE_SYSCALL(getpeername)
1953 (long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {}
1955 POST_SYSCALL(getpeername)
1956 (long res, long arg0, sanitizer_kernel_sockaddr *arg1, void *arg2) {
1959 POST_WRITE(arg1, sizeof(*arg1));
1961 POST_WRITE(arg2, sizeof(unsigned));
1965 PRE_SYSCALL(send)(long arg0, void *arg1, long arg2, long arg3) {}
1967 POST_SYSCALL(send)(long res, long arg0, void *arg1, long arg2, long arg3) {
1970 POST_READ(arg1, res);
1975 (long arg0, void *arg1, long arg2, long arg3, sanitizer_kernel_sockaddr *arg4,
1978 POST_SYSCALL(sendto)
1979 (long res, long arg0, void *arg1, long arg2, long arg3,
1980 sanitizer_kernel_sockaddr *arg4, long arg5) {
1983 POST_READ(arg1, res);
1985 POST_WRITE(arg4, sizeof(*arg4));
1989 PRE_SYSCALL(sendmsg)(long fd, void *msg, long flags) {}
1991 POST_SYSCALL(sendmsg)(long res, long fd, void *msg, long flags) {
1995 PRE_SYSCALL(sendmmsg)(long fd, void *msg, long vlen, long flags) {}
1997 POST_SYSCALL(sendmmsg)(long res, long fd, void *msg, long vlen, long flags) {
2001 PRE_SYSCALL(recv)(long arg0, void *buf, long len, long flags) {}
2003 POST_SYSCALL(recv)(long res, void *buf, long len, long flags) {
2006 POST_WRITE(buf, res);
2010 PRE_SYSCALL(recvfrom)
2011 (long arg0, void *buf, long len, long flags, sanitizer_kernel_sockaddr *arg4,
2014 POST_SYSCALL(recvfrom)
2015 (long res, long arg0, void *buf, long len, long flags,
2016 sanitizer_kernel_sockaddr *arg4, void *arg5) {
2019 POST_WRITE(buf, res);
2021 POST_WRITE(arg4, sizeof(*arg4));
2023 POST_WRITE(arg5, sizeof(int));
2027 PRE_SYSCALL(socket)(long arg0, long arg1, long arg2) {}
2029 POST_SYSCALL(socket)(long res, long arg0, long arg1, long arg2) {}
2031 PRE_SYSCALL(socketpair)(long arg0, long arg1, long arg2, int *sv) {}
2033 POST_SYSCALL(socketpair)(long res, long arg0, long arg1, long arg2, int *sv) {
2036 POST_WRITE(sv, sizeof(int) * 2);
2039 PRE_SYSCALL(socketcall)(long call, void *args) {}
2041 POST_SYSCALL(socketcall)(long res, long call, void *args) {
2044 POST_WRITE(args, sizeof(long));
2048 PRE_SYSCALL(listen)(long arg0, long arg1) {}
2050 POST_SYSCALL(listen)(long res, long arg0, long arg1) {}
2052 PRE_SYSCALL(poll)(void *ufds, long nfds, long timeout) {}
2055 (long res, __sanitizer_pollfd *ufds, long nfds, long timeout) {
2058 POST_WRITE(ufds, nfds * sizeof(*ufds));
2063 (long n, __sanitizer___kernel_fd_set *inp, __sanitizer___kernel_fd_set *outp,
2064 __sanitizer___kernel_fd_set *exp, void *tvp) {}
2066 POST_SYSCALL(select)
2067 (long res, long n, __sanitizer___kernel_fd_set *inp,
2068 __sanitizer___kernel_fd_set *outp, __sanitizer___kernel_fd_set *exp,
2072 POST_WRITE(inp, sizeof(*inp));
2074 POST_WRITE(outp, sizeof(*outp));
2076 POST_WRITE(exp, sizeof(*exp));
2078 POST_WRITE(tvp, timeval_sz);
2082 PRE_SYSCALL(old_select)(void *arg) {}
2084 POST_SYSCALL(old_select)(long res, void *arg) {}
2086 PRE_SYSCALL(epoll_create)(long size) {}
2088 POST_SYSCALL(epoll_create)(long res, long size) {}
2090 PRE_SYSCALL(epoll_create1)(long flags) {}
2092 POST_SYSCALL(epoll_create1)(long res, long flags) {}
2094 PRE_SYSCALL(epoll_ctl)(long epfd, long op, long fd, void *event) {}
2096 POST_SYSCALL(epoll_ctl)(long res, long epfd, long op, long fd, void *event) {
2099 POST_WRITE(event, struct_epoll_event_sz);
2103 PRE_SYSCALL(epoll_wait)
2104 (long epfd, void *events, long maxevents, long timeout) {}
2106 POST_SYSCALL(epoll_wait)
2107 (long res, long epfd, void *events, long maxevents, long timeout) {
2110 POST_WRITE(events, res * struct_epoll_event_sz);
2114 PRE_SYSCALL(epoll_pwait)
2115 (long epfd, void *events, long maxevents, long timeout,
2116 const kernel_sigset_t *sigmask, long sigsetsize) {
2118 PRE_READ(sigmask, sigsetsize);
2121 POST_SYSCALL(epoll_pwait)
2122 (long res, long epfd, void *events, long maxevents, long timeout,
2123 const void *sigmask, long sigsetsize) {
2126 POST_WRITE(events, res * struct_epoll_event_sz);
2130 PRE_SYSCALL(epoll_pwait2)
2131 (long epfd, void *events, long maxevents,
2132 const sanitizer_kernel_timespec *timeout, const kernel_sigset_t *sigmask,
2135 PRE_READ(timeout, sizeof(timeout));
2137 PRE_READ(sigmask, sigsetsize);
2140 POST_SYSCALL(epoll_pwait2)
2141 (long res, long epfd, void *events, long maxevents,
2142 const sanitizer_kernel_timespec *timeout, const void *sigmask,
2146 POST_WRITE(events, res * struct_epoll_event_sz);
2150 PRE_SYSCALL(gethostname)(void *name, long len) {}
2152 POST_SYSCALL(gethostname)(long res, void *name, long len) {
2155 POST_WRITE(name, __sanitizer::internal_strlen((const char *)name) + 1);
2159 PRE_SYSCALL(sethostname)(void *name, long len) {}
2161 POST_SYSCALL(sethostname)(long res, void *name, long len) {
2164 POST_WRITE(name, __sanitizer::internal_strlen((const char *)name) + 1);
2168 PRE_SYSCALL(setdomainname)(void *name, long len) {}
2170 POST_SYSCALL(setdomainname)(long res, void *name, long len) {
2173 POST_WRITE(name, __sanitizer::internal_strlen((const char *)name) + 1);
2177 PRE_SYSCALL(newuname)(void *name) {}
2179 POST_SYSCALL(newuname)(long res, void *name) {
2182 POST_WRITE(name, struct_new_utsname_sz);
2186 PRE_SYSCALL(uname)(void *arg0) {}
2188 POST_SYSCALL(uname)(long res, void *arg0) {
2191 POST_WRITE(arg0, struct_old_utsname_sz);
2195 PRE_SYSCALL(olduname)(void *arg0) {}
2197 POST_SYSCALL(olduname)(long res, void *arg0) {
2200 POST_WRITE(arg0, struct_oldold_utsname_sz);
2204 PRE_SYSCALL(getrlimit)(long resource, void *rlim) {}
2206 POST_SYSCALL(getrlimit)(long res, long resource, void *rlim) {
2209 POST_WRITE(rlim, struct_rlimit_sz);
2213 PRE_SYSCALL(old_getrlimit)(long resource, void *rlim) {}
2215 POST_SYSCALL(old_getrlimit)(long res, long resource, void *rlim) {
2218 POST_WRITE(rlim, struct_rlimit_sz);
2222 PRE_SYSCALL(setrlimit)(long resource, void *rlim) {}
2224 POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) {
2227 POST_WRITE(rlim, struct_rlimit_sz);
2231 # if !SANITIZER_ANDROID
2232 PRE_SYSCALL(prlimit64)
2233 (long pid, long resource, const void *new_rlim, void *old_rlim) {
2235 PRE_READ(new_rlim, struct_rlimit64_sz);
2238 POST_SYSCALL(prlimit64)
2239 (long res, long pid, long resource, const void *new_rlim, void *old_rlim) {
2242 POST_WRITE(old_rlim, struct_rlimit64_sz);
2247 PRE_SYSCALL(getrusage)(long who, void *ru) {}
2249 POST_SYSCALL(getrusage)(long res, long who, void *ru) {
2252 POST_WRITE(ru, struct_rusage_sz);
2256 PRE_SYSCALL(umask)(long mask) {}
2258 POST_SYSCALL(umask)(long res, long mask) {}
2260 PRE_SYSCALL(msgget)(long key, long msgflg) {}
2262 POST_SYSCALL(msgget)(long res, long key, long msgflg) {}
2264 PRE_SYSCALL(msgsnd)(long msqid, void *msgp, long msgsz, long msgflg) {
2266 PRE_READ(msgp, msgsz);
2269 POST_SYSCALL(msgsnd)
2270 (long res, long msqid, void *msgp, long msgsz, long msgflg) {}
2273 (long msqid, void *msgp, long msgsz, long msgtyp, long msgflg) {}
2275 POST_SYSCALL(msgrcv)
2276 (long res, long msqid, void *msgp, long msgsz, long msgtyp, long msgflg) {
2279 POST_WRITE(msgp, res);
2283 # if !SANITIZER_ANDROID
2284 PRE_SYSCALL(msgctl)(long msqid, long cmd, void *buf) {}
2286 POST_SYSCALL(msgctl)(long res, long msqid, long cmd, void *buf) {
2289 POST_WRITE(buf, struct_msqid_ds_sz);
2294 PRE_SYSCALL(semget)(long key, long nsems, long semflg) {}
2296 POST_SYSCALL(semget)(long res, long key, long nsems, long semflg) {}
2298 PRE_SYSCALL(semop)(long semid, void *sops, long nsops) {}
2300 POST_SYSCALL(semop)(long res, long semid, void *sops, long nsops) {}
2302 PRE_SYSCALL(semctl)(long semid, long semnum, long cmd, void *arg) {}
2304 POST_SYSCALL(semctl)(long res, long semid, long semnum, long cmd, void *arg) {}
2306 PRE_SYSCALL(semtimedop)
2307 (long semid, void *sops, long nsops, const void *timeout) {
2309 PRE_READ(timeout, struct_timespec_sz);
2312 POST_SYSCALL(semtimedop)
2313 (long res, long semid, void *sops, long nsops, const void *timeout) {}
2315 PRE_SYSCALL(shmat)(long shmid, void *shmaddr, long shmflg) {}
2317 POST_SYSCALL(shmat)(long res, long shmid, void *shmaddr, long shmflg) {
2321 __sanitizer::internal_strlen((const char *)shmaddr) + 1);
2325 PRE_SYSCALL(shmget)(long key, long size, long flag) {}
2327 POST_SYSCALL(shmget)(long res, long key, long size, long flag) {}
2329 PRE_SYSCALL(shmdt)(void *shmaddr) {}
2331 POST_SYSCALL(shmdt)(long res, void *shmaddr) {
2335 __sanitizer::internal_strlen((const char *)shmaddr) + 1);
2340 (long call, long first, long second, long third, void *ptr, long fifth) {}
2343 (long res, long call, long first, long second, long third, void *ptr,
2346 # if !SANITIZER_ANDROID
2347 PRE_SYSCALL(shmctl)(long shmid, long cmd, void *buf) {}
2349 POST_SYSCALL(shmctl)(long res, long shmid, long cmd, void *buf) {
2352 POST_WRITE(buf, sizeof(__sanitizer_shmid_ds));
2356 PRE_SYSCALL(mq_open)(const void *name, long oflag, long mode, void *attr) {
2358 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
2361 POST_SYSCALL(mq_open)
2362 (long res, const void *name, long oflag, long mode, void *attr) {
2365 POST_WRITE(attr, struct_mq_attr_sz);
2369 PRE_SYSCALL(mq_unlink)(const void *name) {
2371 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
2374 POST_SYSCALL(mq_unlink)(long res, const void *name) {}
2376 PRE_SYSCALL(mq_timedsend)
2377 (long mqdes, const void *msg_ptr, long msg_len, long msg_prio,
2378 const void *abs_timeout) {
2380 PRE_READ(msg_ptr, msg_len);
2382 PRE_READ(abs_timeout, struct_timespec_sz);
2385 POST_SYSCALL(mq_timedsend)
2386 (long res, long mqdes, const void *msg_ptr, long msg_len, long msg_prio,
2387 const void *abs_timeout) {}
2389 PRE_SYSCALL(mq_timedreceive)
2390 (long mqdes, void *msg_ptr, long msg_len, void *msg_prio,
2391 const void *abs_timeout) {
2393 PRE_READ(abs_timeout, struct_timespec_sz);
2396 POST_SYSCALL(mq_timedreceive)
2397 (long res, long mqdes, void *msg_ptr, long msg_len, int *msg_prio,
2398 const void *abs_timeout) {
2401 POST_WRITE(msg_ptr, res);
2403 POST_WRITE(msg_prio, sizeof(*msg_prio));
2407 PRE_SYSCALL(mq_notify)(long mqdes, const void *notification) {
2409 PRE_READ(notification, struct_sigevent_sz);
2412 POST_SYSCALL(mq_notify)(long res, long mqdes, const void *notification) {}
2414 PRE_SYSCALL(mq_getsetattr)(long mqdes, const void *mqstat, void *omqstat) {
2416 PRE_READ(mqstat, struct_mq_attr_sz);
2419 POST_SYSCALL(mq_getsetattr)
2420 (long res, long mqdes, const void *mqstat, void *omqstat) {
2423 POST_WRITE(omqstat, struct_mq_attr_sz);
2426 # endif // SANITIZER_ANDROID
2428 PRE_SYSCALL(pciconfig_iobase)(long which, long bus, long devfn) {}
2430 POST_SYSCALL(pciconfig_iobase)(long res, long which, long bus, long devfn) {}
2432 PRE_SYSCALL(pciconfig_read)
2433 (long bus, long dfn, long off, long len, void *buf) {}
2435 POST_SYSCALL(pciconfig_read)
2436 (long res, long bus, long dfn, long off, long len, void *buf) {}
2438 PRE_SYSCALL(pciconfig_write)
2439 (long bus, long dfn, long off, long len, void *buf) {}
2441 POST_SYSCALL(pciconfig_write)
2442 (long res, long bus, long dfn, long off, long len, void *buf) {}
2444 PRE_SYSCALL(swapon)(const void *specialfile, long swap_flags) {
2446 PRE_READ(specialfile,
2447 __sanitizer::internal_strlen((const char *)specialfile) + 1);
2450 POST_SYSCALL(swapon)(long res, const void *specialfile, long swap_flags) {}
2452 PRE_SYSCALL(swapoff)(const void *specialfile) {
2454 PRE_READ(specialfile,
2455 __sanitizer::internal_strlen((const char *)specialfile) + 1);
2458 POST_SYSCALL(swapoff)(long res, const void *specialfile) {}
2460 PRE_SYSCALL(sysctl)(__sanitizer___sysctl_args *args) {
2463 PRE_READ(args->name, args->nlen * sizeof(*args->name));
2465 PRE_READ(args->name, args->newlen);
2469 POST_SYSCALL(sysctl)(long res, __sanitizer___sysctl_args *args) {
2471 if (args && args->oldval && args->oldlenp) {
2472 POST_WRITE(args->oldlenp, sizeof(*args->oldlenp));
2473 POST_WRITE(args->oldval, *args->oldlenp);
2478 PRE_SYSCALL(sysinfo)(void *info) {}
2480 POST_SYSCALL(sysinfo)(long res, void *info) {
2483 POST_WRITE(info, struct_sysinfo_sz);
2487 PRE_SYSCALL(sysfs)(long option, long arg1, long arg2) {}
2489 POST_SYSCALL(sysfs)(long res, long option, long arg1, long arg2) {}
2491 PRE_SYSCALL(syslog)(long type, void *buf, long len) {}
2493 POST_SYSCALL(syslog)(long res, long type, void *buf, long len) {
2496 POST_WRITE(buf, __sanitizer::internal_strlen((const char *)buf) + 1);
2500 PRE_SYSCALL(uselib)(const void *library) {
2502 PRE_READ(library, __sanitizer::internal_strlen((const char *)library) + 1);
2505 POST_SYSCALL(uselib)(long res, const void *library) {}
2507 PRE_SYSCALL(ni_syscall)() {}
2509 POST_SYSCALL(ni_syscall)(long res) {}
2511 PRE_SYSCALL(ptrace)(long request, long pid, long addr, long data) {
2512 # if !SANITIZER_ANDROID && \
2513 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
2514 defined(__powerpc64__) || defined(__aarch64__) || defined(__s390__) || \
2517 if (request == ptrace_setregs) {
2518 PRE_READ((void *)data, struct_user_regs_struct_sz);
2519 } else if (request == ptrace_setfpregs) {
2520 PRE_READ((void *)data, struct_user_fpregs_struct_sz);
2521 } else if (request == ptrace_setfpxregs) {
2522 PRE_READ((void *)data, struct_user_fpxregs_struct_sz);
2523 } else if (request == ptrace_setsiginfo) {
2524 PRE_READ((void *)data, siginfo_t_sz);
2525 } else if (request == ptrace_setregset) {
2526 __sanitizer_iovec *iov = (__sanitizer_iovec *)data;
2527 PRE_READ(iov->iov_base, iov->iov_len);
2533 POST_SYSCALL(ptrace)(long res, long request, long pid, long addr, long data) {
2534 # if !SANITIZER_ANDROID && \
2535 (defined(__i386) || defined(__x86_64) || defined(__mips64) || \
2536 defined(__powerpc64__) || defined(__aarch64__) || defined(__s390__) || \
2538 if (res >= 0 && data) {
2539 // Note that this is different from the interceptor in
2540 // sanitizer_common_interceptors.inc.
2541 // PEEK* requests return resulting values through data pointer.
2542 if (request == ptrace_getregs) {
2543 POST_WRITE((void *)data, struct_user_regs_struct_sz);
2544 } else if (request == ptrace_getfpregs) {
2545 POST_WRITE((void *)data, struct_user_fpregs_struct_sz);
2546 } else if (request == ptrace_getfpxregs) {
2547 POST_WRITE((void *)data, struct_user_fpxregs_struct_sz);
2548 } else if (request == ptrace_getsiginfo) {
2549 POST_WRITE((void *)data, siginfo_t_sz);
2550 } else if (request == ptrace_getregset) {
2551 __sanitizer_iovec *iov = (__sanitizer_iovec *)data;
2552 POST_WRITE(iov->iov_base, iov->iov_len);
2553 } else if (request == ptrace_peekdata || request == ptrace_peektext ||
2554 request == ptrace_peekuser) {
2555 POST_WRITE((void *)data, sizeof(void *));
2561 PRE_SYSCALL(add_key)
2562 (const void *_type, const void *_description, const void *_payload, long plen,
2565 PRE_READ(_type, __sanitizer::internal_strlen((const char *)_type) + 1);
2567 PRE_READ(_description,
2568 __sanitizer::internal_strlen((const char *)_description) + 1);
2571 POST_SYSCALL(add_key)
2572 (long res, const void *_type, const void *_description, const void *_payload,
2573 long plen, long destringid) {}
2575 PRE_SYSCALL(request_key)
2576 (const void *_type, const void *_description, const void *_callout_info,
2579 PRE_READ(_type, __sanitizer::internal_strlen((const char *)_type) + 1);
2581 PRE_READ(_description,
2582 __sanitizer::internal_strlen((const char *)_description) + 1);
2584 PRE_READ(_callout_info,
2585 __sanitizer::internal_strlen((const char *)_callout_info) + 1);
2588 POST_SYSCALL(request_key)
2589 (long res, const void *_type, const void *_description,
2590 const void *_callout_info, long destringid) {}
2592 PRE_SYSCALL(keyctl)(long cmd, long arg2, long arg3, long arg4, long arg5) {}
2594 POST_SYSCALL(keyctl)
2595 (long res, long cmd, long arg2, long arg3, long arg4, long arg5) {}
2597 PRE_SYSCALL(ioprio_set)(long which, long who, long ioprio) {}
2599 POST_SYSCALL(ioprio_set)(long res, long which, long who, long ioprio) {}
2601 PRE_SYSCALL(ioprio_get)(long which, long who) {}
2603 POST_SYSCALL(ioprio_get)(long res, long which, long who) {}
2605 PRE_SYSCALL(set_mempolicy)(long mode, void *nmask, long maxnode) {}
2607 POST_SYSCALL(set_mempolicy)(long res, long mode, void *nmask, long maxnode) {
2610 POST_WRITE(nmask, sizeof(long));
2614 PRE_SYSCALL(migrate_pages)
2615 (long pid, long maxnode, const void *from, const void *to) {
2617 PRE_READ(from, sizeof(long));
2619 PRE_READ(to, sizeof(long));
2622 POST_SYSCALL(migrate_pages)
2623 (long res, long pid, long maxnode, const void *from, const void *to) {}
2625 PRE_SYSCALL(move_pages)
2626 (long pid, long nr_pages, const void **pages, const int *nodes, int *status,
2629 PRE_READ(pages, nr_pages * sizeof(*pages));
2631 PRE_READ(nodes, nr_pages * sizeof(*nodes));
2634 POST_SYSCALL(move_pages)
2635 (long res, long pid, long nr_pages, const void **pages, const int *nodes,
2636 int *status, long flags) {
2639 POST_WRITE(status, nr_pages * sizeof(*status));
2644 (long start, long len, long mode, void *nmask, long maxnode, long flags) {}
2647 (long res, long start, long len, long mode, void *nmask, long maxnode,
2651 POST_WRITE(nmask, sizeof(long));
2655 PRE_SYSCALL(get_mempolicy)
2656 (void *policy, void *nmask, long maxnode, long addr, long flags) {}
2658 POST_SYSCALL(get_mempolicy)
2659 (long res, void *policy, void *nmask, long maxnode, long addr, long flags) {
2662 POST_WRITE(policy, sizeof(int));
2664 POST_WRITE(nmask, sizeof(long));
2668 PRE_SYSCALL(inotify_init)() {}
2670 POST_SYSCALL(inotify_init)(long res) {}
2672 PRE_SYSCALL(inotify_init1)(long flags) {}
2674 POST_SYSCALL(inotify_init1)(long res, long flags) {}
2676 PRE_SYSCALL(inotify_add_watch)(long fd, const void *path, long mask) {
2678 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
2681 POST_SYSCALL(inotify_add_watch)
2682 (long res, long fd, const void *path, long mask) {}
2684 PRE_SYSCALL(inotify_rm_watch)(long fd, long wd) {}
2686 POST_SYSCALL(inotify_rm_watch)(long res, long fd, long wd) {}
2688 PRE_SYSCALL(spu_run)(long fd, void *unpc, void *ustatus) {}
2690 POST_SYSCALL(spu_run)(long res, long fd, unsigned *unpc, unsigned *ustatus) {
2693 POST_WRITE(unpc, sizeof(*unpc));
2695 POST_WRITE(ustatus, sizeof(*ustatus));
2699 PRE_SYSCALL(spu_create)(const void *name, long flags, long mode, long fd) {
2701 PRE_READ(name, __sanitizer::internal_strlen((const char *)name) + 1);
2704 POST_SYSCALL(spu_create)
2705 (long res, const void *name, long flags, long mode, long fd) {}
2707 PRE_SYSCALL(mknodat)(long dfd, const void *filename, long mode, long dev) {
2710 __sanitizer::internal_strlen((const char *)filename) + 1);
2713 POST_SYSCALL(mknodat)
2714 (long res, long dfd, const void *filename, long mode, long dev) {}
2716 PRE_SYSCALL(mkdirat)(long dfd, const void *pathname, long mode) {
2719 __sanitizer::internal_strlen((const char *)pathname) + 1);
2722 POST_SYSCALL(mkdirat)(long res, long dfd, const void *pathname, long mode) {}
2724 PRE_SYSCALL(unlinkat)(long dfd, const void *pathname, long flag) {
2727 __sanitizer::internal_strlen((const char *)pathname) + 1);
2730 POST_SYSCALL(unlinkat)(long res, long dfd, const void *pathname, long flag) {}
2732 PRE_SYSCALL(symlinkat)(const void *oldname, long newdfd, const void *newname) {
2734 PRE_READ(oldname, __sanitizer::internal_strlen((const char *)oldname) + 1);
2736 PRE_READ(newname, __sanitizer::internal_strlen((const char *)newname) + 1);
2739 POST_SYSCALL(symlinkat)
2740 (long res, const void *oldname, long newdfd, const void *newname) {}
2743 (long olddfd, const void *oldname, long newdfd, const void *newname,
2746 PRE_READ(oldname, __sanitizer::internal_strlen((const char *)oldname) + 1);
2748 PRE_READ(newname, __sanitizer::internal_strlen((const char *)newname) + 1);
2751 POST_SYSCALL(linkat)
2752 (long res, long olddfd, const void *oldname, long newdfd, const void *newname,
2755 PRE_SYSCALL(renameat)
2756 (long olddfd, const void *oldname, long newdfd, const void *newname) {
2758 PRE_READ(oldname, __sanitizer::internal_strlen((const char *)oldname) + 1);
2760 PRE_READ(newname, __sanitizer::internal_strlen((const char *)newname) + 1);
2763 POST_SYSCALL(renameat)
2764 (long res, long olddfd, const void *oldname, long newdfd, const void *newname) {
2767 PRE_SYSCALL(futimesat)(long dfd, const void *filename, void *utimes) {
2770 __sanitizer::internal_strlen((const char *)filename) + 1);
2773 POST_SYSCALL(futimesat)
2774 (long res, long dfd, const void *filename, void *utimes) {
2777 POST_WRITE(utimes, timeval_sz);
2781 PRE_SYSCALL(faccessat)(long dfd, const void *filename, long mode) {
2784 __sanitizer::internal_strlen((const char *)filename) + 1);
2787 POST_SYSCALL(faccessat)(long res, long dfd, const void *filename, long mode) {}
2789 PRE_SYSCALL(fchmodat)(long dfd, const void *filename, long mode) {
2792 __sanitizer::internal_strlen((const char *)filename) + 1);
2795 POST_SYSCALL(fchmodat)(long res, long dfd, const void *filename, long mode) {}
2797 PRE_SYSCALL(fchownat)
2798 (long dfd, const void *filename, long user, long group, long flag) {
2801 __sanitizer::internal_strlen((const char *)filename) + 1);
2804 POST_SYSCALL(fchownat)
2805 (long res, long dfd, const void *filename, long user, long group, long flag) {}
2807 PRE_SYSCALL(openat)(long dfd, const void *filename, long flags, long mode) {
2810 __sanitizer::internal_strlen((const char *)filename) + 1);
2813 POST_SYSCALL(openat)
2814 (long res, long dfd, const void *filename, long flags, long mode) {}
2816 PRE_SYSCALL(newfstatat)
2817 (long dfd, const void *filename, void *statbuf, long flag) {
2820 __sanitizer::internal_strlen((const char *)filename) + 1);
2823 POST_SYSCALL(newfstatat)
2824 (long res, long dfd, const void *filename, void *statbuf, long flag) {
2827 POST_WRITE(statbuf, struct_kernel_stat_sz);
2831 PRE_SYSCALL(fstatat64)
2832 (long dfd, const void *filename, void *statbuf, long flag) {
2835 __sanitizer::internal_strlen((const char *)filename) + 1);
2838 POST_SYSCALL(fstatat64)
2839 (long res, long dfd, const void *filename, void *statbuf, long flag) {
2842 POST_WRITE(statbuf, struct_kernel_stat64_sz);
2846 PRE_SYSCALL(readlinkat)(long dfd, const void *path, void *buf, long bufsiz) {
2848 PRE_READ(path, __sanitizer::internal_strlen((const char *)path) + 1);
2851 POST_SYSCALL(readlinkat)
2852 (long res, long dfd, const void *path, void *buf, long bufsiz) {
2855 POST_WRITE(buf, __sanitizer::internal_strlen((const char *)buf) + 1);
2859 PRE_SYSCALL(utimensat)
2860 (long dfd, const void *filename, void *utimes, long flags) {
2863 __sanitizer::internal_strlen((const char *)filename) + 1);
2866 POST_SYSCALL(utimensat)
2867 (long res, long dfd, const void *filename, void *utimes, long flags) {
2870 POST_WRITE(utimes, struct_timespec_sz);
2874 PRE_SYSCALL(unshare)(long unshare_flags) {}
2876 POST_SYSCALL(unshare)(long res, long unshare_flags) {}
2879 (long fd_in, void *off_in, long fd_out, void *off_out, long len, long flags) {}
2881 POST_SYSCALL(splice)
2882 (long res, long fd_in, void *off_in, long fd_out, void *off_out, long len,
2886 POST_WRITE(off_in, sizeof(long long));
2888 POST_WRITE(off_out, sizeof(long long));
2892 PRE_SYSCALL(vmsplice)
2893 (long fd, const __sanitizer_iovec *iov, long nr_segs, long flags) {}
2895 POST_SYSCALL(vmsplice)
2896 (long res, long fd, const __sanitizer_iovec *iov, long nr_segs, long flags) {
2899 kernel_read_iovec(iov, nr_segs, res);
2903 PRE_SYSCALL(tee)(long fdin, long fdout, long len, long flags) {}
2905 POST_SYSCALL(tee)(long res, long fdin, long fdout, long len, long flags) {}
2907 PRE_SYSCALL(get_robust_list)(long pid, void *head_ptr, void *len_ptr) {}
2909 POST_SYSCALL(get_robust_list)
2910 (long res, long pid, void *head_ptr, void *len_ptr) {}
2912 PRE_SYSCALL(set_robust_list)(void *head, long len) {}
2914 POST_SYSCALL(set_robust_list)(long res, void *head, long len) {}
2916 PRE_SYSCALL(getcpu)(void *cpu, void *node, void *cache) {}
2918 POST_SYSCALL(getcpu)(long res, void *cpu, void *node, void *cache) {
2921 POST_WRITE(cpu, sizeof(unsigned));
2923 POST_WRITE(node, sizeof(unsigned));
2924 // The third argument to this system call is nowadays unused.
2928 PRE_SYSCALL(signalfd)(long ufd, void *user_mask, long sizemask) {}
2930 POST_SYSCALL(signalfd)
2931 (long res, long ufd, kernel_sigset_t *user_mask, long sizemask) {
2934 POST_WRITE(user_mask, sizemask);
2938 PRE_SYSCALL(signalfd4)(long ufd, void *user_mask, long sizemask, long flags) {}
2940 POST_SYSCALL(signalfd4)
2941 (long res, long ufd, kernel_sigset_t *user_mask, long sizemask, long flags) {
2944 POST_WRITE(user_mask, sizemask);
2948 PRE_SYSCALL(timerfd_create)(long clockid, long flags) {}
2950 POST_SYSCALL(timerfd_create)(long res, long clockid, long flags) {}
2952 PRE_SYSCALL(timerfd_settime)
2953 (long ufd, long flags, const void *utmr, void *otmr) {
2955 PRE_READ(utmr, struct_itimerspec_sz);
2958 POST_SYSCALL(timerfd_settime)
2959 (long res, long ufd, long flags, const void *utmr, void *otmr) {
2962 POST_WRITE(otmr, struct_itimerspec_sz);
2966 PRE_SYSCALL(timerfd_gettime)(long ufd, void *otmr) {}
2968 POST_SYSCALL(timerfd_gettime)(long res, long ufd, void *otmr) {
2971 POST_WRITE(otmr, struct_itimerspec_sz);
2975 PRE_SYSCALL(eventfd)(long count) {}
2977 POST_SYSCALL(eventfd)(long res, long count) {}
2979 PRE_SYSCALL(eventfd2)(long count, long flags) {}
2981 POST_SYSCALL(eventfd2)(long res, long count, long flags) {}
2983 PRE_SYSCALL(old_readdir)(long arg0, void *arg1, long arg2) {}
2985 POST_SYSCALL(old_readdir)(long res, long arg0, void *arg1, long arg2) {
2986 // Missing definition of 'struct old_linux_dirent'.
2989 PRE_SYSCALL(pselect6)
2990 (long arg0, __sanitizer___kernel_fd_set *arg1,
2991 __sanitizer___kernel_fd_set *arg2, __sanitizer___kernel_fd_set *arg3,
2992 void *arg4, void *arg5) {}
2994 POST_SYSCALL(pselect6)
2995 (long res, long arg0, __sanitizer___kernel_fd_set *arg1,
2996 __sanitizer___kernel_fd_set *arg2, __sanitizer___kernel_fd_set *arg3,
2997 void *arg4, void *arg5) {
3000 POST_WRITE(arg1, sizeof(*arg1));
3002 POST_WRITE(arg2, sizeof(*arg2));
3004 POST_WRITE(arg3, sizeof(*arg3));
3006 POST_WRITE(arg4, struct_timespec_sz);
3011 (__sanitizer_pollfd *arg0, long arg1, void *arg2, const kernel_sigset_t *arg3,
3014 PRE_READ(arg3, arg4);
3018 (long res, __sanitizer_pollfd *arg0, long arg1, void *arg2, const void *arg3,
3022 POST_WRITE(arg0, sizeof(*arg0));
3024 POST_WRITE(arg2, struct_timespec_sz);
3028 PRE_SYSCALL(syncfs)(long fd) {}
3030 POST_SYSCALL(syncfs)(long res, long fd) {}
3032 PRE_SYSCALL(perf_event_open)
3033 (__sanitizer_perf_event_attr *attr_uptr, long pid, long cpu, long group_fd,
3036 PRE_READ(attr_uptr, attr_uptr->size);
3039 POST_SYSCALL(perf_event_open)
3040 (long res, __sanitizer_perf_event_attr *attr_uptr, long pid, long cpu,
3041 long group_fd, long flags) {}
3043 PRE_SYSCALL(mmap_pgoff)
3044 (long addr, long len, long prot, long flags, long fd, long pgoff) {}
3046 POST_SYSCALL(mmap_pgoff)
3047 (long res, long addr, long len, long prot, long flags, long fd, long pgoff) {}
3049 PRE_SYSCALL(old_mmap)(void *arg) {}
3051 POST_SYSCALL(old_mmap)(long res, void *arg) {}
3053 PRE_SYSCALL(name_to_handle_at)
3054 (long dfd, const void *name, void *handle, void *mnt_id, long flag) {}
3056 POST_SYSCALL(name_to_handle_at)
3057 (long res, long dfd, const void *name, void *handle, void *mnt_id, long flag) {}
3059 PRE_SYSCALL(open_by_handle_at)(long mountdirfd, void *handle, long flags) {}
3061 POST_SYSCALL(open_by_handle_at)
3062 (long res, long mountdirfd, void *handle, long flags) {}
3064 PRE_SYSCALL(setns)(long fd, long nstype) {}
3066 POST_SYSCALL(setns)(long res, long fd, long nstype) {}
3068 PRE_SYSCALL(process_vm_readv)
3069 (long pid, const __sanitizer_iovec *lvec, long liovcnt, const void *rvec,
3070 long riovcnt, long flags) {}
3072 POST_SYSCALL(process_vm_readv)
3073 (long res, long pid, const __sanitizer_iovec *lvec, long liovcnt,
3074 const void *rvec, long riovcnt, long flags) {
3077 kernel_write_iovec(lvec, liovcnt, res);
3081 PRE_SYSCALL(process_vm_writev)
3082 (long pid, const __sanitizer_iovec *lvec, long liovcnt, const void *rvec,
3083 long riovcnt, long flags) {}
3085 POST_SYSCALL(process_vm_writev)
3086 (long res, long pid, const __sanitizer_iovec *lvec, long liovcnt,
3087 const void *rvec, long riovcnt, long flags) {
3090 kernel_read_iovec(lvec, liovcnt, res);
3094 PRE_SYSCALL(fork)() { COMMON_SYSCALL_PRE_FORK(); }
3096 POST_SYSCALL(fork)(long res) { COMMON_SYSCALL_POST_FORK(res); }
3098 PRE_SYSCALL(vfork)() { COMMON_SYSCALL_PRE_FORK(); }
3100 POST_SYSCALL(vfork)(long res) { COMMON_SYSCALL_POST_FORK(res); }
3102 PRE_SYSCALL(sigaction)
3103 (long signum, const __sanitizer_kernel_sigaction_t *act,
3104 __sanitizer_kernel_sigaction_t *oldact) {
3106 PRE_READ(&act->sigaction, sizeof(act->sigaction));
3107 PRE_READ(&act->sa_flags, sizeof(act->sa_flags));
3108 PRE_READ(&act->sa_mask, sizeof(act->sa_mask));
3112 POST_SYSCALL(sigaction)
3113 (long res, long signum, const __sanitizer_kernel_sigaction_t *act,
3114 __sanitizer_kernel_sigaction_t *oldact) {
3115 if (res >= 0 && oldact)
3116 POST_WRITE(oldact, sizeof(*oldact));
3119 PRE_SYSCALL(rt_sigaction)
3120 (long signum, const __sanitizer_kernel_sigaction_t *act,
3121 __sanitizer_kernel_sigaction_t *oldact, SIZE_T sz) {
3123 PRE_READ(&act->sigaction, sizeof(act->sigaction));
3124 PRE_READ(&act->sa_flags, sizeof(act->sa_flags));
3125 PRE_READ(&act->sa_mask, sz);
3129 POST_SYSCALL(rt_sigaction)
3130 (long res, long signum, const __sanitizer_kernel_sigaction_t *act,
3131 __sanitizer_kernel_sigaction_t *oldact, SIZE_T sz) {
3132 if (res >= 0 && oldact) {
3133 SIZE_T oldact_sz = ((char *)&oldact->sa_mask) - ((char *)oldact) + sz;
3134 POST_WRITE(oldact, oldact_sz);
3138 PRE_SYSCALL(getrandom)(void *buf, uptr count, long flags) {
3140 PRE_WRITE(buf, count);
3144 POST_SYSCALL(getrandom)(long res, void *buf, uptr count, long flags) {
3145 if (res > 0 && buf) {
3146 POST_WRITE(buf, res);
3150 PRE_SYSCALL(sigaltstack)(const void *ss, void *oss) {
3151 if (ss != nullptr) {
3152 PRE_READ(ss, struct_stack_t_sz);
3154 if (oss != nullptr) {
3155 PRE_WRITE(oss, struct_stack_t_sz);
3159 POST_SYSCALL(sigaltstack)(long res, void *ss, void *oss) {
3161 if (oss != nullptr) {
3162 POST_WRITE(oss, struct_stack_t_sz);
3171 # undef POST_SYSCALL
3175 #endif // SANITIZER_LINUX