[compiler-rt] 01f91c3 - [compiler-rt] Sync NetBSD syscall hooks with 9.99.17
Kamil Rytarowski via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 3 07:23:54 PST 2019
Author: Kamil Rytarowski
Date: 2019-11-03T16:22:02+01:00
New Revision: 01f91c3526efe58aa035c7f27bef817195c7d26c
URL: https://github.com/llvm/llvm-project/commit/01f91c3526efe58aa035c7f27bef817195c7d26c
DIFF: https://github.com/llvm/llvm-project/commit/01f91c3526efe58aa035c7f27bef817195c7d26c.diff
LOG: [compiler-rt] Sync NetBSD syscall hooks with 9.99.17
Document the minimal version supported as 9.0 and add compat code for
renamed syscalls after 9.0.
Added:
Modified:
compiler-rt/include/sanitizer/netbsd_syscall_hooks.h
compiler-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
compiler-rt/utils/generate_netbsd_syscalls.awk
Removed:
################################################################################
diff --git a/compiler-rt/include/sanitizer/netbsd_syscall_hooks.h b/compiler-rt/include/sanitizer/netbsd_syscall_hooks.h
index 27780e0d419f..174b4bf06de6 100644
--- a/compiler-rt/include/sanitizer/netbsd_syscall_hooks.h
+++ b/compiler-rt/include/sanitizer/netbsd_syscall_hooks.h
@@ -20,8 +20,8 @@
// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!
//
// Generated with: generate_netbsd_syscalls.awk
-// Generated date: 2018-10-30
-// Generated from: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp
+// Generated date: 2019-11-01
+// Generated from: syscalls.master,v 1.296 2019/09/22 22:59:39 christos Exp
//
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_NETBSD_SYSCALL_HOOKS_H
@@ -1839,23 +1839,24 @@
#define __sanitizer_syscall_post_uuidgen(res, store, count) \
__sanitizer_syscall_post_impl_uuidgen(res, (long long)(store), \
(long long)(count))
-#define __sanitizer_syscall_pre_getvfsstat(buf, bufsize, flags) \
- __sanitizer_syscall_pre_impl_getvfsstat( \
+#define __sanitizer_syscall_pre_compat_90_getvfsstat(buf, bufsize, flags) \
+ __sanitizer_syscall_pre_impl_compat_90_getvfsstat( \
(long long)(buf), (long long)(bufsize), (long long)(flags))
-#define __sanitizer_syscall_post_getvfsstat(res, buf, bufsize, flags) \
- __sanitizer_syscall_post_impl_getvfsstat( \
+#define __sanitizer_syscall_post_compat_90_getvfsstat(res, buf, bufsize, \
+ flags) \
+ __sanitizer_syscall_post_impl_compat_90_getvfsstat( \
res, (long long)(buf), (long long)(bufsize), (long long)(flags))
-#define __sanitizer_syscall_pre_statvfs1(path, buf, flags) \
- __sanitizer_syscall_pre_impl_statvfs1((long long)(path), (long long)(buf), \
- (long long)(flags))
-#define __sanitizer_syscall_post_statvfs1(res, path, buf, flags) \
- __sanitizer_syscall_post_impl_statvfs1(res, (long long)(path), \
- (long long)(buf), (long long)(flags))
-#define __sanitizer_syscall_pre_fstatvfs1(fd, buf, flags) \
- __sanitizer_syscall_pre_impl_fstatvfs1((long long)(fd), (long long)(buf), \
- (long long)(flags))
-#define __sanitizer_syscall_post_fstatvfs1(res, fd, buf, flags) \
- __sanitizer_syscall_post_impl_fstatvfs1( \
+#define __sanitizer_syscall_pre_compat_90_statvfs1(path, buf, flags) \
+ __sanitizer_syscall_pre_impl_compat_90_statvfs1( \
+ (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post_compat_90_statvfs1(res, path, buf, flags) \
+ __sanitizer_syscall_post_impl_compat_90_statvfs1( \
+ res, (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre_compat_90_fstatvfs1(fd, buf, flags) \
+ __sanitizer_syscall_pre_impl_compat_90_fstatvfs1( \
+ (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post_compat_90_fstatvfs1(res, fd, buf, flags) \
+ __sanitizer_syscall_post_impl_compat_90_fstatvfs1( \
res, (long long)(fd), (long long)(buf), (long long)(flags))
#define __sanitizer_syscall_pre_compat_30_fhstatvfs1(fhp, buf, flags) \
__sanitizer_syscall_pre_impl_compat_30_fhstatvfs1( \
@@ -2143,12 +2144,13 @@
#define __sanitizer_syscall_post___fhopen40(res, fhp, fh_size, flags) \
__sanitizer_syscall_post_impl___fhopen40( \
res, (long long)(fhp), (long long)(fh_size), (long long)(flags))
-#define __sanitizer_syscall_pre___fhstatvfs140(fhp, fh_size, buf, flags) \
- __sanitizer_syscall_pre_impl___fhstatvfs140( \
+#define __sanitizer_syscall_pre_compat_90_fhstatvfs1(fhp, fh_size, buf, flags) \
+ __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1( \
(long long)(fhp), (long long)(fh_size), (long long)(buf), \
(long long)(flags))
-#define __sanitizer_syscall_post___fhstatvfs140(res, fhp, fh_size, buf, flags) \
- __sanitizer_syscall_post_impl___fhstatvfs140( \
+#define __sanitizer_syscall_post_compat_90_fhstatvfs1(res, fhp, fh_size, buf, \
+ flags) \
+ __sanitizer_syscall_post_impl_compat_90_fhstatvfs1( \
res, (long long)(fhp), (long long)(fh_size), (long long)(buf), \
(long long)(flags))
#define __sanitizer_syscall_pre_compat_50___fhstat40(fhp, fh_size, sb) \
@@ -2703,6 +2705,53 @@
clock_id) \
__sanitizer_syscall_post_impl_clock_getcpuclockid2( \
res, (long long)(idtype), (long long)(id), (long long)(clock_id))
+#define __sanitizer_syscall_pre___getvfsstat90(buf, bufsize, flags) \
+ __sanitizer_syscall_pre_impl___getvfsstat90( \
+ (long long)(buf), (long long)(bufsize), (long long)(flags))
+#define __sanitizer_syscall_post___getvfsstat90(res, buf, bufsize, flags) \
+ __sanitizer_syscall_post_impl___getvfsstat90( \
+ res, (long long)(buf), (long long)(bufsize), (long long)(flags))
+#define __sanitizer_syscall_pre___statvfs190(path, buf, flags) \
+ __sanitizer_syscall_pre_impl___statvfs190( \
+ (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post___statvfs190(res, path, buf, flags) \
+ __sanitizer_syscall_post_impl___statvfs190( \
+ res, (long long)(path), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre___fstatvfs190(fd, buf, flags) \
+ __sanitizer_syscall_pre_impl___fstatvfs190( \
+ (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_post___fstatvfs190(res, fd, buf, flags) \
+ __sanitizer_syscall_post_impl___fstatvfs190( \
+ res, (long long)(fd), (long long)(buf), (long long)(flags))
+#define __sanitizer_syscall_pre___fhstatvfs190(fhp, fh_size, buf, flags) \
+ __sanitizer_syscall_pre_impl___fhstatvfs190( \
+ (long long)(fhp), (long long)(fh_size), (long long)(buf), \
+ (long long)(flags))
+#define __sanitizer_syscall_post___fhstatvfs190(res, fhp, fh_size, buf, flags) \
+ __sanitizer_syscall_post_impl___fhstatvfs190( \
+ res, (long long)(fhp), (long long)(fh_size), (long long)(buf), \
+ (long long)(flags))
+
+/* Compat with older releases */
+#define __sanitizer_syscall_pre_getvfsstat \
+ __sanitizer_syscall_pre_compat_90_getvfsstat
+#define __sanitizer_syscall_post_getvfsstat \
+ __sanitizer_syscall_post_compat_90_getvfsstat
+
+#define __sanitizer_syscall_pre_statvfs1 \
+ __sanitizer_syscall_pre_compat_90_statvfs1
+#define __sanitizer_syscall_post_statvfs1 \
+ __sanitizer_syscall_post_compat_90_statvfs1
+
+#define __sanitizer_syscall_pre_fstatvfs1 \
+ __sanitizer_syscall_pre_compat_90_fstatvfs1
+#define __sanitizer_syscall_post_fstatvfs1 \
+ __sanitizer_syscall_post_compat_90_fstatvfs1
+
+#define __sanitizer_syscall_pre___fhstatvfs140 \
+ __sanitizer_syscall_pre_compat_90_fhstatvfs1
+#define __sanitizer_syscall_post___fhstatvfs140 \
+ __sanitizer_syscall_post_compat_90_fhstatvfs1
#ifdef __cplusplus
extern "C" {
@@ -4066,19 +4115,27 @@ void __sanitizer_syscall_post_impl_fsync_range(long long res, long long fd,
void __sanitizer_syscall_pre_impl_uuidgen(long long store, long long count);
void __sanitizer_syscall_post_impl_uuidgen(long long res, long long store,
long long count);
-void __sanitizer_syscall_pre_impl_getvfsstat(long long buf, long long bufsize,
- long long flags);
-void __sanitizer_syscall_post_impl_getvfsstat(long long res, long long buf,
- long long bufsize,
- long long flags);
-void __sanitizer_syscall_pre_impl_statvfs1(long long path, long long buf,
- long long flags);
-void __sanitizer_syscall_post_impl_statvfs1(long long res, long long path,
- long long buf, long long flags);
-void __sanitizer_syscall_pre_impl_fstatvfs1(long long fd, long long buf,
- long long flags);
-void __sanitizer_syscall_post_impl_fstatvfs1(long long res, long long fd,
- long long buf, long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_getvfsstat(long long buf,
+ long long bufsize,
+ long long flags);
+void __sanitizer_syscall_post_impl_compat_90_getvfsstat(long long res,
+ long long buf,
+ long long bufsize,
+ long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_statvfs1(long long path,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl_compat_90_statvfs1(long long res,
+ long long path,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_fstatvfs1(long long fd,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl_compat_90_fstatvfs1(long long res,
+ long long fd,
+ long long buf,
+ long long flags);
void __sanitizer_syscall_pre_impl_compat_30_fhstatvfs1(long long fhp,
long long buf,
long long flags);
@@ -4304,14 +4361,15 @@ void __sanitizer_syscall_pre_impl___fhopen40(long long fhp, long long fh_size,
void __sanitizer_syscall_post_impl___fhopen40(long long res, long long fhp,
long long fh_size,
long long flags);
-void __sanitizer_syscall_pre_impl___fhstatvfs140(long long fhp,
- long long fh_size,
- long long buf,
- long long flags);
-void __sanitizer_syscall_post_impl___fhstatvfs140(long long res, long long fhp,
- long long fh_size,
- long long buf,
- long long flags);
+void __sanitizer_syscall_pre_impl_compat_90_fhstatvfs1(long long fhp,
+ long long fh_size,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl_compat_90_fhstatvfs1(long long res,
+ long long fhp,
+ long long fh_size,
+ long long buf,
+ long long flags);
void __sanitizer_syscall_pre_impl_compat_50___fhstat40(long long fhp,
long long fh_size,
long long sb);
@@ -4721,6 +4779,29 @@ void __sanitizer_syscall_post_impl_clock_getcpuclockid2(long long res,
long long idtype,
long long id,
long long clock_id);
+void __sanitizer_syscall_pre_impl___getvfsstat90(long long buf,
+ long long bufsize,
+ long long flags);
+void __sanitizer_syscall_post_impl___getvfsstat90(long long res, long long buf,
+ long long bufsize,
+ long long flags);
+void __sanitizer_syscall_pre_impl___statvfs190(long long path, long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl___statvfs190(long long res, long long path,
+ long long buf, long long flags);
+void __sanitizer_syscall_pre_impl___fstatvfs190(long long fd, long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl___fstatvfs190(long long res, long long fd,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_pre_impl___fhstatvfs190(long long fhp,
+ long long fh_size,
+ long long buf,
+ long long flags);
+void __sanitizer_syscall_post_impl___fhstatvfs190(long long res, long long fhp,
+ long long fh_size,
+ long long buf,
+ long long flags);
#ifdef __cplusplus
} // extern "C"
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc b/compiler-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
index 21b521669630..69e598718741 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
@@ -42,8 +42,8 @@
// DO NOT EDIT! THIS FILE HAS BEEN GENERATED!
//
// Generated with: generate_netbsd_syscalls.awk
-// Generated date: 2018-10-30
-// Generated from: syscalls.master,v 1.293 2018/07/31 13:00:13 rjs Exp
+// Generated date: 2019-11-01
+// Generated from: syscalls.master,v 1.296 2019/09/22 22:59:39 christos Exp
//
//===----------------------------------------------------------------------===//
@@ -2433,30 +2433,31 @@ PRE_SYSCALL(uuidgen)(void *store_, long long count_) { /* Nothing to do */ }
POST_SYSCALL(uuidgen)(long long res, void *store_, long long count_) {
/* Nothing to do */
}
-PRE_SYSCALL(getvfsstat)(void *buf_, long long bufsize_, long long flags_) {
+PRE_SYSCALL(compat_90_getvfsstat)
+(void *buf_, long long bufsize_, long long flags_) {
/* Nothing to do */
}
-POST_SYSCALL(getvfsstat)
+POST_SYSCALL(compat_90_getvfsstat)
(long long res, void *buf_, long long bufsize_, long long flags_) {
/* Nothing to do */
}
-PRE_SYSCALL(statvfs1)(void *path_, void *buf_, long long flags_) {
+PRE_SYSCALL(compat_90_statvfs1)(void *path_, void *buf_, long long flags_) {
const char *path = (const char *)path_;
if (path) {
PRE_READ(path, __sanitizer::internal_strlen(path) + 1);
}
}
-POST_SYSCALL(statvfs1)
+POST_SYSCALL(compat_90_statvfs1)
(long long res, void *path_, void *buf_, long long flags_) {
const char *path = (const char *)path_;
if (path) {
POST_READ(path, __sanitizer::internal_strlen(path) + 1);
}
}
-PRE_SYSCALL(fstatvfs1)(long long fd_, void *buf_, long long flags_) {
+PRE_SYSCALL(compat_90_fstatvfs1)(long long fd_, void *buf_, long long flags_) {
/* Nothing to do */
}
-POST_SYSCALL(fstatvfs1)
+POST_SYSCALL(compat_90_fstatvfs1)
(long long res, long long fd_, void *buf_, long long flags_) {
/* Nothing to do */
}
@@ -2853,13 +2854,13 @@ PRE_SYSCALL(__fhopen40)(void *fhp_, long long fh_size_, long long flags_) {
}
POST_SYSCALL(__fhopen40)
(long long res, void *fhp_, long long fh_size_, long long flags_) {}
-PRE_SYSCALL(__fhstatvfs140)
+PRE_SYSCALL(compat_90_fhstatvfs1)
(void *fhp_, long long fh_size_, void *buf_, long long flags_) {
if (fhp_) {
PRE_READ(fhp_, fh_size_);
}
}
-POST_SYSCALL(__fhstatvfs140)
+POST_SYSCALL(compat_90_fhstatvfs1)
(long long res, void *fhp_, long long fh_size_, void *buf_, long long flags_) {}
PRE_SYSCALL(compat_50___fhstat40)(void *fhp_, long long fh_size_, void *sb_) {
if (fhp_) {
@@ -3768,6 +3769,41 @@ POST_SYSCALL(clock_getcpuclockid2)
(long long res, long long idtype_, long long id_, void *clock_id_) {
/* Nothing to do */
}
+PRE_SYSCALL(__getvfsstat90)(void *buf_, long long bufsize_, long long flags_) {
+ /* Nothing to do */
+}
+POST_SYSCALL(__getvfsstat90)
+(long long res, void *buf_, long long bufsize_, long long flags_) {
+ /* Nothing to do */
+}
+PRE_SYSCALL(__statvfs190)(void *path_, void *buf_, long long flags_) {
+ const char *path = (const char *)path_;
+ if (path) {
+ PRE_READ(path, __sanitizer::internal_strlen(path) + 1);
+ }
+}
+POST_SYSCALL(__statvfs190)
+(long long res, void *path_, void *buf_, long long flags_) {
+ const char *path = (const char *)path_;
+ if (path) {
+ POST_READ(path, __sanitizer::internal_strlen(path) + 1);
+ }
+}
+PRE_SYSCALL(__fstatvfs190)(long long fd_, void *buf_, long long flags_) {
+ /* Nothing to do */
+}
+POST_SYSCALL(__fstatvfs190)
+(long long res, long long fd_, void *buf_, long long flags_) {
+ /* Nothing to do */
+}
+PRE_SYSCALL(__fhstatvfs190)
+(void *fhp_, long long fh_size_, void *buf_, long long flags_) {
+ if (fhp_) {
+ PRE_READ(fhp_, fh_size_);
+ }
+}
+POST_SYSCALL(__fhstatvfs190)
+(long long res, void *fhp_, long long fh_size_, void *buf_, long long flags_) {}
#undef SYS_MAXSYSARGS
} // extern "C"
diff --git a/compiler-rt/utils/generate_netbsd_syscalls.awk b/compiler-rt/utils/generate_netbsd_syscalls.awk
index 4d12df8935b9..3f6d5a024a67 100755
--- a/compiler-rt/utils/generate_netbsd_syscalls.awk
+++ b/compiler-rt/utils/generate_netbsd_syscalls.awk
@@ -15,7 +15,11 @@
# This script accepts on the input syscalls.master by default located in the
# /usr/src/sys/kern/syscalls.master path in the NetBSD distribution.
#
-# NetBSD version 8.0.
+# This script shall be executed only on the newest NetBSD version.
+# This script will emit compat code for the older releases.
+#
+# NetBSD minimal version supported 9.0.
+# NetBSD current version supported 9.99.17.
#
#===------------------------------------------------------------------------===#
@@ -299,6 +303,20 @@ END {
pcmd(" __sanitizer_syscall_post_impl_" sn "(" outargs ")")
}
+ pcmd("")
+ pcmd("/* Compat with older releases */")
+ pcmd("#define __sanitizer_syscall_pre_getvfsstat __sanitizer_syscall_pre_compat_90_getvfsstat")
+ pcmd("#define __sanitizer_syscall_post_getvfsstat __sanitizer_syscall_post_compat_90_getvfsstat")
+ pcmd("")
+ pcmd("#define __sanitizer_syscall_pre_statvfs1 __sanitizer_syscall_pre_compat_90_statvfs1")
+ pcmd("#define __sanitizer_syscall_post_statvfs1 __sanitizer_syscall_post_compat_90_statvfs1")
+ pcmd("")
+ pcmd("#define __sanitizer_syscall_pre_fstatvfs1 __sanitizer_syscall_pre_compat_90_fstatvfs1")
+ pcmd("#define __sanitizer_syscall_post_fstatvfs1 __sanitizer_syscall_post_compat_90_fstatvfs1")
+ pcmd("")
+ pcmd("#define __sanitizer_syscall_pre___fhstatvfs140 __sanitizer_syscall_pre_compat_90_fhstatvfs1")
+ pcmd("#define __sanitizer_syscall_post___fhstatvfs140 __sanitizer_syscall_post_compat_90_fhstatvfs1")
+
pcmd("")
pcmd("#ifdef __cplusplus")
pcmd("extern \"C\" {")
@@ -2007,9 +2025,9 @@ function syscall_body(syscall, mode)
pcmd("/* Nothing to do */")
} else if (syscall == "uuidgen") {
pcmd("/* Nothing to do */")
- } else if (syscall == "getvfsstat") {
+ } else if (syscall == "compat_90_getvfsstat") {
pcmd("/* Nothing to do */")
- } else if (syscall == "statvfs1") {
+ } else if (syscall == "compat_90_statvfs1") {
if (mode == "pre") {
pcmd("const char *path = (const char *)path_;")
pcmd("if (path) {")
@@ -2021,7 +2039,7 @@ function syscall_body(syscall, mode)
pcmd(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
pcmd("}")
}
- } else if (syscall == "fstatvfs1") {
+ } else if (syscall == "compat_90_fstatvfs1") {
pcmd("/* Nothing to do */")
} else if (syscall == "compat_30_fhstatvfs1") {
pcmd("/* TODO */")
@@ -2285,7 +2303,7 @@ function syscall_body(syscall, mode)
pcmd(" PRE_READ(fhp_, fh_size_);")
pcmd("}")
}
- } else if (syscall == "__fhstatvfs140") {
+ } else if (syscall == "compat_90_fhstatvfs1") {
if (mode == "pre") {
pcmd("if (fhp_) {")
pcmd(" PRE_READ(fhp_, fh_size_);")
@@ -2971,6 +2989,28 @@ function syscall_body(syscall, mode)
pcmd("/* Nothing to do */")
} else if (syscall == "clock_getcpuclockid2") {
pcmd("/* Nothing to do */")
+ } else if (syscall == "__getvfsstat90") {
+ pcmd("/* Nothing to do */")
+ } else if (syscall == "__statvfs190") {
+ if (mode == "pre") {
+ pcmd("const char *path = (const char *)path_;")
+ pcmd("if (path) {")
+ pcmd(" PRE_READ(path, __sanitizer::internal_strlen(path) + 1);")
+ pcmd("}")
+ } else {
+ pcmd("const char *path = (const char *)path_;")
+ pcmd("if (path) {")
+ pcmd(" POST_READ(path, __sanitizer::internal_strlen(path) + 1);")
+ pcmd("}")
+ }
+ } else if (syscall == "__fstatvfs190") {
+ pcmd("/* Nothing to do */")
+ } else if (syscall == "__fhstatvfs190") {
+ if (mode == "pre") {
+ pcmd("if (fhp_) {")
+ pcmd(" PRE_READ(fhp_, fh_size_);")
+ pcmd("}")
+ }
} else {
print "Unrecognized syscall: " syscall
abnormal_exit = 1
More information about the llvm-commits
mailing list