3 #===-- generate_netbsd_syscalls.awk ----------------------------------------===#
5 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 # See https://llvm.org/LICENSE.txt for license information.
7 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 #===------------------------------------------------------------------------===#
11 # This file is a generator of:
12 # - include/sanitizer/netbsd_syscall_hooks.h
13 # - lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
15 # This script accepts on the input syscalls.master by default located in the
16 # /usr/src/sys/kern/syscalls.master path in the NetBSD distribution.
18 # This script shall be executed only on the newest NetBSD version.
19 # This script will emit compat code for the older releases.
21 # NetBSD minimal version supported 9.0.
22 # NetBSD current version supported 9.99.30.
24 #===------------------------------------------------------------------------===#
27 # hardcode the script name
28 script_name =
"generate_netbsd_syscalls.awk"
29 outputh =
"../include/sanitizer/netbsd_syscall_hooks.h"
30 outputinc =
"../lib/sanitizer_common/sanitizer_syscalls_netbsd.inc"
32 # assert that we are in the directory with scripts
33 in_utils =
system("test -f " script_name
" && exit 1 || exit 0")
38 # assert 1 argument passed
43 # assert argument is a valid file path to syscall.master
44 if (system("test -f " ARGV[1]) != 0) {
48 # sanity check that the path ends with "syscall.master"
49 if (ARGV[1] !~
/syscalls\.master$
/) {
53 # accept overloading CLANGFORMAT from environment
54 clangformat =
"clang-format"
55 if ("CLANGFORMAT" in
ENVIRON) {
56 clangformat =
ENVIRON["CLANGFORMAT"]
59 # parsing specific symbols
64 # Hardcoded in algorithm
68 # Parse the RCS ID from syscall.master
69 parsingheader ==
1 && NR ==
1 {
70 if (match($
0, /\$
[^$
]+\$
/)) {
71 # trim initial 'NetBSD: ' and trailing ' $'
72 syscallmasterversion =
substr($
0, RSTART + 9, RLENGTH - 11)
79 # skip the following lines
89 # separator between the header and table with syscalls
95 # preserve 'if/elif/else/endif' C preprocessor as-is
96 parsingheader ==
0 && $
0 ~
/^
#/ {
97 if (parsedsyscalls in ifelifelseendif
) {
98 ifelifelseendif
[parsedsyscalls
] = ifelifelseendif
[parsedsyscalls
] "\n" $
0
100 ifelifelseendif
[parsedsyscalls
] = $
0
105 # parsing of syscall definitions
106 parsingheader ==
0 && $
1 ~
/^
[0-9]+$
/ {
107 # first join multiple lines into single one
108 while (sub(/\\$
/, "")) {
113 # Skip unwanted syscalls
115 if ($
0 ~
/OBSOL
/ || $
0 ~
/EXCL
/ || $
0 ~
/UNIMPL
/) {
119 # Compose the syscall name
122 if (match($
0, /COMPAT_
[0-9]+/)) {
123 compat =
tolower(substr($
0, RSTART, RLENGTH))
127 if ($
(NF) != "}" && !skip
) {
128 alias = alias
"" $
(NF)
132 if (match($
0, /\
|[0-9]+\
|/)) {
133 compatver =
tolower(substr($
0, RSTART + 1, RLENGTH - 2))
140 if (match($
0, /\
|[_a
-z0
-9]+\
(/)) {
141 basename =
tolower(substr($
0, RSTART + 1, RLENGTH - 2))
148 syscallname= syscallname
"$"
151 if (length(compat
) > 0) {
152 syscallname = syscallname
"" compat
"_"
154 if (length(alias
) > 0) {
155 syscallname = syscallname
"" alias
157 if (length(compatver
) > 0) {
158 syscallname = syscallname
"__" basename
"" compatver
160 syscallname = syscallname
"" basename
164 # Store the syscallname
165 syscalls
[parsedsyscalls
]=syscallname
167 # Extract syscall arguments
168 if (match($
0, /\
([^
)]+\
)/)) {
169 args =
substr($
0, RSTART + 1, RLENGTH - 2)
171 if (args ==
"void") {
172 syscallargs
[parsedsyscalls
] =
"void"
173 syscallfullargs
[parsedsyscalls
] =
"void"
175 # Normalize 'type * argument' to 'type *argument'
176 gsub("\\*[ \t]+", "*", args
)
178 n =
split(args
, a
, ",")
180 # Handle the first argument
181 match(a
[1], /[*_a
-z0
-9\
[\
]]+$
/)
182 syscallfullargs
[parsedsyscalls
] =
substr(a
[1], RSTART) "_"
184 gsub(".+[ *]", "", a
[1])
185 syscallargs
[parsedsyscalls
] = a
[1]
187 # Handle the rest of arguments
188 for (i =
2; i
<= n
; i
++) {
189 match(a
[i
], /[*_a
-zA
-Z0
-9\
[\
]]+$
/)
190 fs =
substr(a
[i
], RSTART)
196 syscallfullargs
[parsedsyscalls
] = syscallfullargs
[parsedsyscalls
] "$" fs
197 gsub(".+[ *]", "", a
[i
])
198 syscallargs
[parsedsyscalls
] = syscallargs
[parsedsyscalls
] "$" a
[i
]
201 # Handle array arguments for syscall(2) and __syscall(2)
202 nargs =
"arg0$arg1$arg2$arg3$arg4$arg5$arg6$arg7"
203 gsub(/args\
[SYS_MAXSYSARGS\
]/, nargs
, syscallargs
[parsedsyscalls
])
209 # Done with this line
216 if (NR < 1 && !abnormal_exit
) {
220 # Handle abnormal exit
225 # Generate sanitizer_syscalls_netbsd.inc
228 cmd = clangformat
" > " outputh
230 pcmd
("//===-- netbsd_syscall_hooks.h --------------------------------------------===//")
232 pcmd
("// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.")
233 pcmd
("// See https://llvm.org/LICENSE.txt for license information.")
234 pcmd
("// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception")
236 pcmd
("//===----------------------------------------------------------------------===//")
238 pcmd
("// This file is a part of public sanitizer interface.")
240 pcmd
("// System call handlers.")
242 pcmd
("// Interface methods declared in this header implement pre- and post- syscall")
243 pcmd
("// actions for the active sanitizer.")
245 pcmd
("// __sanitizer_syscall_pre_getfoo(...args...);")
246 pcmd
("// long long res = syscall(SYS_getfoo, ...args...);")
247 pcmd
("// __sanitizer_syscall_post_getfoo(res, ...args...);")
249 pcmd
("// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!")
251 pcmd
("// Generated with: " script_name
)
252 pcmd
("// Generated date: " strftime
("%F"))
253 pcmd
("// Generated from: " syscallmasterversion
)
255 pcmd
("//===----------------------------------------------------------------------===//")
256 pcmd
("#ifndef SANITIZER_NETBSD_SYSCALL_HOOKS_H")
257 pcmd
("#define SANITIZER_NETBSD_SYSCALL_HOOKS_H")
260 for (i =
0; i
< parsedsyscalls
; i
++) {
262 if (i in ifelifelseendif
) {
263 pcmd
(ifelifelseendif
[i
])
269 pcmd
("/* syscall " substr(sn
,2) " has been skipped */")
275 if (syscallargs
[i
] != "void") {
276 inargs = syscallargs
[i
]
277 gsub(/\$
/, ", ", inargs
)
282 if (syscallargs
[i
] != "void") {
283 outargs =
"(long long)(" syscallargs
[i
] ")"
284 gsub(/\$
/, "), (long long)(", outargs
)
287 pcmd
("#define __sanitizer_syscall_pre_" sn
"(" inargs
") \\")
288 pcmd
(" __sanitizer_syscall_pre_impl_" sn
"(" outargs
")")
293 inargs =
"res, " inargs
299 outargs =
"res, " outargs
302 pcmd
("#define __sanitizer_syscall_post_" sn
"(" inargs
") \\")
303 pcmd
(" __sanitizer_syscall_post_impl_" sn
"(" outargs
")")
307 pcmd
("/* Compat with older releases */")
308 pcmd
("#define __sanitizer_syscall_pre_getvfsstat __sanitizer_syscall_pre_compat_90_getvfsstat")
309 pcmd
("#define __sanitizer_syscall_post_getvfsstat __sanitizer_syscall_post_compat_90_getvfsstat")
311 pcmd
("#define __sanitizer_syscall_pre_statvfs1 __sanitizer_syscall_pre_compat_90_statvfs1")
312 pcmd
("#define __sanitizer_syscall_post_statvfs1 __sanitizer_syscall_post_compat_90_statvfs1")
314 pcmd
("#define __sanitizer_syscall_pre_fstatvfs1 __sanitizer_syscall_pre_compat_90_fstatvfs1")
315 pcmd
("#define __sanitizer_syscall_post_fstatvfs1 __sanitizer_syscall_post_compat_90_fstatvfs1")
317 pcmd
("#define __sanitizer_syscall_pre___fhstatvfs140 __sanitizer_syscall_pre_compat_90_fhstatvfs1")
318 pcmd
("#define __sanitizer_syscall_post___fhstatvfs140 __sanitizer_syscall_post_compat_90_fhstatvfs1")
321 pcmd
("#ifdef __cplusplus")
322 pcmd
("extern \"C\" {")
325 pcmd
("// Private declarations. Do not call directly from user code. Use macros above.")
327 pcmd
("// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!")
330 for (i =
0; i
< parsedsyscalls
; i
++) {
332 if (i in ifelifelseendif
) {
333 pcmd
(ifelifelseendif
[i
])
339 pcmd
("/* syscall " substr(sn
,2) " has been skipped */")
343 preargs = syscallargs
[i
]
345 if (preargs
!= "void") {
346 preargs =
"long long " preargs
347 gsub(/\$
/, ", long long ", preargs
)
350 if (preargs ==
"void") {
351 postargs =
"long long res"
353 postargs =
"long long res, " preargs
356 pcmd
("void __sanitizer_syscall_pre_impl_" sn
"(" preargs
");")
357 pcmd
("void __sanitizer_syscall_post_impl_" sn
"(" postargs
");")
361 pcmd
("#ifdef __cplusplus")
362 pcmd
("} // extern \"C\"")
366 pcmd
("// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!")
369 pcmd
("#endif // SANITIZER_NETBSD_SYSCALL_HOOKS_H")
373 # Generate sanitizer_syscalls_netbsd.inc
376 cmd = clangformat
" > " outputinc
378 pcmd
("//===-- sanitizer_syscalls_netbsd.inc ---------------------------*- C++ -*-===//")
380 pcmd
("// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.")
381 pcmd
("// See https://llvm.org/LICENSE.txt for license information.")
382 pcmd
("// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception")
384 pcmd
("//===----------------------------------------------------------------------===//")
386 pcmd
("// Common syscalls handlers for tools like AddressSanitizer,")
387 pcmd
("// ThreadSanitizer, MemorySanitizer, etc.")
389 pcmd
("// This file should be included into the tool's interceptor file,")
390 pcmd
("// which has to define it's own macros:")
391 pcmd
("// COMMON_SYSCALL_PRE_READ_RANGE")
392 pcmd
("// Called in prehook for regions that will be read by the kernel and")
393 pcmd
("// must be initialized.")
394 pcmd
("// COMMON_SYSCALL_PRE_WRITE_RANGE")
395 pcmd
("// Called in prehook for regions that will be written to by the kernel")
396 pcmd
("// and must be addressable. The actual write range may be smaller than")
397 pcmd
("// reported in the prehook. See POST_WRITE_RANGE.")
398 pcmd
("// COMMON_SYSCALL_POST_READ_RANGE")
399 pcmd
("// Called in posthook for regions that were read by the kernel. Does")
400 pcmd
("// not make much sense.")
401 pcmd
("// COMMON_SYSCALL_POST_WRITE_RANGE")
402 pcmd
("// Called in posthook for regions that were written to by the kernel")
403 pcmd
("// and are now initialized.")
404 pcmd
("// COMMON_SYSCALL_ACQUIRE(addr)")
405 pcmd
("// Acquire memory visibility from addr.")
406 pcmd
("// COMMON_SYSCALL_RELEASE(addr)")
407 pcmd
("// Release memory visibility to addr.")
408 pcmd
("// COMMON_SYSCALL_FD_CLOSE(fd)")
409 pcmd
("// Called before closing file descriptor fd.")
410 pcmd
("// COMMON_SYSCALL_FD_ACQUIRE(fd)")
411 pcmd
("// Acquire memory visibility from fd.")
412 pcmd
("// COMMON_SYSCALL_FD_RELEASE(fd)")
413 pcmd
("// Release memory visibility to fd.")
414 pcmd
("// COMMON_SYSCALL_PRE_FORK()")
415 pcmd
("// Called before fork syscall.")
416 pcmd
("// COMMON_SYSCALL_POST_FORK(long long res)")
417 pcmd
("// Called after fork syscall.")
419 pcmd
("// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!")
421 pcmd
("// Generated with: " script_name
)
422 pcmd
("// Generated date: " strftime
("%F"))
423 pcmd
("// Generated from: " syscallmasterversion
)
425 pcmd
("//===----------------------------------------------------------------------===//")
427 pcmd
("#include \"sanitizer_platform.h\"")
428 pcmd
("#if SANITIZER_NETBSD")
430 pcmd
("#include \"sanitizer_libc.h\"")
432 pcmd
("#define PRE_SYSCALL(name) \\")
433 pcmd
(" SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_syscall_pre_impl_##name")
434 pcmd
("#define PRE_READ(p, s) COMMON_SYSCALL_PRE_READ_RANGE(p, s)")
435 pcmd
("#define PRE_WRITE(p, s) COMMON_SYSCALL_PRE_WRITE_RANGE(p, s)")
437 pcmd
("#define POST_SYSCALL(name) \\")
438 pcmd
(" SANITIZER_INTERFACE_ATTRIBUTE void __sanitizer_syscall_post_impl_##name")
439 pcmd
("#define POST_READ(p, s) COMMON_SYSCALL_POST_READ_RANGE(p, s)")
440 pcmd
("#define POST_WRITE(p, s) COMMON_SYSCALL_POST_WRITE_RANGE(p, s)")
442 pcmd
("#ifndef COMMON_SYSCALL_ACQUIRE")
443 pcmd
("# define COMMON_SYSCALL_ACQUIRE(addr) ((void)(addr))")
446 pcmd
("#ifndef COMMON_SYSCALL_RELEASE")
447 pcmd
("# define COMMON_SYSCALL_RELEASE(addr) ((void)(addr))")
450 pcmd
("#ifndef COMMON_SYSCALL_FD_CLOSE")
451 pcmd
("# define COMMON_SYSCALL_FD_CLOSE(fd) ((void)(fd))")
454 pcmd
("#ifndef COMMON_SYSCALL_FD_ACQUIRE")
455 pcmd
("# define COMMON_SYSCALL_FD_ACQUIRE(fd) ((void)(fd))")
458 pcmd
("#ifndef COMMON_SYSCALL_FD_RELEASE")
459 pcmd
("# define COMMON_SYSCALL_FD_RELEASE(fd) ((void)(fd))")
462 pcmd
("#ifndef COMMON_SYSCALL_PRE_FORK")
463 pcmd
("# define COMMON_SYSCALL_PRE_FORK() {}")
466 pcmd
("#ifndef COMMON_SYSCALL_POST_FORK")
467 pcmd
("# define COMMON_SYSCALL_POST_FORK(res) {}")
470 pcmd
("// FIXME: do some kind of PRE_READ for all syscall arguments (int(s) and such).")
472 pcmd
("extern \"C\" {")
473 pcmd
("#define SYS_MAXSYSARGS " SYS_MAXSYSARGS
)
475 for (i =
0; i
< parsedsyscalls
; i
++) {
477 if (i in ifelifelseendif
) {
478 pcmd
(ifelifelseendif
[i
])
484 pcmd
("/* syscall " substr(sn
,2) " has been skipped */")
488 preargs = syscallfullargs
[i
]
490 if (preargs
!= "void") {
491 preargs =
"long long " preargs
492 gsub(/\$
/, ", long long ", preargs
)
493 gsub(/long long \
*/, "void *", preargs
)
496 if (preargs ==
"void") {
497 postargs =
"long long res"
499 postargs =
"long long res, " preargs
502 pcmd
("PRE_SYSCALL(" sn
")(" preargs
")")
504 syscall_body
(sn
, "pre")
507 pcmd
("POST_SYSCALL(" sn
")(" postargs
")")
509 syscall_body
(sn
, "post")
513 pcmd
("#undef SYS_MAXSYSARGS")
514 pcmd
("} // extern \"C\"")
516 pcmd
("#undef PRE_SYSCALL")
517 pcmd
("#undef PRE_READ")
518 pcmd
("#undef PRE_WRITE")
519 pcmd
("#undef POST_SYSCALL")
520 pcmd
("#undef POST_READ")
521 pcmd
("#undef POST_WRITE")
523 pcmd
("#endif // SANITIZER_NETBSD")
527 # Hack for preprocessed code
528 system("sed -i 's,^ \\([^ ]\\), \\1,' " outputinc
)
533 print "Usage: " script_name
" syscalls.master"
538 function pcmd
(string
)
543 function syscall_body
(syscall
, mode
)
545 # Hardcode sanitizing rules here
546 # These syscalls don't change often so they are hand coded
547 if (syscall ==
"syscall") {
548 pcmd
("/* Nothing to do */")
549 } else if (syscall ==
"exit") {
550 pcmd
("/* Nothing to do */")
551 } else if (syscall ==
"fork") {
553 pcmd
("COMMON_SYSCALL_PRE_FORK();")
555 pcmd
("COMMON_SYSCALL_POST_FORK(res);")
557 } else if (syscall ==
"read") {
560 pcmd
(" PRE_WRITE(buf_, nbyte_);")
563 pcmd
("if (res > 0) {")
564 pcmd
(" POST_WRITE(buf_, res);")
567 } else if (syscall ==
"write") {
570 pcmd
(" PRE_READ(buf_, nbyte_);")
573 pcmd
("if (res > 0) {")
574 pcmd
(" POST_READ(buf_, res);")
577 } else if (syscall ==
"open") {
579 pcmd
("const char *path = (const char *)path_;")
581 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
584 pcmd
("if (res > 0) {")
585 pcmd
(" const char *path = (const char *)path_;")
587 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
591 } else if (syscall ==
"close") {
593 pcmd
("COMMON_SYSCALL_FD_CLOSE((int)fd_);")
595 pcmd
("/* Nothing to do */")
597 } else if (syscall ==
"compat_50_wait4") {
599 } else if (syscall ==
"compat_43_ocreat") {
601 } else if (syscall ==
"link") {
603 pcmd
("const char *path = (const char *)path_;")
604 pcmd
("const char *link = (const char *)link_;")
606 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
609 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(link) + 1);")
612 pcmd
("if (res == 0) {")
613 pcmd
(" const char *path = (const char *)path_;")
614 pcmd
(" const char *link = (const char *)link_;")
616 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
619 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(link) + 1);")
623 } else if (syscall ==
"unlink") {
625 pcmd
("const char *path = (const char *)path_;")
627 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
630 pcmd
("if (res == 0) {")
631 pcmd
(" const char *path = (const char *)path_;")
633 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
637 } else if (syscall ==
"chdir") {
639 pcmd
("const char *path = (const char *)path_;")
641 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
644 pcmd
("if (res == 0) {")
645 pcmd
(" const char *path = (const char *)path_;")
647 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
651 } else if (syscall ==
"fchdir") {
652 pcmd
("/* Nothing to do */")
653 } else if (syscall ==
"compat_50_mknod") {
655 } else if (syscall ==
"chmod") {
657 pcmd
("const char *path = (const char *)path_;")
659 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
662 pcmd
("if (res == 0) {")
663 pcmd
(" const char *path = (const char *)path_;")
665 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
669 } else if (syscall ==
"chown") {
671 pcmd
("const char *path = (const char *)path_;")
673 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
676 pcmd
("if (res == 0) {")
677 pcmd
(" const char *path = (const char *)path_;")
679 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
683 } else if (syscall ==
"break") {
684 pcmd
("/* Nothing to do */")
685 } else if (syscall ==
"compat_20_getfsstat") {
687 } else if (syscall ==
"compat_43_olseek") {
689 } else if (syscall ==
"getpid") {
690 pcmd
("/* Nothing to do */")
691 } else if (syscall ==
"compat_40_mount") {
693 } else if (syscall ==
"unmount") {
695 pcmd
("const char *path = (const char *)path_;")
697 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
700 pcmd
("if (res == 0) {")
701 pcmd
(" const char *path = (const char *)path_;")
703 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
707 } else if (syscall ==
"setuid") {
708 pcmd
("/* Nothing to do */")
709 } else if (syscall ==
"getuid") {
710 pcmd
("/* Nothing to do */")
711 } else if (syscall ==
"geteuid") {
712 pcmd
("/* Nothing to do */")
713 } else if (syscall ==
"ptrace") {
715 pcmd
("if (req_ == ptrace_pt_io) {")
716 pcmd
(" struct __sanitizer_ptrace_io_desc *addr = (struct __sanitizer_ptrace_io_desc *)addr_;")
717 pcmd
(" PRE_READ(addr, struct_ptrace_ptrace_io_desc_struct_sz);")
718 pcmd
(" if (addr->piod_op == ptrace_piod_write_d || addr->piod_op == ptrace_piod_write_i) {")
719 pcmd
(" PRE_READ(addr->piod_addr, addr->piod_len);")
721 pcmd
(" if (addr->piod_op == ptrace_piod_read_d || addr->piod_op == ptrace_piod_read_i || addr->piod_op == ptrace_piod_read_auxv) {")
722 pcmd
(" PRE_WRITE(addr->piod_addr, addr->piod_len);")
724 pcmd
("} else if (req_ == ptrace_pt_lwpinfo) {")
725 pcmd
(" struct __sanitizer_ptrace_lwpinfo *addr = (struct __sanitizer_ptrace_lwpinfo *)addr_;")
726 pcmd
(" PRE_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
727 pcmd
(" PRE_WRITE(addr, struct_ptrace_ptrace_lwpinfo_struct_sz);")
728 pcmd
("} else if (req_ == ptrace_pt_set_event_mask) {")
729 pcmd
(" PRE_READ(addr_, struct_ptrace_ptrace_event_struct_sz);")
730 pcmd
("} else if (req_ == ptrace_pt_get_event_mask) {")
731 pcmd
(" PRE_WRITE(addr_, struct_ptrace_ptrace_event_struct_sz);")
732 pcmd
("} else if (req_ == ptrace_pt_set_siginfo) {")
733 pcmd
(" PRE_READ(addr_, struct_ptrace_ptrace_siginfo_struct_sz);")
734 pcmd
("} else if (req_ == ptrace_pt_get_siginfo) {")
735 pcmd
(" PRE_WRITE(addr_, struct_ptrace_ptrace_siginfo_struct_sz);")
736 pcmd
("} else if (req_ == ptrace_pt_lwpstatus) {")
737 pcmd
(" struct __sanitizer_ptrace_lwpstatus *addr = (struct __sanitizer_ptrace_lwpstatus *)addr_;")
738 pcmd
(" PRE_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
739 pcmd
(" PRE_WRITE(addr, struct_ptrace_ptrace_lwpstatus_struct_sz);")
740 pcmd
("} else if (req_ == ptrace_pt_lwpnext) {")
741 pcmd
(" struct __sanitizer_ptrace_lwpstatus *addr = (struct __sanitizer_ptrace_lwpstatus *)addr_;")
742 pcmd
(" PRE_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
743 pcmd
(" PRE_WRITE(addr, struct_ptrace_ptrace_lwpstatus_struct_sz);")
744 pcmd
("} else if (req_ == ptrace_pt_setregs) {")
745 pcmd
(" PRE_READ(addr_, struct_ptrace_reg_struct_sz);")
746 pcmd
("} else if (req_ == ptrace_pt_getregs) {")
747 pcmd
(" PRE_WRITE(addr_, struct_ptrace_reg_struct_sz);")
748 pcmd
("} else if (req_ == ptrace_pt_setfpregs) {")
749 pcmd
(" PRE_READ(addr_, struct_ptrace_fpreg_struct_sz);")
750 pcmd
("} else if (req_ == ptrace_pt_getfpregs) {")
751 pcmd
(" PRE_WRITE(addr_, struct_ptrace_fpreg_struct_sz);")
752 pcmd
("} else if (req_ == ptrace_pt_setdbregs) {")
753 pcmd
(" PRE_READ(addr_, struct_ptrace_dbreg_struct_sz);")
754 pcmd
("} else if (req_ == ptrace_pt_getdbregs) {")
755 pcmd
(" PRE_WRITE(addr_, struct_ptrace_dbreg_struct_sz);")
758 pcmd
("if (res == 0) {")
759 pcmd
(" if (req_ == ptrace_pt_io) {")
760 pcmd
(" struct __sanitizer_ptrace_io_desc *addr = (struct __sanitizer_ptrace_io_desc *)addr_;")
761 pcmd
(" POST_READ(addr, struct_ptrace_ptrace_io_desc_struct_sz);")
762 pcmd
(" if (addr->piod_op == ptrace_piod_write_d || addr->piod_op == ptrace_piod_write_i) {")
763 pcmd
(" POST_READ(addr->piod_addr, addr->piod_len);")
765 pcmd
(" if (addr->piod_op == ptrace_piod_read_d || addr->piod_op == ptrace_piod_read_i || addr->piod_op == ptrace_piod_read_auxv) {")
766 pcmd
(" POST_WRITE(addr->piod_addr, addr->piod_len);")
768 pcmd
(" } else if (req_ == ptrace_pt_lwpinfo) {")
769 pcmd
(" struct __sanitizer_ptrace_lwpinfo *addr = (struct __sanitizer_ptrace_lwpinfo *)addr_;")
770 pcmd
(" POST_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
771 pcmd
(" POST_WRITE(addr, struct_ptrace_ptrace_lwpinfo_struct_sz);")
772 pcmd
(" } else if (req_ == ptrace_pt_set_event_mask) {")
773 pcmd
(" POST_READ(addr_, struct_ptrace_ptrace_event_struct_sz);")
774 pcmd
(" } else if (req_ == ptrace_pt_get_event_mask) {")
775 pcmd
(" POST_WRITE(addr_, struct_ptrace_ptrace_event_struct_sz);")
776 pcmd
(" } else if (req_ == ptrace_pt_set_siginfo) {")
777 pcmd
(" POST_READ(addr_, struct_ptrace_ptrace_siginfo_struct_sz);")
778 pcmd
(" } else if (req_ == ptrace_pt_get_siginfo) {")
779 pcmd
(" POST_WRITE(addr_, struct_ptrace_ptrace_siginfo_struct_sz);")
780 pcmd
(" } else if (req_ == ptrace_pt_lwpstatus) {")
781 pcmd
(" struct __sanitizer_ptrace_lwpstatus *addr = (struct __sanitizer_ptrace_lwpstatus *)addr_;")
782 pcmd
(" POST_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
783 pcmd
(" POST_WRITE(addr, struct_ptrace_ptrace_lwpstatus_struct_sz);")
784 pcmd
(" } else if (req_ == ptrace_pt_lwpnext) {")
785 pcmd
(" struct __sanitizer_ptrace_lwpstatus *addr = (struct __sanitizer_ptrace_lwpstatus *)addr_;")
786 pcmd
(" POST_READ(&addr->pl_lwpid, sizeof(__sanitizer_lwpid_t));")
787 pcmd
(" POST_WRITE(addr, struct_ptrace_ptrace_lwpstatus_struct_sz);")
788 pcmd
(" } else if (req_ == ptrace_pt_setregs) {")
789 pcmd
(" POST_READ(addr_, struct_ptrace_reg_struct_sz);")
790 pcmd
(" } else if (req_ == ptrace_pt_getregs) {")
791 pcmd
(" POST_WRITE(addr_, struct_ptrace_reg_struct_sz);")
792 pcmd
(" } else if (req_ == ptrace_pt_setfpregs) {")
793 pcmd
(" POST_READ(addr_, struct_ptrace_fpreg_struct_sz);")
794 pcmd
(" } else if (req_ == ptrace_pt_getfpregs) {")
795 pcmd
(" POST_WRITE(addr_, struct_ptrace_fpreg_struct_sz);")
796 pcmd
(" } else if (req_ == ptrace_pt_setdbregs) {")
797 pcmd
(" POST_READ(addr_, struct_ptrace_dbreg_struct_sz);")
798 pcmd
(" } else if (req_ == ptrace_pt_getdbregs) {")
799 pcmd
(" POST_WRITE(addr_, struct_ptrace_dbreg_struct_sz);")
803 } else if (syscall ==
"recvmsg") {
805 pcmd
("PRE_WRITE(msg_, sizeof(__sanitizer_msghdr));")
807 pcmd
("if (res > 0) {")
808 pcmd
(" POST_WRITE(msg_, sizeof(__sanitizer_msghdr));")
811 } else if (syscall ==
"sendmsg") {
813 pcmd
("PRE_READ(msg_, sizeof(__sanitizer_msghdr));")
815 pcmd
("if (res > 0) {")
816 pcmd
(" POST_READ(msg_, sizeof(__sanitizer_msghdr));")
819 } else if (syscall ==
"recvfrom") {
821 pcmd
("PRE_WRITE(buf_, len_);")
822 pcmd
("PRE_WRITE(from_, struct_sockaddr_sz);")
823 pcmd
("PRE_WRITE(fromlenaddr_, sizeof(__sanitizer_socklen_t));")
825 pcmd
("if (res >= 0) {")
826 pcmd
(" POST_WRITE(buf_, res);")
827 pcmd
(" POST_WRITE(from_, struct_sockaddr_sz);")
828 pcmd
(" POST_WRITE(fromlenaddr_, sizeof(__sanitizer_socklen_t));")
831 } else if (syscall ==
"accept") {
833 pcmd
("PRE_WRITE(name_, struct_sockaddr_sz);")
834 pcmd
("PRE_WRITE(anamelen_, sizeof(__sanitizer_socklen_t));")
836 pcmd
("if (res == 0) {")
837 pcmd
(" POST_WRITE(name_, struct_sockaddr_sz);")
838 pcmd
(" POST_WRITE(anamelen_, sizeof(__sanitizer_socklen_t));")
841 } else if (syscall ==
"getpeername") {
843 pcmd
("PRE_WRITE(asa_, struct_sockaddr_sz);")
844 pcmd
("PRE_WRITE(alen_, sizeof(__sanitizer_socklen_t));")
846 pcmd
("if (res == 0) {")
847 pcmd
(" POST_WRITE(asa_, struct_sockaddr_sz);")
848 pcmd
(" POST_WRITE(alen_, sizeof(__sanitizer_socklen_t));")
851 } else if (syscall ==
"getsockname") {
853 pcmd
("PRE_WRITE(asa_, struct_sockaddr_sz);")
854 pcmd
("PRE_WRITE(alen_, sizeof(__sanitizer_socklen_t));")
856 pcmd
("if (res == 0) {")
857 pcmd
(" POST_WRITE(asa_, struct_sockaddr_sz);")
858 pcmd
(" POST_WRITE(alen_, sizeof(__sanitizer_socklen_t));")
861 } else if (syscall ==
"access") {
863 pcmd
("const char *path = (const char *)path_;")
865 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
868 pcmd
("if (res == 0) {")
869 pcmd
(" const char *path = (const char *)path_;")
871 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
875 } else if (syscall ==
"chflags") {
877 pcmd
("const char *path = (const char *)path_;")
879 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
882 pcmd
("if (res == 0) {")
883 pcmd
(" const char *path = (const char *)path_;")
885 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
889 } else if (syscall ==
"fchflags") {
890 pcmd
("/* Nothing to do */")
891 } else if (syscall ==
"sync") {
892 pcmd
("/* Nothing to do */")
893 } else if (syscall ==
"kill") {
894 pcmd
("/* Nothing to do */")
895 } else if (syscall ==
"compat_43_stat43") {
897 } else if (syscall ==
"getppid") {
898 pcmd
("/* Nothing to do */")
899 } else if (syscall ==
"compat_43_lstat43") {
901 } else if (syscall ==
"dup") {
902 pcmd
("/* Nothing to do */")
903 } else if (syscall ==
"pipe") {
904 pcmd
("/* pipe returns two descriptors through two returned values */")
905 } else if (syscall ==
"getegid") {
906 pcmd
("/* Nothing to do */")
907 } else if (syscall ==
"profil") {
909 pcmd
("if (samples_) {")
910 pcmd
(" PRE_WRITE(samples_, size_);")
913 pcmd
("if (res == 0) {")
914 pcmd
(" if (samples_) {")
915 pcmd
(" POST_WRITE(samples_, size_);")
919 } else if (syscall ==
"ktrace") {
921 pcmd
("const char *fname = (const char *)fname_;")
923 pcmd
(" PRE_READ(fname, __sanitizer::internal_strlen(fname) + 1);")
926 pcmd
("const char *fname = (const char *)fname_;")
927 pcmd
("if (res == 0) {")
928 pcmd
(" if (fname) {")
929 pcmd
(" POST_READ(fname, __sanitizer::internal_strlen(fname) + 1);")
933 } else if (syscall ==
"compat_13_sigaction13") {
935 } else if (syscall ==
"getgid") {
936 pcmd
("/* Nothing to do */")
937 } else if (syscall ==
"compat_13_sigprocmask13") {
939 } else if (syscall ==
"__getlogin") {
941 pcmd
("if (namebuf_) {")
942 pcmd
(" PRE_WRITE(namebuf_, namelen_);")
945 pcmd
("if (res == 0) {")
946 pcmd
(" if (namebuf_) {")
947 pcmd
(" POST_WRITE(namebuf_, namelen_);")
951 } else if (syscall ==
"__setlogin") {
953 pcmd
("const char *namebuf = (const char *)namebuf_;")
954 pcmd
("if (namebuf) {")
955 pcmd
(" PRE_READ(namebuf, __sanitizer::internal_strlen(namebuf) + 1);")
958 pcmd
("if (res == 0) {")
959 pcmd
(" const char *namebuf = (const char *)namebuf_;")
960 pcmd
(" if (namebuf) {")
961 pcmd
(" POST_READ(namebuf, __sanitizer::internal_strlen(namebuf) + 1);")
965 } else if (syscall ==
"acct") {
967 pcmd
("const char *path = (const char *)path_;")
969 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
972 pcmd
("if (res == 0) {")
973 pcmd
(" const char *path = (const char *)path_;")
975 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
979 } else if (syscall ==
"compat_13_sigpending13") {
981 } else if (syscall ==
"compat_13_sigaltstack13") {
983 } else if (syscall ==
"ioctl") {
984 pcmd
("/* Nothing to do */")
985 } else if (syscall ==
"compat_12_oreboot") {
987 } else if (syscall ==
"revoke") {
989 pcmd
("const char *path = (const char *)path_;")
991 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
994 pcmd
("if (res == 0) {")
995 pcmd
(" const char *path = (const char *)path_;")
997 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1001 } else if (syscall ==
"symlink") {
1002 if (mode ==
"pre") {
1003 pcmd
("const char *path = (const char *)path_;")
1004 pcmd
("const char *link = (const char *)link_;")
1006 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1009 pcmd
(" PRE_READ(link, __sanitizer::internal_strlen(link) + 1);")
1012 pcmd
("if (res == 0) {")
1013 pcmd
(" const char *path = (const char *)path_;")
1014 pcmd
(" const char *link = (const char *)link_;")
1015 pcmd
(" if (path) {")
1016 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1018 pcmd
(" if (link) {")
1019 pcmd
(" POST_READ(link, __sanitizer::internal_strlen(link) + 1);")
1023 } else if (syscall ==
"readlink") {
1024 if (mode ==
"pre") {
1025 pcmd
("const char *path = (const char *)path_;")
1027 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1030 pcmd
(" PRE_WRITE(buf_, count_);")
1033 pcmd
("if (res > 0) {")
1034 pcmd
(" const char *path = (const char *)path_;")
1035 pcmd
(" if (path) {")
1036 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1038 pcmd
(" if (buf_) {")
1039 pcmd
(" PRE_WRITE(buf_, res);")
1043 } else if (syscall ==
"execve") {
1044 if (mode ==
"pre") {
1045 pcmd
("const char *path = (const char *)path_;")
1046 pcmd
("char **argp = (char **)argp_;")
1047 pcmd
("char **envp = (char **)envp_;")
1049 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1051 pcmd
("if (argp && argp[0]) {")
1052 pcmd
(" char *a = argp[0];")
1053 pcmd
(" while (a++) {")
1054 pcmd
(" PRE_READ(a, __sanitizer::internal_strlen(a) + 1);")
1057 pcmd
("if (envp && envp[0]) {")
1058 pcmd
(" char *e = envp[0];")
1059 pcmd
(" while (e++) {")
1060 pcmd
(" PRE_READ(e, __sanitizer::internal_strlen(e) + 1);")
1064 pcmd
("/* If we are here, something went wrong */")
1065 pcmd
("const char *path = (const char *)path_;")
1066 pcmd
("char **argp = (char **)argp_;")
1067 pcmd
("char **envp = (char **)envp_;")
1069 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1071 pcmd
("if (argp && argp[0]) {")
1072 pcmd
(" char *a = argp[0];")
1073 pcmd
(" while (a++) {")
1074 pcmd
(" POST_READ(a, __sanitizer::internal_strlen(a) + 1);")
1077 pcmd
("if (envp && envp[0]) {")
1078 pcmd
(" char *e = envp[0];")
1079 pcmd
(" while (e++) {")
1080 pcmd
(" POST_READ(e, __sanitizer::internal_strlen(e) + 1);")
1084 } else if (syscall ==
"umask") {
1085 pcmd
("/* Nothing to do */")
1086 } else if (syscall ==
"chroot") {
1087 if (mode ==
"pre") {
1088 pcmd
("const char *path = (const char *)path_;")
1090 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1093 pcmd
("if (res == 0) {")
1094 pcmd
(" const char *path = (const char *)path_;")
1095 pcmd
(" if (path) {")
1096 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1100 } else if (syscall ==
"compat_43_fstat43") {
1102 } else if (syscall ==
"compat_43_ogetkerninfo") {
1104 } else if (syscall ==
"compat_43_ogetpagesize") {
1106 } else if (syscall ==
"compat_12_msync") {
1108 } else if (syscall ==
"vfork") {
1109 pcmd
("/* Nothing to do */")
1110 } else if (syscall ==
"compat_43_ommap") {
1112 } else if (syscall ==
"vadvise") {
1113 pcmd
("/* Nothing to do */")
1114 } else if (syscall ==
"munmap") {
1115 pcmd
("/* Nothing to do */")
1116 } else if (syscall ==
"mprotect") {
1117 pcmd
("/* Nothing to do */")
1118 } else if (syscall ==
"madvise") {
1119 pcmd
("/* Nothing to do */")
1120 } else if (syscall ==
"mincore") {
1121 pcmd
("/* Nothing to do */")
1122 } else if (syscall ==
"getgroups") {
1123 if (mode ==
"pre") {
1124 pcmd
("unsigned int *gidset = (unsigned int *)gidset_;")
1125 pcmd
("if (gidset) {")
1126 pcmd
(" PRE_WRITE(gidset, sizeof(*gidset) * gidsetsize_);")
1129 pcmd
("if (res == 0) {")
1130 pcmd
(" unsigned int *gidset = (unsigned int *)gidset_;")
1131 pcmd
(" if (gidset) {")
1132 pcmd
(" POST_WRITE(gidset, sizeof(*gidset) * gidsetsize_);")
1136 } else if (syscall ==
"setgroups") {
1137 if (mode ==
"pre") {
1138 pcmd
("unsigned int *gidset = (unsigned int *)gidset_;")
1139 pcmd
("if (gidset) {")
1140 pcmd
(" PRE_READ(gidset, sizeof(*gidset) * gidsetsize_);")
1143 pcmd
("if (res == 0) {")
1144 pcmd
(" unsigned int *gidset = (unsigned int *)gidset_;")
1145 pcmd
(" if (gidset) {")
1146 pcmd
(" POST_READ(gidset, sizeof(*gidset) * gidsetsize_);")
1150 } else if (syscall ==
"getpgrp") {
1151 pcmd
("/* Nothing to do */")
1152 } else if (syscall ==
"setpgid") {
1153 pcmd
("/* Nothing to do */")
1154 } else if (syscall ==
"compat_50_setitimer") {
1156 } else if (syscall ==
"compat_43_owait") {
1158 } else if (syscall ==
"compat_12_oswapon") {
1160 } else if (syscall ==
"compat_50_getitimer") {
1162 } else if (syscall ==
"compat_43_ogethostname") {
1164 } else if (syscall ==
"compat_43_osethostname") {
1166 } else if (syscall ==
"compat_43_ogetdtablesize") {
1168 } else if (syscall ==
"dup2") {
1169 pcmd
("/* Nothing to do */")
1170 } else if (syscall ==
"getrandom") {
1172 } else if (syscall ==
"fcntl") {
1173 pcmd
("/* Nothing to do */")
1174 } else if (syscall ==
"compat_50_select") {
1176 } else if (syscall ==
"fsync") {
1177 pcmd
("/* Nothing to do */")
1178 } else if (syscall ==
"setpriority") {
1179 pcmd
("/* Nothing to do */")
1180 } else if (syscall ==
"compat_30_socket") {
1182 } else if (syscall ==
"connect") {
1183 if (mode ==
"pre") {
1184 pcmd
("PRE_READ(name_, namelen_);")
1186 pcmd
("if (res == 0) {")
1187 pcmd
(" POST_READ(name_, namelen_);")
1190 } else if (syscall ==
"compat_43_oaccept") {
1192 } else if (syscall ==
"getpriority") {
1193 pcmd
("/* Nothing to do */")
1194 } else if (syscall ==
"compat_43_osend") {
1196 } else if (syscall ==
"compat_43_orecv") {
1198 } else if (syscall ==
"compat_13_sigreturn13") {
1200 } else if (syscall ==
"bind") {
1201 if (mode ==
"pre") {
1202 pcmd
("PRE_READ(name_, namelen_);")
1204 pcmd
("if (res == 0) {")
1205 pcmd
(" PRE_READ(name_, namelen_);")
1208 } else if (syscall ==
"setsockopt") {
1209 if (mode ==
"pre") {
1211 pcmd
(" PRE_READ(val_, valsize_);")
1214 pcmd
("if (res == 0) {")
1215 pcmd
(" if (val_) {")
1216 pcmd
(" POST_READ(val_, valsize_);")
1220 } else if (syscall ==
"listen") {
1221 pcmd
("/* Nothing to do */")
1222 } else if (syscall ==
"compat_43_osigvec") {
1224 } else if (syscall ==
"compat_43_osigblock") {
1226 } else if (syscall ==
"compat_43_osigsetmask") {
1228 } else if (syscall ==
"compat_13_sigsuspend13") {
1230 } else if (syscall ==
"compat_43_osigstack") {
1232 } else if (syscall ==
"compat_43_orecvmsg") {
1234 } else if (syscall ==
"compat_43_osendmsg") {
1236 } else if (syscall ==
"compat_50_gettimeofday") {
1238 } else if (syscall ==
"compat_50_getrusage") {
1240 } else if (syscall ==
"getsockopt") {
1242 } else if (syscall ==
"readv") {
1243 if (mode ==
"pre") {
1244 pcmd
("struct __sanitizer_iovec *iovp = (struct __sanitizer_iovec *)iovp_;")
1247 pcmd
(" PRE_READ(iovp, sizeof(struct __sanitizer_iovec) * iovcnt_);")
1248 pcmd
(" for (i = 0; i < iovcnt_; i++) {")
1249 pcmd
(" PRE_WRITE(iovp[i].iov_base, iovp[i].iov_len);")
1253 pcmd
("struct __sanitizer_iovec *iovp = (struct __sanitizer_iovec *)iovp_;")
1255 pcmd
("uptr m, n = res;")
1256 pcmd
("if (res > 0) {")
1257 pcmd
(" if (iovp) {")
1258 pcmd
(" POST_READ(iovp, sizeof(struct __sanitizer_iovec) * iovcnt_);")
1259 pcmd
(" for (i = 0; i < iovcnt_ && n > 0; i++) {")
1260 pcmd
(" m = n > iovp[i].iov_len ? iovp[i].iov_len : n;")
1261 pcmd
(" POST_WRITE(iovp[i].iov_base, m);")
1267 } else if (syscall ==
"writev") {
1268 if (mode ==
"pre") {
1269 pcmd
("struct __sanitizer_iovec *iovp = (struct __sanitizer_iovec *)iovp_;")
1272 pcmd
(" PRE_READ(iovp, sizeof(struct __sanitizer_iovec) * iovcnt_);")
1273 pcmd
(" for (i = 0; i < iovcnt_; i++) {")
1274 pcmd
(" PRE_READ(iovp[i].iov_base, iovp[i].iov_len);")
1278 pcmd
("struct __sanitizer_iovec *iovp = (struct __sanitizer_iovec *)iovp_;")
1280 pcmd
("uptr m, n = res;")
1281 pcmd
("if (res > 0) {")
1282 pcmd
(" if (iovp) {")
1283 pcmd
(" POST_READ(iovp, sizeof(struct __sanitizer_iovec) * iovcnt_);")
1284 pcmd
(" for (i = 0; i < iovcnt_ && n > 0; i++) {")
1285 pcmd
(" m = n > iovp[i].iov_len ? iovp[i].iov_len : n;")
1286 pcmd
(" POST_READ(iovp[i].iov_base, m);")
1292 } else if (syscall ==
"compat_50_settimeofday") {
1294 } else if (syscall ==
"fchown") {
1295 pcmd
("/* Nothing to do */")
1296 } else if (syscall ==
"fchmod") {
1297 pcmd
("/* Nothing to do */")
1298 } else if (syscall ==
"compat_43_orecvfrom") {
1300 } else if (syscall ==
"setreuid") {
1301 pcmd
("/* Nothing to do */")
1302 } else if (syscall ==
"setregid") {
1303 pcmd
("/* Nothing to do */")
1304 } else if (syscall ==
"rename") {
1305 if (mode ==
"pre") {
1306 pcmd
("const char *from = (const char *)from_;")
1307 pcmd
("const char *to = (const char *)to_;")
1309 pcmd
(" PRE_READ(from, __sanitizer::internal_strlen(from) + 1);")
1312 pcmd
(" PRE_READ(to, __sanitizer::internal_strlen(to) + 1);")
1315 pcmd
("if (res == 0) {")
1316 pcmd
(" const char *from = (const char *)from_;")
1317 pcmd
(" const char *to = (const char *)to_;")
1318 pcmd
(" if (from) {")
1319 pcmd
(" POST_READ(from, __sanitizer::internal_strlen(from) + 1);")
1322 pcmd
(" POST_READ(to, __sanitizer::internal_strlen(to) + 1);")
1326 } else if (syscall ==
"compat_43_otruncate") {
1328 } else if (syscall ==
"compat_43_oftruncate") {
1330 } else if (syscall ==
"flock") {
1331 pcmd
("/* Nothing to do */")
1332 } else if (syscall ==
"mkfifo") {
1333 if (mode ==
"pre") {
1334 pcmd
("const char *path = (const char *)path_;")
1336 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1339 pcmd
("if (res == 0) {")
1340 pcmd
(" const char *path = (const char *)path_;")
1341 pcmd
(" if (path) {")
1342 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1346 } else if (syscall ==
"sendto") {
1347 if (mode ==
"pre") {
1348 pcmd
("PRE_READ(buf_, len_);")
1349 pcmd
("PRE_READ(to_, tolen_);")
1351 pcmd
("if (res >= 0) {")
1352 pcmd
(" POST_READ(buf_, len_);")
1353 pcmd
(" POST_READ(to_, tolen_);")
1356 } else if (syscall ==
"shutdown") {
1357 pcmd
("/* Nothing to do */")
1358 } else if (syscall ==
"socketpair") {
1359 if (mode ==
"pre") {
1360 pcmd
("PRE_WRITE(rsv_, 2 * sizeof(int));")
1362 pcmd
("if (res == 0) {")
1363 pcmd
(" POST_WRITE(rsv_, 2 * sizeof(int));")
1366 } else if (syscall ==
"mkdir") {
1367 if (mode ==
"pre") {
1368 pcmd
("const char *path = (const char *)path_;")
1370 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1373 pcmd
("if (res == 0) {")
1374 pcmd
(" const char *path = (const char *)path_;")
1375 pcmd
(" if (path) {")
1376 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1380 } else if (syscall ==
"rmdir") {
1381 if (mode ==
"pre") {
1382 pcmd
("const char *path = (const char *)path_;")
1384 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1387 pcmd
("if (res == 0) {")
1388 pcmd
(" const char *path = (const char *)path_;")
1389 pcmd
(" if (path) {")
1390 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1394 } else if (syscall ==
"compat_50_utimes") {
1396 } else if (syscall ==
"compat_50_adjtime") {
1398 } else if (syscall ==
"compat_43_ogetpeername") {
1400 } else if (syscall ==
"compat_43_ogethostid") {
1402 } else if (syscall ==
"compat_43_osethostid") {
1404 } else if (syscall ==
"compat_43_ogetrlimit") {
1406 } else if (syscall ==
"compat_43_osetrlimit") {
1408 } else if (syscall ==
"compat_43_okillpg") {
1410 } else if (syscall ==
"setsid") {
1411 pcmd
("/* Nothing to do */")
1412 } else if (syscall ==
"compat_50_quotactl") {
1414 } else if (syscall ==
"compat_43_oquota") {
1416 } else if (syscall ==
"compat_43_ogetsockname") {
1418 } else if (syscall ==
"nfssvc") {
1419 pcmd
("/* Nothing to do */")
1420 } else if (syscall ==
"compat_43_ogetdirentries") {
1422 } else if (syscall ==
"compat_20_statfs") {
1424 } else if (syscall ==
"compat_20_fstatfs") {
1426 } else if (syscall ==
"compat_30_getfh") {
1428 } else if (syscall ==
"compat_09_ogetdomainname") {
1430 } else if (syscall ==
"compat_09_osetdomainname") {
1432 } else if (syscall ==
"compat_09_ouname") {
1434 } else if (syscall ==
"sysarch") {
1436 } else if (syscall ==
"__futex") {
1438 } else if (syscall ==
"__futex_set_robust_list") {
1440 } else if (syscall ==
"__futex_get_robust_list") {
1442 } else if (syscall ==
"compat_10_osemsys") {
1444 } else if (syscall ==
"compat_10_omsgsys") {
1446 } else if (syscall ==
"compat_10_oshmsys") {
1448 } else if (syscall ==
"pread") {
1449 if (mode ==
"pre") {
1451 pcmd
(" PRE_WRITE(buf_, nbyte_);")
1454 pcmd
("if (res > 0) {")
1455 pcmd
(" POST_WRITE(buf_, res);")
1458 } else if (syscall ==
"pwrite") {
1459 if (mode ==
"pre") {
1461 pcmd
(" PRE_READ(buf_, nbyte_);")
1464 pcmd
("if (res > 0) {")
1465 pcmd
(" POST_READ(buf_, res);")
1468 } else if (syscall ==
"compat_30_ntp_gettime") {
1470 } else if (syscall ==
"ntp_adjtime") {
1471 pcmd
("/* Nothing to do */")
1472 } else if (syscall ==
"setgid") {
1473 pcmd
("/* Nothing to do */")
1474 } else if (syscall ==
"setegid") {
1475 pcmd
("/* Nothing to do */")
1476 } else if (syscall ==
"seteuid") {
1477 pcmd
("/* Nothing to do */")
1478 } else if (syscall ==
"lfs_bmapv") {
1480 } else if (syscall ==
"lfs_markv") {
1482 } else if (syscall ==
"lfs_segclean") {
1484 } else if (syscall ==
"compat_50_lfs_segwait") {
1486 } else if (syscall ==
"compat_12_stat12") {
1488 } else if (syscall ==
"compat_12_fstat12") {
1490 } else if (syscall ==
"compat_12_lstat12") {
1492 } else if (syscall ==
"pathconf") {
1493 if (mode ==
"pre") {
1494 pcmd
("const char *path = (const char *)path_;")
1496 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1499 pcmd
("if (res != -1) {")
1500 pcmd
(" const char *path = (const char *)path_;")
1501 pcmd
(" if (path) {")
1502 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1506 } else if (syscall ==
"getsockopt2") {
1508 } else if (syscall ==
"fpathconf") {
1509 pcmd
("/* Nothing to do */")
1510 } else if (syscall ==
"getrlimit") {
1511 if (mode ==
"pre") {
1512 pcmd
("PRE_WRITE(rlp_, struct_rlimit_sz);")
1514 pcmd
("if (res == 0) {")
1515 pcmd
(" POST_WRITE(rlp_, struct_rlimit_sz);")
1518 } else if (syscall ==
"setrlimit") {
1519 if (mode ==
"pre") {
1520 pcmd
("PRE_READ(rlp_, struct_rlimit_sz);")
1522 pcmd
("if (res == 0) {")
1523 pcmd
(" POST_READ(rlp_, struct_rlimit_sz);")
1526 } else if (syscall ==
"compat_12_getdirentries") {
1528 } else if (syscall ==
"mmap") {
1529 pcmd
("/* Nothing to do */")
1530 } else if (syscall ==
"__syscall") {
1531 pcmd
("/* Nothing to do */")
1532 } else if (syscall ==
"lseek") {
1533 pcmd
("/* Nothing to do */")
1534 } else if (syscall ==
"truncate") {
1535 if (mode ==
"pre") {
1536 pcmd
("const char *path = (const char *)path_;")
1538 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1541 pcmd
("if (res == 0) {")
1542 pcmd
(" const char *path = (const char *)path_;")
1543 pcmd
(" if (path) {")
1544 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1548 } else if (syscall ==
"ftruncate") {
1549 pcmd
("/* Nothing to do */")
1550 } else if (syscall ==
"__sysctl") {
1551 if (mode ==
"pre") {
1552 pcmd
("const int *name = (const int *)name_;")
1554 pcmd
(" PRE_READ(name, namelen_ * sizeof(*name));")
1556 pcmd
("if (newv_) {")
1557 pcmd
(" PRE_READ(name, newlen_);")
1560 pcmd
("if (res == 0) {")
1561 pcmd
(" const int *name = (const int *)name_;")
1562 pcmd
(" if (name) {")
1563 pcmd
(" POST_READ(name, namelen_ * sizeof(*name));")
1565 pcmd
(" if (newv_) {")
1566 pcmd
(" POST_READ(name, newlen_);")
1570 } else if (syscall ==
"mlock") {
1571 pcmd
("/* Nothing to do */")
1572 } else if (syscall ==
"munlock") {
1573 pcmd
("/* Nothing to do */")
1574 } else if (syscall ==
"undelete") {
1575 if (mode ==
"pre") {
1576 pcmd
("const char *path = (const char *)path_;")
1578 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1581 pcmd
("if (res == 0) {")
1582 pcmd
(" const char *path = (const char *)path_;")
1583 pcmd
(" if (path) {")
1584 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1588 } else if (syscall ==
"compat_50_futimes") {
1590 } else if (syscall ==
"getpgid") {
1591 pcmd
("/* Nothing to do */")
1592 } else if (syscall ==
"reboot") {
1593 if (mode ==
"pre") {
1594 pcmd
("const char *bootstr = (const char *)bootstr_;")
1595 pcmd
("if (bootstr) {")
1596 pcmd
(" PRE_READ(bootstr, __sanitizer::internal_strlen(bootstr) + 1);")
1599 pcmd
("/* This call should never return */")
1600 pcmd
("const char *bootstr = (const char *)bootstr_;")
1601 pcmd
("if (bootstr) {")
1602 pcmd
(" POST_READ(bootstr, __sanitizer::internal_strlen(bootstr) + 1);")
1605 } else if (syscall ==
"poll") {
1606 pcmd
("/* Nothing to do */")
1607 } else if (syscall ==
"afssys") {
1609 } else if (syscall ==
"compat_14___semctl") {
1611 } else if (syscall ==
"semget") {
1612 pcmd
("/* Nothing to do */")
1613 } else if (syscall ==
"semop") {
1614 if (mode ==
"pre") {
1615 pcmd
("if (sops_) {")
1616 pcmd
(" PRE_READ(sops_, nsops_ * struct_sembuf_sz);")
1619 pcmd
("if (res == 0) {")
1620 pcmd
(" if (sops_) {")
1621 pcmd
(" POST_READ(sops_, nsops_ * struct_sembuf_sz);")
1625 } else if (syscall ==
"semconfig") {
1626 pcmd
("/* Nothing to do */")
1627 } else if (syscall ==
"compat_14_msgctl") {
1629 } else if (syscall ==
"msgget") {
1630 pcmd
("/* Nothing to do */")
1631 } else if (syscall ==
"msgsnd") {
1632 if (mode ==
"pre") {
1633 pcmd
("if (msgp_) {")
1634 pcmd
(" PRE_READ(msgp_, msgsz_);")
1637 pcmd
("if (res == 0) {")
1638 pcmd
(" if (msgp_) {")
1639 pcmd
(" POST_READ(msgp_, msgsz_);")
1643 } else if (syscall ==
"msgrcv") {
1644 pcmd
("/* Nothing to do */")
1645 } else if (syscall ==
"shmat") {
1646 pcmd
("/* Nothing to do */")
1647 } else if (syscall ==
"compat_14_shmctl") {
1649 } else if (syscall ==
"shmdt") {
1650 pcmd
("/* Nothing to do */")
1651 } else if (syscall ==
"shmget") {
1652 pcmd
("/* Nothing to do */")
1653 } else if (syscall ==
"compat_50_clock_gettime") {
1655 } else if (syscall ==
"compat_50_clock_settime") {
1657 } else if (syscall ==
"compat_50_clock_getres") {
1659 } else if (syscall ==
"timer_create") {
1660 pcmd
("/* Nothing to do */")
1661 } else if (syscall ==
"timer_delete") {
1662 pcmd
("/* Nothing to do */")
1663 } else if (syscall ==
"compat_50_timer_settime") {
1665 } else if (syscall ==
"compat_50_timer_gettime") {
1667 } else if (syscall ==
"timer_getoverrun") {
1668 pcmd
("/* Nothing to do */")
1669 } else if (syscall ==
"compat_50_nanosleep") {
1671 } else if (syscall ==
"fdatasync") {
1672 pcmd
("/* Nothing to do */")
1673 } else if (syscall ==
"mlockall") {
1674 pcmd
("/* Nothing to do */")
1675 } else if (syscall ==
"munlockall") {
1676 pcmd
("/* Nothing to do */")
1677 } else if (syscall ==
"compat_50___sigtimedwait") {
1679 } else if (syscall ==
"sigqueueinfo") {
1680 if (mode ==
"pre") {
1681 pcmd
("if (info_) {")
1682 pcmd
(" PRE_READ(info_, siginfo_t_sz);")
1685 } else if (syscall ==
"modctl") {
1687 } else if (syscall ==
"_ksem_init") {
1688 pcmd
("/* Nothing to do */")
1689 } else if (syscall ==
"_ksem_open") {
1690 if (mode ==
"pre") {
1691 pcmd
("const char *name = (const char *)name_;")
1693 pcmd
(" PRE_READ(name, __sanitizer::internal_strlen(name) + 1);")
1696 pcmd
("const char *name = (const char *)name_;")
1698 pcmd
(" POST_READ(name, __sanitizer::internal_strlen(name) + 1);")
1701 } else if (syscall ==
"_ksem_unlink") {
1702 if (mode ==
"pre") {
1703 pcmd
("const char *name = (const char *)name_;")
1705 pcmd
(" PRE_READ(name, __sanitizer::internal_strlen(name) + 1);")
1708 pcmd
("const char *name = (const char *)name_;")
1710 pcmd
(" POST_READ(name, __sanitizer::internal_strlen(name) + 1);")
1713 } else if (syscall ==
"_ksem_close") {
1714 pcmd
("/* Nothing to do */")
1715 } else if (syscall ==
"_ksem_post") {
1716 pcmd
("/* Nothing to do */")
1717 } else if (syscall ==
"_ksem_wait") {
1718 pcmd
("/* Nothing to do */")
1719 } else if (syscall ==
"_ksem_trywait") {
1720 pcmd
("/* Nothing to do */")
1721 } else if (syscall ==
"_ksem_getvalue") {
1722 pcmd
("/* Nothing to do */")
1723 } else if (syscall ==
"_ksem_destroy") {
1724 pcmd
("/* Nothing to do */")
1725 } else if (syscall ==
"_ksem_timedwait") {
1726 if (mode ==
"pre") {
1727 pcmd
("if (abstime_) {")
1728 pcmd
(" PRE_READ(abstime_, struct_timespec_sz);")
1731 } else if (syscall ==
"mq_open") {
1732 if (mode ==
"pre") {
1733 pcmd
("const char *name = (const char *)name_;")
1735 pcmd
(" PRE_READ(name, __sanitizer::internal_strlen(name) + 1);")
1738 pcmd
("const char *name = (const char *)name_;")
1740 pcmd
(" POST_READ(name, __sanitizer::internal_strlen(name) + 1);")
1743 } else if (syscall ==
"mq_close") {
1744 pcmd
("/* Nothing to do */")
1745 } else if (syscall ==
"mq_unlink") {
1746 if (mode ==
"pre") {
1747 pcmd
("const char *name = (const char *)name_;")
1749 pcmd
(" PRE_READ(name, __sanitizer::internal_strlen(name) + 1);")
1752 pcmd
("const char *name = (const char *)name_;")
1754 pcmd
(" POST_READ(name, __sanitizer::internal_strlen(name) + 1);")
1757 } else if (syscall ==
"mq_getattr") {
1758 pcmd
("/* Nothing to do */")
1759 } else if (syscall ==
"mq_setattr") {
1760 if (mode ==
"pre") {
1761 pcmd
("if (mqstat_) {")
1762 pcmd
(" PRE_READ(mqstat_, struct_mq_attr_sz);")
1765 } else if (syscall ==
"mq_notify") {
1766 if (mode ==
"pre") {
1767 pcmd
("if (notification_) {")
1768 pcmd
(" PRE_READ(notification_, struct_sigevent_sz);")
1771 } else if (syscall ==
"mq_send") {
1772 if (mode ==
"pre") {
1773 pcmd
("if (msg_ptr_) {")
1774 pcmd
(" PRE_READ(msg_ptr_, msg_len_);")
1777 } else if (syscall ==
"mq_receive") {
1778 pcmd
("/* Nothing to do */")
1779 } else if (syscall ==
"compat_50_mq_timedsend") {
1781 } else if (syscall ==
"compat_50_mq_timedreceive") {
1783 } else if (syscall ==
"__posix_rename") {
1784 if (mode ==
"pre") {
1785 pcmd
("const char *from = (const char *)from_;")
1786 pcmd
("const char *to = (const char *)to_;")
1787 pcmd
("if (from_) {")
1788 pcmd
(" PRE_READ(from, __sanitizer::internal_strlen(from) + 1);")
1791 pcmd
(" PRE_READ(to, __sanitizer::internal_strlen(to) + 1);")
1794 pcmd
("const char *from = (const char *)from_;")
1795 pcmd
("const char *to = (const char *)to_;")
1797 pcmd
(" POST_READ(from, __sanitizer::internal_strlen(from) + 1);")
1800 pcmd
(" POST_READ(to, __sanitizer::internal_strlen(to) + 1);")
1803 } else if (syscall ==
"swapctl") {
1805 } else if (syscall ==
"compat_30_getdents") {
1807 } else if (syscall ==
"minherit") {
1808 pcmd
("/* Nothing to do */")
1809 } else if (syscall ==
"lchmod") {
1810 if (mode ==
"pre") {
1811 pcmd
("const char *path = (const char *)path_;")
1813 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1816 pcmd
("const char *path = (const char *)path_;")
1818 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1821 } else if (syscall ==
"lchown") {
1822 if (mode ==
"pre") {
1823 pcmd
("const char *path = (const char *)path_;")
1825 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1828 pcmd
("const char *path = (const char *)path_;")
1830 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1833 } else if (syscall ==
"compat_50_lutimes") {
1835 } else if (syscall ==
"__msync13") {
1836 pcmd
("/* Nothing to do */")
1837 } else if (syscall ==
"compat_30___stat13") {
1839 } else if (syscall ==
"compat_30___fstat13") {
1841 } else if (syscall ==
"compat_30___lstat13") {
1843 } else if (syscall ==
"__sigaltstack14") {
1844 if (mode ==
"pre") {
1846 pcmd
(" PRE_READ(nss_, struct_sigaltstack_sz);")
1849 pcmd
(" PRE_READ(oss_, struct_sigaltstack_sz);")
1852 } else if (syscall ==
"__vfork14") {
1853 pcmd
("/* Nothing to do */")
1854 } else if (syscall ==
"__posix_chown") {
1855 if (mode ==
"pre") {
1856 pcmd
("const char *path = (const char *)path_;")
1858 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1861 pcmd
("const char *path = (const char *)path_;")
1863 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1866 } else if (syscall ==
"__posix_fchown") {
1867 pcmd
("/* Nothing to do */")
1868 } else if (syscall ==
"__posix_lchown") {
1869 if (mode ==
"pre") {
1870 pcmd
("const char *path = (const char *)path_;")
1872 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1875 pcmd
("const char *path = (const char *)path_;")
1877 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1880 } else if (syscall ==
"getsid") {
1881 pcmd
("/* Nothing to do */")
1882 } else if (syscall ==
"__clone") {
1883 pcmd
("/* Nothing to do */")
1884 } else if (syscall ==
"fktrace") {
1885 pcmd
("/* Nothing to do */")
1886 } else if (syscall ==
"preadv") {
1887 pcmd
("/* Nothing to do */")
1888 } else if (syscall ==
"pwritev") {
1889 pcmd
("/* Nothing to do */")
1890 } else if (syscall ==
"compat_16___sigaction14") {
1892 } else if (syscall ==
"__sigpending14") {
1893 pcmd
("/* Nothing to do */")
1894 } else if (syscall ==
"__sigprocmask14") {
1895 pcmd
("/* Nothing to do */")
1896 } else if (syscall ==
"__sigsuspend14") {
1898 pcmd
(" PRE_READ(set_, sizeof(__sanitizer_sigset_t));")
1900 } else if (syscall ==
"compat_16___sigreturn14") {
1902 } else if (syscall ==
"__getcwd") {
1903 pcmd
("/* Nothing to do */")
1904 } else if (syscall ==
"fchroot") {
1905 pcmd
("/* Nothing to do */")
1906 } else if (syscall ==
"compat_30_fhopen") {
1908 } else if (syscall ==
"compat_30_fhstat") {
1910 } else if (syscall ==
"compat_20_fhstatfs") {
1912 } else if (syscall ==
"compat_50_____semctl13") {
1914 } else if (syscall ==
"compat_50___msgctl13") {
1916 } else if (syscall ==
"compat_50___shmctl13") {
1918 } else if (syscall ==
"lchflags") {
1919 if (mode ==
"pre") {
1920 pcmd
("const char *path = (const char *)path_;")
1922 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
1925 pcmd
("const char *path = (const char *)path_;")
1927 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
1930 } else if (syscall ==
"issetugid") {
1931 pcmd
("/* Nothing to do */")
1932 } else if (syscall ==
"utrace") {
1933 if (mode ==
"pre") {
1934 pcmd
("const char *label = (const char *)label_;")
1935 pcmd
("if (label) {")
1936 pcmd
(" PRE_READ(label, __sanitizer::internal_strlen(label) + 1);")
1938 pcmd
("if (addr_) {")
1939 pcmd
(" PRE_READ(addr_, len_);")
1942 pcmd
("const char *label = (const char *)label_;")
1943 pcmd
("if (label) {")
1944 pcmd
(" POST_READ(label, __sanitizer::internal_strlen(label) + 1);")
1946 pcmd
("if (addr_) {")
1947 pcmd
(" POST_READ(addr_, len_);")
1950 } else if (syscall ==
"getcontext") {
1951 pcmd
("/* Nothing to do */")
1952 } else if (syscall ==
"setcontext") {
1953 if (mode ==
"pre") {
1955 pcmd
(" PRE_READ(ucp_, ucontext_t_sz);")
1958 } else if (syscall ==
"_lwp_create") {
1959 if (mode ==
"pre") {
1961 pcmd
(" PRE_READ(ucp_, ucontext_t_sz);")
1964 } else if (syscall ==
"_lwp_exit") {
1965 pcmd
("/* Nothing to do */")
1966 } else if (syscall ==
"_lwp_self") {
1967 pcmd
("/* Nothing to do */")
1968 } else if (syscall ==
"_lwp_wait") {
1969 pcmd
("/* Nothing to do */")
1970 } else if (syscall ==
"_lwp_suspend") {
1971 pcmd
("/* Nothing to do */")
1972 } else if (syscall ==
"_lwp_continue") {
1973 pcmd
("/* Nothing to do */")
1974 } else if (syscall ==
"_lwp_wakeup") {
1975 pcmd
("/* Nothing to do */")
1976 } else if (syscall ==
"_lwp_getprivate") {
1977 pcmd
("/* Nothing to do */")
1978 } else if (syscall ==
"_lwp_setprivate") {
1979 pcmd
("/* Nothing to do */")
1980 } else if (syscall ==
"_lwp_kill") {
1981 pcmd
("/* Nothing to do */")
1982 } else if (syscall ==
"_lwp_detach") {
1983 pcmd
("/* Nothing to do */")
1984 } else if (syscall ==
"compat_50__lwp_park") {
1986 } else if (syscall ==
"_lwp_unpark") {
1987 pcmd
("/* Nothing to do */")
1988 } else if (syscall ==
"_lwp_unpark_all") {
1989 if (mode ==
"pre") {
1990 pcmd
("if (targets_) {")
1991 pcmd
(" PRE_READ(targets_, ntargets_ * sizeof(__sanitizer_lwpid_t));")
1994 } else if (syscall ==
"_lwp_setname") {
1995 if (mode ==
"pre") {
1996 pcmd
("const char *name = (const char *)name_;")
1998 pcmd
(" PRE_READ(name, __sanitizer::internal_strlen(name) + 1);")
2001 pcmd
("const char *name = (const char *)name_;")
2003 pcmd
(" POST_READ(name, __sanitizer::internal_strlen(name) + 1);")
2006 } else if (syscall ==
"_lwp_getname") {
2007 pcmd
("/* Nothing to do */")
2008 } else if (syscall ==
"_lwp_ctl") {
2009 pcmd
("/* Nothing to do */")
2010 } else if (syscall ==
"compat_60_sa_register") {
2012 } else if (syscall ==
"compat_60_sa_stacks") {
2014 } else if (syscall ==
"compat_60_sa_enable") {
2016 } else if (syscall ==
"compat_60_sa_setconcurrency") {
2018 } else if (syscall ==
"compat_60_sa_yield") {
2020 } else if (syscall ==
"compat_60_sa_preempt") {
2022 } else if (syscall ==
"__sigaction_sigtramp") {
2024 pcmd
(" PRE_READ(nsa_, sizeof(__sanitizer_sigaction));")
2026 } else if (syscall ==
"rasctl") {
2027 pcmd
("/* Nothing to do */")
2028 } else if (syscall ==
"kqueue") {
2029 pcmd
("/* Nothing to do */")
2030 } else if (syscall ==
"compat_50_kevent") {
2032 } else if (syscall ==
"_sched_setparam") {
2033 pcmd
("if (params_) {")
2034 pcmd
(" PRE_READ(params_, struct_sched_param_sz);")
2036 } else if (syscall ==
"_sched_getparam") {
2037 pcmd
("/* Nothing to do */")
2038 } else if (syscall ==
"_sched_setaffinity") {
2039 pcmd
("if (cpuset_) {")
2040 pcmd
(" PRE_READ(cpuset_, size_);")
2042 } else if (syscall ==
"_sched_getaffinity") {
2043 pcmd
("/* Nothing to do */")
2044 } else if (syscall ==
"sched_yield") {
2045 pcmd
("/* Nothing to do */")
2046 } else if (syscall ==
"_sched_protect") {
2047 pcmd
("/* Nothing to do */")
2048 } else if (syscall ==
"fsync_range") {
2049 pcmd
("/* Nothing to do */")
2050 } else if (syscall ==
"uuidgen") {
2051 pcmd
("/* Nothing to do */")
2052 } else if (syscall ==
"compat_90_getvfsstat") {
2053 pcmd
("/* Nothing to do */")
2054 } else if (syscall ==
"compat_90_statvfs1") {
2055 if (mode ==
"pre") {
2056 pcmd
("const char *path = (const char *)path_;")
2058 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2061 pcmd
("const char *path = (const char *)path_;")
2063 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2066 } else if (syscall ==
"compat_90_fstatvfs1") {
2067 pcmd
("/* Nothing to do */")
2068 } else if (syscall ==
"compat_30_fhstatvfs1") {
2070 } else if (syscall ==
"extattrctl") {
2071 if (mode ==
"pre") {
2072 pcmd
("const char *path = (const char *)path_;")
2074 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2077 pcmd
("const char *path = (const char *)path_;")
2079 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2082 } else if (syscall ==
"extattr_set_file") {
2083 if (mode ==
"pre") {
2084 pcmd
("const char *path = (const char *)path_;")
2086 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2089 pcmd
("const char *path = (const char *)path_;")
2091 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2094 } else if (syscall ==
"extattr_get_file") {
2095 if (mode ==
"pre") {
2096 pcmd
("const char *path = (const char *)path_;")
2098 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2101 pcmd
("const char *path = (const char *)path_;")
2103 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2106 } else if (syscall ==
"extattr_delete_file") {
2107 if (mode ==
"pre") {
2108 pcmd
("const char *path = (const char *)path_;")
2110 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2113 pcmd
("const char *path = (const char *)path_;")
2115 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2118 } else if (syscall ==
"extattr_set_fd") {
2120 } else if (syscall ==
"extattr_get_fd") {
2122 } else if (syscall ==
"extattr_delete_fd") {
2124 } else if (syscall ==
"extattr_set_link") {
2125 if (mode ==
"pre") {
2126 pcmd
("const char *path = (const char *)path_;")
2128 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2131 pcmd
("const char *path = (const char *)path_;")
2133 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2136 } else if (syscall ==
"extattr_get_link") {
2137 if (mode ==
"pre") {
2138 pcmd
("const char *path = (const char *)path_;")
2140 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2143 pcmd
("const char *path = (const char *)path_;")
2145 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2148 } else if (syscall ==
"extattr_delete_link") {
2149 if (mode ==
"pre") {
2150 pcmd
("const char *path = (const char *)path_;")
2152 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2155 pcmd
("const char *path = (const char *)path_;")
2157 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2160 } else if (syscall ==
"extattr_list_fd") {
2162 } else if (syscall ==
"extattr_list_file") {
2163 if (mode ==
"pre") {
2164 pcmd
("const char *path = (const char *)path_;")
2166 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2169 pcmd
("const char *path = (const char *)path_;")
2171 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2174 } else if (syscall ==
"extattr_list_link") {
2175 if (mode ==
"pre") {
2176 pcmd
("const char *path = (const char *)path_;")
2178 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2181 pcmd
("const char *path = (const char *)path_;")
2183 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2186 } else if (syscall ==
"compat_50_pselect") {
2188 } else if (syscall ==
"compat_50_pollts") {
2190 } else if (syscall ==
"setxattr") {
2191 if (mode ==
"pre") {
2192 pcmd
("const char *path = (const char *)path_;")
2194 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2197 pcmd
("const char *path = (const char *)path_;")
2199 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2202 } else if (syscall ==
"lsetxattr") {
2203 if (mode ==
"pre") {
2204 pcmd
("const char *path = (const char *)path_;")
2206 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2209 pcmd
("const char *path = (const char *)path_;")
2211 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2214 } else if (syscall ==
"fsetxattr") {
2215 pcmd
("/* Nothing to do */")
2216 } else if (syscall ==
"getxattr") {
2217 if (mode ==
"pre") {
2218 pcmd
("const char *path = (const char *)path_;")
2220 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2223 pcmd
("const char *path = (const char *)path_;")
2225 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2228 } else if (syscall ==
"lgetxattr") {
2229 if (mode ==
"pre") {
2230 pcmd
("const char *path = (const char *)path_;")
2232 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2235 pcmd
("const char *path = (const char *)path_;")
2237 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2240 } else if (syscall ==
"fgetxattr") {
2241 pcmd
("/* Nothing to do */")
2242 } else if (syscall ==
"listxattr") {
2243 if (mode ==
"pre") {
2244 pcmd
("const char *path = (const char *)path_;")
2246 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2249 pcmd
("const char *path = (const char *)path_;")
2251 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2254 } else if (syscall ==
"llistxattr") {
2255 if (mode ==
"pre") {
2256 pcmd
("const char *path = (const char *)path_;")
2258 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2261 pcmd
("const char *path = (const char *)path_;")
2263 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2266 } else if (syscall ==
"flistxattr") {
2268 } else if (syscall ==
"removexattr") {
2269 if (mode ==
"pre") {
2270 pcmd
("const char *path = (const char *)path_;")
2272 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2275 pcmd
("const char *path = (const char *)path_;")
2277 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2280 } else if (syscall ==
"lremovexattr") {
2281 if (mode ==
"pre") {
2282 pcmd
("const char *path = (const char *)path_;")
2284 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2287 pcmd
("const char *path = (const char *)path_;")
2289 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2292 } else if (syscall ==
"fremovexattr") {
2294 } else if (syscall ==
"compat_50___stat30") {
2296 } else if (syscall ==
"compat_50___fstat30") {
2298 } else if (syscall ==
"compat_50___lstat30") {
2300 } else if (syscall ==
"__getdents30") {
2301 pcmd
("/* Nothing to do */")
2302 } else if (syscall ==
"posix_fadvise") {
2303 pcmd
("/* Nothing to do */")
2304 } else if (syscall ==
"compat_30___fhstat30") {
2306 } else if (syscall ==
"compat_50___ntp_gettime30") {
2308 } else if (syscall ==
"__socket30") {
2309 pcmd
("/* Nothing to do */")
2310 } else if (syscall ==
"__getfh30") {
2311 if (mode ==
"pre") {
2312 pcmd
("const char *fname = (const char *)fname_;")
2313 pcmd
("if (fname) {")
2314 pcmd
(" PRE_READ(fname, __sanitizer::internal_strlen(fname) + 1);")
2317 pcmd
("const char *fname = (const char *)fname_;")
2318 pcmd
("if (res == 0) {")
2319 pcmd
(" if (fname) {")
2320 pcmd
(" POST_READ(fname, __sanitizer::internal_strlen(fname) + 1);")
2324 } else if (syscall ==
"__fhopen40") {
2325 if (mode ==
"pre") {
2327 pcmd
(" PRE_READ(fhp_, fh_size_);")
2330 } else if (syscall ==
"compat_90_fhstatvfs1") {
2331 if (mode ==
"pre") {
2333 pcmd
(" PRE_READ(fhp_, fh_size_);")
2336 } else if (syscall ==
"compat_50___fhstat40") {
2337 if (mode ==
"pre") {
2339 pcmd
(" PRE_READ(fhp_, fh_size_);")
2342 } else if (syscall ==
"aio_cancel") {
2343 if (mode ==
"pre") {
2344 pcmd
("if (aiocbp_) {")
2345 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2348 } else if (syscall ==
"aio_error") {
2349 if (mode ==
"pre") {
2350 pcmd
("if (aiocbp_) {")
2351 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2354 } else if (syscall ==
"aio_fsync") {
2355 if (mode ==
"pre") {
2356 pcmd
("if (aiocbp_) {")
2357 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2360 } else if (syscall ==
"aio_read") {
2361 if (mode ==
"pre") {
2362 pcmd
("if (aiocbp_) {")
2363 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2366 } else if (syscall ==
"aio_return") {
2367 if (mode ==
"pre") {
2368 pcmd
("if (aiocbp_) {")
2369 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2372 } else if (syscall ==
"compat_50_aio_suspend") {
2374 } else if (syscall ==
"aio_write") {
2375 if (mode ==
"pre") {
2376 pcmd
("if (aiocbp_) {")
2377 pcmd
(" PRE_READ(aiocbp_, sizeof(struct __sanitizer_aiocb));")
2380 } else if (syscall ==
"lio_listio") {
2381 pcmd
("/* Nothing to do */")
2382 } else if (syscall ==
"__mount50") {
2383 if (mode ==
"pre") {
2384 pcmd
("const char *type = (const char *)type_;")
2385 pcmd
("const char *path = (const char *)path_;")
2387 pcmd
(" PRE_READ(type, __sanitizer::internal_strlen(type) + 1);")
2390 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2392 pcmd
("if (data_) {")
2393 pcmd
(" PRE_READ(data_, data_len_);")
2396 pcmd
("const char *type = (const char *)type_;")
2397 pcmd
("const char *path = (const char *)path_;")
2399 pcmd
(" POST_READ(type, __sanitizer::internal_strlen(type) + 1);")
2402 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2404 pcmd
("if (data_) {")
2405 pcmd
(" POST_READ(data_, data_len_);")
2408 } else if (syscall ==
"mremap") {
2409 pcmd
("/* Nothing to do */")
2410 } else if (syscall ==
"pset_create") {
2411 pcmd
("/* Nothing to do */")
2412 } else if (syscall ==
"pset_destroy") {
2413 pcmd
("/* Nothing to do */")
2414 } else if (syscall ==
"pset_assign") {
2415 pcmd
("/* Nothing to do */")
2416 } else if (syscall ==
"_pset_bind") {
2417 pcmd
("/* Nothing to do */")
2418 } else if (syscall ==
"__posix_fadvise50") {
2419 pcmd
("/* Nothing to do */")
2420 } else if (syscall ==
"__select50") {
2421 pcmd
("/* Nothing to do */")
2422 } else if (syscall ==
"__gettimeofday50") {
2423 pcmd
("/* Nothing to do */")
2424 } else if (syscall ==
"__settimeofday50") {
2425 if (mode ==
"pre") {
2427 pcmd
(" PRE_READ(tv_, timeval_sz);")
2430 pcmd
(" PRE_READ(tzp_, struct_timezone_sz);")
2433 } else if (syscall ==
"__utimes50") {
2434 if (mode ==
"pre") {
2435 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2436 pcmd
("const char *path = (const char *)path_;")
2438 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2441 pcmd
(" PRE_READ(tptr[0], struct_timespec_sz);")
2442 pcmd
(" PRE_READ(tptr[1], struct_timespec_sz);")
2445 } else if (syscall ==
"__adjtime50") {
2446 if (mode ==
"pre") {
2447 pcmd
("if (delta_) {")
2448 pcmd
(" PRE_READ(delta_, timeval_sz);")
2451 } else if (syscall ==
"__lfs_segwait50") {
2453 } else if (syscall ==
"__futimes50") {
2454 if (mode ==
"pre") {
2455 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2457 pcmd
(" PRE_READ(tptr[0], struct_timespec_sz);")
2458 pcmd
(" PRE_READ(tptr[1], struct_timespec_sz);")
2461 } else if (syscall ==
"__lutimes50") {
2462 if (mode ==
"pre") {
2463 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2464 pcmd
("const char *path = (const char *)path_;")
2466 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2469 pcmd
(" PRE_READ(tptr[0], struct_timespec_sz);")
2470 pcmd
(" PRE_READ(tptr[1], struct_timespec_sz);")
2473 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2474 pcmd
("const char *path = (const char *)path_;")
2476 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2479 pcmd
(" POST_READ(tptr[0], struct_timespec_sz);")
2480 pcmd
(" POST_READ(tptr[1], struct_timespec_sz);")
2483 } else if (syscall ==
"__setitimer50") {
2484 if (mode ==
"pre") {
2485 pcmd
("struct __sanitizer_itimerval *itv = (struct __sanitizer_itimerval *)itv_;")
2487 pcmd
(" PRE_READ(&itv->it_interval.tv_sec, sizeof(__sanitizer_time_t));")
2488 pcmd
(" PRE_READ(&itv->it_interval.tv_usec, sizeof(__sanitizer_suseconds_t));")
2489 pcmd
(" PRE_READ(&itv->it_value.tv_sec, sizeof(__sanitizer_time_t));")
2490 pcmd
(" PRE_READ(&itv->it_value.tv_usec, sizeof(__sanitizer_suseconds_t));")
2493 } else if (syscall ==
"__getitimer50") {
2494 pcmd
("/* Nothing to do */")
2495 } else if (syscall ==
"__clock_gettime50") {
2496 pcmd
("/* Nothing to do */")
2497 } else if (syscall ==
"__clock_settime50") {
2498 if (mode ==
"pre") {
2500 pcmd
(" PRE_READ(tp_, struct_timespec_sz);")
2503 } else if (syscall ==
"__clock_getres50") {
2504 pcmd
("/* Nothing to do */")
2505 } else if (syscall ==
"__nanosleep50") {
2506 if (mode ==
"pre") {
2507 pcmd
("if (rqtp_) {")
2508 pcmd
(" PRE_READ(rqtp_, struct_timespec_sz);")
2511 } else if (syscall ==
"____sigtimedwait50") {
2512 if (mode ==
"pre") {
2514 pcmd
(" PRE_READ(set_, sizeof(__sanitizer_sigset_t));")
2516 pcmd
("if (timeout_) {")
2517 pcmd
(" PRE_READ(timeout_, struct_timespec_sz);")
2520 } else if (syscall ==
"__mq_timedsend50") {
2521 if (mode ==
"pre") {
2522 pcmd
("if (msg_ptr_) {")
2523 pcmd
(" PRE_READ(msg_ptr_, msg_len_);")
2525 pcmd
("if (abs_timeout_) {")
2526 pcmd
(" PRE_READ(abs_timeout_, struct_timespec_sz);")
2529 } else if (syscall ==
"__mq_timedreceive50") {
2530 if (mode ==
"pre") {
2531 pcmd
("if (msg_ptr_) {")
2532 pcmd
(" PRE_READ(msg_ptr_, msg_len_);")
2534 pcmd
("if (abs_timeout_) {")
2535 pcmd
(" PRE_READ(abs_timeout_, struct_timespec_sz);")
2538 } else if (syscall ==
"compat_60__lwp_park") {
2540 } else if (syscall ==
"__kevent50") {
2541 if (mode ==
"pre") {
2542 pcmd
("if (changelist_) {")
2543 pcmd
(" PRE_READ(changelist_, nchanges_ * struct_kevent_sz);")
2545 pcmd
("if (timeout_) {")
2546 pcmd
(" PRE_READ(timeout_, struct_timespec_sz);")
2549 } else if (syscall ==
"__pselect50") {
2550 if (mode ==
"pre") {
2552 pcmd
(" PRE_READ(ts_, struct_timespec_sz);")
2554 pcmd
("if (mask_) {")
2555 pcmd
(" PRE_READ(mask_, sizeof(struct __sanitizer_sigset_t));")
2558 } else if (syscall ==
"__pollts50") {
2559 if (mode ==
"pre") {
2561 pcmd
(" PRE_READ(ts_, struct_timespec_sz);")
2563 pcmd
("if (mask_) {")
2564 pcmd
(" PRE_READ(mask_, sizeof(struct __sanitizer_sigset_t));")
2567 } else if (syscall ==
"__aio_suspend50") {
2568 if (mode ==
"pre") {
2570 pcmd
("const struct aiocb * const *list = (const struct aiocb * const *)list_;")
2572 pcmd
(" for (i = 0; i < nent_; i++) {")
2573 pcmd
(" if (list[i]) {")
2574 pcmd
(" PRE_READ(list[i], sizeof(struct __sanitizer_aiocb));")
2578 pcmd
("if (timeout_) {")
2579 pcmd
(" PRE_READ(timeout_, struct_timespec_sz);")
2582 } else if (syscall ==
"__stat50") {
2583 if (mode ==
"pre") {
2584 pcmd
("const char *path = (const char *)path_;")
2586 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2589 pcmd
("const char *path = (const char *)path_;")
2590 pcmd
("if (res == 0) {")
2591 pcmd
(" if (path) {")
2592 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2596 } else if (syscall ==
"__fstat50") {
2597 pcmd
("/* Nothing to do */")
2598 } else if (syscall ==
"__lstat50") {
2599 if (mode ==
"pre") {
2600 pcmd
("const char *path = (const char *)path_;")
2602 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2605 pcmd
("const char *path = (const char *)path_;")
2606 pcmd
("if (res == 0) {")
2607 pcmd
(" if (path) {")
2608 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2612 } else if (syscall ==
"____semctl50") {
2613 pcmd
("/* Nothing to do */")
2614 } else if (syscall ==
"__shmctl50") {
2615 pcmd
("/* Nothing to do */")
2616 } else if (syscall ==
"__msgctl50") {
2617 pcmd
("/* Nothing to do */")
2618 } else if (syscall ==
"__getrusage50") {
2619 pcmd
("/* Nothing to do */")
2620 } else if (syscall ==
"__timer_settime50") {
2621 if (mode ==
"pre") {
2622 pcmd
("struct __sanitizer_itimerval *value = (struct __sanitizer_itimerval *)value_;")
2623 pcmd
("if (value) {")
2624 pcmd
(" PRE_READ(&value->it_interval.tv_sec, sizeof(__sanitizer_time_t));")
2625 pcmd
(" PRE_READ(&value->it_interval.tv_usec, sizeof(__sanitizer_suseconds_t));")
2626 pcmd
(" PRE_READ(&value->it_value.tv_sec, sizeof(__sanitizer_time_t));")
2627 pcmd
(" PRE_READ(&value->it_value.tv_usec, sizeof(__sanitizer_suseconds_t));")
2630 pcmd
("struct __sanitizer_itimerval *value = (struct __sanitizer_itimerval *)value_;")
2631 pcmd
("if (res == 0) {")
2632 pcmd
(" if (value) {")
2633 pcmd
(" POST_READ(&value->it_interval.tv_sec, sizeof(__sanitizer_time_t));")
2634 pcmd
(" POST_READ(&value->it_interval.tv_usec, sizeof(__sanitizer_suseconds_t));")
2635 pcmd
(" POST_READ(&value->it_value.tv_sec, sizeof(__sanitizer_time_t));")
2636 pcmd
(" POST_READ(&value->it_value.tv_usec, sizeof(__sanitizer_suseconds_t));")
2640 } else if (syscall ==
"__timer_gettime50") {
2641 pcmd
("/* Nothing to do */")
2642 } else if (syscall ==
"__ntp_gettime50") {
2643 pcmd
("/* Nothing to do */")
2644 } else if (syscall ==
"__wait450") {
2645 pcmd
("/* Nothing to do */")
2646 } else if (syscall ==
"__mknod50") {
2647 if (mode ==
"pre") {
2648 pcmd
("const char *path = (const char *)path_;")
2650 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2653 pcmd
("const char *path = (const char *)path_;")
2654 pcmd
("if (res == 0) {")
2655 pcmd
(" if (path) {")
2656 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2660 } else if (syscall ==
"__fhstat50") {
2661 if (mode ==
"pre") {
2663 pcmd
(" PRE_READ(fhp_, fh_size_);")
2666 pcmd
("if (res == 0) {")
2667 pcmd
(" if (fhp_) {")
2668 pcmd
(" POST_READ(fhp_, fh_size_);")
2672 } else if (syscall ==
"pipe2") {
2673 pcmd
("/* Nothing to do */")
2674 } else if (syscall ==
"dup3") {
2675 pcmd
("/* Nothing to do */")
2676 } else if (syscall ==
"kqueue1") {
2677 pcmd
("/* Nothing to do */")
2678 } else if (syscall ==
"paccept") {
2679 if (mode ==
"pre") {
2680 pcmd
("if (mask_) {")
2681 pcmd
(" PRE_READ(mask_, sizeof(__sanitizer_sigset_t));")
2684 pcmd
("if (res >= 0) {")
2685 pcmd
(" if (mask_) {")
2686 pcmd
(" PRE_READ(mask_, sizeof(__sanitizer_sigset_t));")
2690 } else if (syscall ==
"linkat") {
2691 if (mode ==
"pre") {
2692 pcmd
("const char *name1 = (const char *)name1_;")
2693 pcmd
("const char *name2 = (const char *)name2_;")
2694 pcmd
("if (name1) {")
2695 pcmd
(" PRE_READ(name1, __sanitizer::internal_strlen(name1) + 1);")
2697 pcmd
("if (name2) {")
2698 pcmd
(" PRE_READ(name2, __sanitizer::internal_strlen(name2) + 1);")
2701 pcmd
("const char *name1 = (const char *)name1_;")
2702 pcmd
("const char *name2 = (const char *)name2_;")
2703 pcmd
("if (res == 0) {")
2704 pcmd
(" if (name1) {")
2705 pcmd
(" POST_READ(name1, __sanitizer::internal_strlen(name1) + 1);")
2707 pcmd
(" if (name2) {")
2708 pcmd
(" POST_READ(name2, __sanitizer::internal_strlen(name2) + 1);")
2712 } else if (syscall ==
"renameat") {
2713 if (mode ==
"pre") {
2714 pcmd
("const char *from = (const char *)from_;")
2715 pcmd
("const char *to = (const char *)to_;")
2717 pcmd
(" PRE_READ(from, __sanitizer::internal_strlen(from) + 1);")
2720 pcmd
(" PRE_READ(to, __sanitizer::internal_strlen(to) + 1);")
2723 pcmd
("const char *from = (const char *)from_;")
2724 pcmd
("const char *to = (const char *)to_;")
2725 pcmd
("if (res == 0) {")
2726 pcmd
(" if (from) {")
2727 pcmd
(" POST_READ(from, __sanitizer::internal_strlen(from) + 1);")
2730 pcmd
(" POST_READ(to, __sanitizer::internal_strlen(to) + 1);")
2734 } else if (syscall ==
"mkfifoat") {
2735 if (mode ==
"pre") {
2736 pcmd
("const char *path = (const char *)path_;")
2738 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2741 pcmd
("const char *path = (const char *)path_;")
2742 pcmd
("if (res == 0) {")
2743 pcmd
(" if (path) {")
2744 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2748 } else if (syscall ==
"mknodat") {
2749 if (mode ==
"pre") {
2750 pcmd
("const char *path = (const char *)path_;")
2752 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2755 pcmd
("const char *path = (const char *)path_;")
2756 pcmd
("if (res == 0) {")
2757 pcmd
(" if (path) {")
2758 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2762 } else if (syscall ==
"mkdirat") {
2763 if (mode ==
"pre") {
2764 pcmd
("const char *path = (const char *)path_;")
2766 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2769 pcmd
("const char *path = (const char *)path_;")
2770 pcmd
("if (res == 0) {")
2771 pcmd
(" if (path) {")
2772 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2776 } else if (syscall ==
"faccessat") {
2777 if (mode ==
"pre") {
2778 pcmd
("const char *path = (const char *)path_;")
2780 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2783 pcmd
("const char *path = (const char *)path_;")
2784 pcmd
("if (res == 0) {")
2785 pcmd
(" if (path) {")
2786 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2790 } else if (syscall ==
"fchmodat") {
2791 if (mode ==
"pre") {
2792 pcmd
("const char *path = (const char *)path_;")
2794 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2797 pcmd
("const char *path = (const char *)path_;")
2798 pcmd
("if (res == 0) {")
2799 pcmd
(" if (path) {")
2800 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2804 } else if (syscall ==
"fchownat") {
2805 if (mode ==
"pre") {
2806 pcmd
("const char *path = (const char *)path_;")
2808 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2811 pcmd
("const char *path = (const char *)path_;")
2812 pcmd
("if (res == 0) {")
2813 pcmd
(" if (path) {")
2814 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2818 } else if (syscall ==
"fexecve") {
2820 } else if (syscall ==
"fstatat") {
2821 if (mode ==
"pre") {
2822 pcmd
("const char *path = (const char *)path_;")
2824 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2827 pcmd
("const char *path = (const char *)path_;")
2829 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2832 } else if (syscall ==
"utimensat") {
2833 if (mode ==
"pre") {
2834 pcmd
("const char *path = (const char *)path_;")
2836 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2838 pcmd
("if (tptr_) {")
2839 pcmd
(" PRE_READ(tptr_, struct_timespec_sz);")
2842 pcmd
("const char *path = (const char *)path_;")
2843 pcmd
("if (res > 0) {")
2844 pcmd
(" if (path) {")
2845 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2847 pcmd
(" if (tptr_) {")
2848 pcmd
(" POST_READ(tptr_, struct_timespec_sz);")
2852 } else if (syscall ==
"openat") {
2853 if (mode ==
"pre") {
2854 pcmd
("const char *path = (const char *)path_;")
2856 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2859 pcmd
("const char *path = (const char *)path_;")
2860 pcmd
("if (res > 0) {")
2861 pcmd
(" if (path) {")
2862 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2866 } else if (syscall ==
"readlinkat") {
2867 if (mode ==
"pre") {
2868 pcmd
("const char *path = (const char *)path_;")
2870 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2873 pcmd
("const char *path = (const char *)path_;")
2874 pcmd
("if (res > 0) {")
2875 pcmd
(" if (path) {")
2876 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2880 } else if (syscall ==
"symlinkat") {
2881 if (mode ==
"pre") {
2882 pcmd
("const char *path1 = (const char *)path1_;")
2883 pcmd
("const char *path2 = (const char *)path2_;")
2884 pcmd
("if (path1) {")
2885 pcmd
(" PRE_READ(path1, __sanitizer::internal_strlen(path1) + 1);")
2887 pcmd
("if (path2) {")
2888 pcmd
(" PRE_READ(path2, __sanitizer::internal_strlen(path2) + 1);")
2891 pcmd
("const char *path1 = (const char *)path1_;")
2892 pcmd
("const char *path2 = (const char *)path2_;")
2893 pcmd
("if (res == 0) {")
2894 pcmd
(" if (path1) {")
2895 pcmd
(" POST_READ(path1, __sanitizer::internal_strlen(path1) + 1);")
2897 pcmd
(" if (path2) {")
2898 pcmd
(" POST_READ(path2, __sanitizer::internal_strlen(path2) + 1);")
2902 } else if (syscall ==
"unlinkat") {
2903 if (mode ==
"pre") {
2904 pcmd
("const char *path = (const char *)path_;")
2906 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2909 pcmd
("const char *path = (const char *)path_;")
2910 pcmd
("if (res == 0) {")
2911 pcmd
(" if (path) {")
2912 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2916 } else if (syscall ==
"futimens") {
2917 if (mode ==
"pre") {
2918 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2920 pcmd
(" PRE_READ(tptr[0], struct_timespec_sz);")
2921 pcmd
(" PRE_READ(tptr[1], struct_timespec_sz);")
2924 pcmd
("struct __sanitizer_timespec **tptr = (struct __sanitizer_timespec **)tptr_;")
2925 pcmd
("if (res == 0) {")
2926 pcmd
(" if (tptr) {")
2927 pcmd
(" POST_READ(tptr[0], struct_timespec_sz);")
2928 pcmd
(" POST_READ(tptr[1], struct_timespec_sz);")
2932 } else if (syscall ==
"__quotactl") {
2933 if (mode ==
"pre") {
2934 pcmd
("const char *path = (const char *)path_;")
2936 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2939 pcmd
("const char *path = (const char *)path_;")
2940 pcmd
("if (res == 0) {")
2941 pcmd
(" if (path) {")
2942 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2946 } else if (syscall ==
"posix_spawn") {
2947 if (mode ==
"pre") {
2948 pcmd
("const char *path = (const char *)path_;")
2950 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
2953 pcmd
("const char *path = (const char *)path_;")
2955 pcmd
(" if (path) {")
2956 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
2960 } else if (syscall ==
"recvmmsg") {
2961 if (mode ==
"pre") {
2962 pcmd
("if (timeout_) {")
2963 pcmd
(" PRE_READ(timeout_, struct_timespec_sz);")
2966 pcmd
("if (res >= 0) {")
2967 pcmd
(" if (timeout_) {")
2968 pcmd
(" POST_READ(timeout_, struct_timespec_sz);")
2972 } else if (syscall ==
"sendmmsg") {
2973 if (mode ==
"pre") {
2974 pcmd
("struct __sanitizer_mmsghdr *mmsg = (struct __sanitizer_mmsghdr *)mmsg_;")
2976 pcmd
(" PRE_READ(mmsg, sizeof(struct __sanitizer_mmsghdr) * (vlen_ > 1024 ? 1024 : vlen_));")
2979 pcmd
("struct __sanitizer_mmsghdr *mmsg = (struct __sanitizer_mmsghdr *)mmsg_;")
2980 pcmd
("if (res >= 0) {")
2981 pcmd
(" if (mmsg) {")
2982 pcmd
(" POST_READ(mmsg, sizeof(struct __sanitizer_mmsghdr) * (vlen_ > 1024 ? 1024 : vlen_));")
2986 } else if (syscall ==
"clock_nanosleep") {
2987 if (mode ==
"pre") {
2988 pcmd
("if (rqtp_) {")
2989 pcmd
(" PRE_READ(rqtp_, struct_timespec_sz);")
2992 pcmd
("if (rqtp_) {")
2993 pcmd
(" POST_READ(rqtp_, struct_timespec_sz);")
2996 } else if (syscall ==
"___lwp_park60") {
2997 if (mode ==
"pre") {
2999 pcmd
(" PRE_READ(ts_, struct_timespec_sz);")
3002 pcmd
("if (res == 0) {")
3004 pcmd
(" POST_READ(ts_, struct_timespec_sz);")
3008 } else if (syscall ==
"posix_fallocate") {
3009 pcmd
("/* Nothing to do */")
3010 } else if (syscall ==
"fdiscard") {
3011 pcmd
("/* Nothing to do */")
3012 } else if (syscall ==
"wait6") {
3013 pcmd
("/* Nothing to do */")
3014 } else if (syscall ==
"clock_getcpuclockid2") {
3015 pcmd
("/* Nothing to do */")
3016 } else if (syscall ==
"__getvfsstat90") {
3017 pcmd
("/* Nothing to do */")
3018 } else if (syscall ==
"__statvfs190") {
3019 if (mode ==
"pre") {
3020 pcmd
("const char *path = (const char *)path_;")
3022 pcmd
(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
3025 pcmd
("const char *path = (const char *)path_;")
3027 pcmd
(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
3030 } else if (syscall ==
"__fstatvfs190") {
3031 pcmd
("/* Nothing to do */")
3032 } else if (syscall ==
"__fhstatvfs190") {
3033 if (mode ==
"pre") {
3035 pcmd
(" PRE_READ(fhp_, fh_size_);")
3038 } else if (syscall ==
"__acl_get_link") {
3040 } else if (syscall ==
"__acl_set_link") {
3042 } else if (syscall ==
"__acl_delete_link") {
3044 } else if (syscall ==
"__acl_aclcheck_link") {
3046 } else if (syscall ==
"__acl_get_file") {
3048 } else if (syscall ==
"__acl_set_file") {
3050 } else if (syscall ==
"__acl_get_fd") {
3052 } else if (syscall ==
"__acl_set_fd") {
3054 } else if (syscall ==
"__acl_delete_file") {
3056 } else if (syscall ==
"__acl_delete_fd") {
3058 } else if (syscall ==
"__acl_aclcheck_file") {
3060 } else if (syscall ==
"__acl_aclcheck_fd") {
3062 } else if (syscall ==
"lpathconf") {
3065 print "Unrecognized syscall: " syscall