aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog7
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc7
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h2
3 files changed, 13 insertions, 3 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index acde79f..141291f 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,5 +1,12 @@
2018-04-26 Hans-Peter Nilsson <hp@axis.com>
+ * sanitizer_common/sanitizer_platform_limits_linux.cc: Do not
+ take the shortcut to #include <sys/stat.h> for MIPS instead of
+ the kernel <asm/stat.h>. Explain why sys/stat.h is misleading
+ or wrong to get the kernel struct stat.
+ * sanitizer_common/sanitizer_platform_limits_posix.h [__mips__]:
+ Correct the value for 32-bit non-android struct_kernel_stat_sz.
+
* sanitizer_common/sanitizer_atomic_clang_other.h [_MIPS_SIM
&& _MIPS_SIM == _ABIO32] (lock): Add initializer for .pad member.
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
index 23a0148..3a90653 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -25,9 +25,12 @@
// With old kernels (and even new kernels on powerpc) asm/stat.h uses types that
// are not defined anywhere in userspace headers. Fake them. This seems to work
-// fine with newer headers, too.
+// fine with newer headers, too. Beware that with <sys/stat.h>, struct stat
+// takes the form of struct stat64 on 32-bit platforms if _FILE_OFFSET_BITS=64.
+// Also, for some platforms (e.g. mips) there are additional members in the
+// <sys/stat.h> struct stat:s.
#include <linux/posix_types.h>
-#if defined(__x86_64__) || defined(__mips__)
+#if defined(__x86_64__)
#include <sys/stat.h>
#else
#define ino_t __kernel_ino_t
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 4d11d07..132e5e9 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -86,7 +86,7 @@ namespace __sanitizer {
#elif defined(__mips__)
const unsigned struct_kernel_stat_sz =
SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) :
- FIRST_32_SECOND_64(160, 216);
+ FIRST_32_SECOND_64(144, 216);
const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390__) && !defined(__s390x__)
const unsigned struct_kernel_stat_sz = 64;