compiler-rt/D102059.diff

114 lines
4.1 KiB
Diff
Raw Normal View History

2021-05-11 09:21:07 +00:00
Index: compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
===================================================================
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -370,6 +370,7 @@
#if SANITIZER_GLIBC
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
+#if SANITIZER_LINUX_CYCLADES
_(CYGETDEFTHRESH, WRITE, sizeof(int));
_(CYGETDEFTIMEOUT, WRITE, sizeof(int));
_(CYGETMON, WRITE, struct_cyclades_monitor_sz);
@@ -379,6 +380,7 @@
_(CYSETDEFTIMEOUT, NONE, 0);
_(CYSETTHRESH, NONE, 0);
_(CYSETTIMEOUT, NONE, 0);
+#endif
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform.h
===================================================================
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
@@ -390,4 +390,17 @@
#define SANITIZER_SUPPORTS_INIT_FOR_DLOPEN 0
#endif
+// Kernel has removed this header, as such check for it's existance
+// before trying to include defines from it.
+// https://lkml.org/lkml/2021/3/2/153
+#ifdef __has_include
+# if __has_include(<linux/cyclades.h>) && !SANITIZER_ANDROID
+# define SANITIZER_LINUX_CYCLADES 1
+# else
+# define SANITIZER_LINUX_CYCLADES 0
+# endif
+#else
+# define SANITIZER_LINUX_CYCLADES 0
+#endif
+
#endif // SANITIZER_PLATFORM_H
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -983,7 +983,9 @@
#if SANITIZER_LINUX && !SANITIZER_ANDROID
extern unsigned struct_ax25_parms_struct_sz;
+#if SANITIZER_LINUX_CYCLADES
extern unsigned struct_cyclades_monitor_sz;
+#endif
extern unsigned struct_input_keymap_entry_sz;
extern unsigned struct_ipx_config_data_sz;
extern unsigned struct_kbdiacrs_sz;
@@ -1328,6 +1330,7 @@
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#if SANITIZER_LINUX_CYCLADES
extern unsigned IOCTL_CYGETDEFTHRESH;
extern unsigned IOCTL_CYGETDEFTIMEOUT;
extern unsigned IOCTL_CYGETMON;
@@ -1337,6 +1340,7 @@
extern unsigned IOCTL_CYSETDEFTIMEOUT;
extern unsigned IOCTL_CYSETTHRESH;
extern unsigned IOCTL_CYSETTIMEOUT;
+#endif
extern unsigned IOCTL_EQL_EMANCIPATE;
extern unsigned IOCTL_EQL_ENSLAVE;
extern unsigned IOCTL_EQL_GETMASTRCFG;
Index: compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
===================================================================
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -143,7 +143,9 @@
# include <sys/procfs.h>
#endif
#include <sys/user.h>
-#include <linux/cyclades.h>
+#if SANITIZER_LINUX_CYCLADES
+# include <linux/cyclades.h>
+#endif
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
@@ -460,7 +462,9 @@
#if SANITIZER_GLIBC
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
+#if SANITIZER_LINUX_CYCLADES
unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+#endif
#if EV_VERSION > (0x010000)
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
#else
@@ -824,6 +828,7 @@
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#if SANITIZER_LINUX_CYCLADES
unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
unsigned IOCTL_CYGETMON = CYGETMON;
@@ -833,6 +838,7 @@
unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
+#endif
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;