fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1From 521935db9de17ad08748fd050137ac83b7734835 Mon Sep 17 00:00:00 2001
2From: Craig Topper <craig.topper@intel.com>
3Date: Thu, 24 May 2018 17:59:47 +0000
4Subject: [PATCH] sanitizer: Use pre-computed size of struct ustat for Linux
5
6<sys/ustat.h> has been removed from glibc 2.28 by:
7
8commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
9Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
10Date: Sun Mar 18 11:28:59 2018 +0800
11
12Deprecate ustat syscall interface
13This patch uses pre-computed size of struct ustat for Linux to fix
14
15https://bugs.llvm.org/show_bug.cgi?id=37418
16
17Patch by H.J. Lu.
18
19Differential Revision: https://reviews.llvm.org/D47281
20
21git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@333213 91177308-0d34-0410-b5e6-96231b3b80d8
22---
23 .../sanitizer_platform_limits_posix.cc | 15 +++++++++++++--
24 1 file changed, 13 insertions(+), 2 deletions(-)
25
26diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
27index 94b8f3f627..936d818673 100644
28--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
29+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
30@@ -159,7 +159,6 @@ typedef struct user_fpregs elf_fpregset_t;
31 # include <sys/procfs.h>
32 #endif
33 #include <sys/user.h>
34-#include <sys/ustat.h>
35 #include <linux/cyclades.h>
36 #include <linux/if_eql.h>
37 #include <linux/if_plip.h>
38@@ -253,7 +252,19 @@ namespace __sanitizer {
39 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
40
41 #if SANITIZER_LINUX && !SANITIZER_ANDROID
42- unsigned struct_ustat_sz = sizeof(struct ustat);
43+ // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
44+ // has been removed from glibc 2.28.
45+#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
46+ || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
47+ || defined(__x86_64__)
48+#define SIZEOF_STRUCT_USTAT 32
49+#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
50+ || defined(__powerpc__) || defined(__s390__)
51+#define SIZEOF_STRUCT_USTAT 20
52+#else
53+#error Unknown size of struct ustat
54+#endif
55+ unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
56 unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
57 unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
58 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID