On 23/11/15 16:24, Jakub Jelinek wrote:
On Mon, Nov 23, 2015 at 04:21:34PM +0300, Maxim Ostapenko wrote:
Yeah, right. I've asked about kernel headers just to make sure I correctly
understand the issue.

Actually, I see such code in
lib/sanitizer_common/sanitizer_platform_limits_posix.cc:

#if defined(PTRACE_GETVFPREGS) && defined(PTRACE_SETVFPREGS)
   int ptrace_getvfpregs = PTRACE_GETVFPREGS;
   int ptrace_setvfpregs = PTRACE_SETVFPREGS;
#else
   int ptrace_getvfpregs = -1;
   int ptrace_setvfpregs = -1;
#endif

and in ptrace interceptor:

  else if (request == ptrace_setvfpregs)
     COMMON_INTERCEPTOR_READ_RANGE(ctx, data, struct_user_vfpregs_struct_sz);
  else if (request == ptrace_getvfpregs)
     COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data, struct_user_vfpregs_struct_sz)

So, perhaps we can do the same thing with ARM_VFPREGS_SIZE, something like
this?

diff --git
a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 9866cc9..20ff224 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -323,10 +323,14 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
    unsigned struct_user_fpxregs_struct_sz = sizeof(struct
user_fpxregs_struct);
  #endif // __x86_64 || __mips64 || __powerpc64__ || __aarch64__ || __arm__
  #ifdef __arm__
+#if defined(ARM_VFPREGS_SIZE)
    unsigned struct_user_vfpregs_struct_sz = ARM_VFPREGS_SIZE;
  #else
    unsigned struct_user_vfpregs_struct_sz = 0;
  #endif
+#else
+  unsigned struct_user_vfpregs_struct_sz = 0;
+#endif
Maybe, but then it would need to be approved upstream.
If you just define ARM_VFPREGS_SIZE to 0 or whatever else in
the GCC owned wrapper headers, you can avoid that.
I guess talk to upstream.

        Jakub



Ok, I posted a fix to upstream (http://reviews.llvm.org/D14921) yesterday, but it's still not reviewed. So, I'm wondering if I should fix the issue locally?
Attaching proposed fix following Jakub's suggestion.

Christophe could you try the patch?
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index b97fc7d..c392c57 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-24  Maxim Ostapenko  <m.ostape...@partner.samsung.com>
+
+	* include/system/linux/asm/ptrace.h: New header.
+
 2015-11-23  Maxim Ostapenko  <m.ostape...@partner.samsung.com>
 
 	* All source files: Merge from upstream r253555.
diff --git a/libsanitizer/include/system/linux/asm/ptrace.h b/libsanitizer/include/system/linux/asm/ptrace.h
new file mode 100644
index 0000000..dbdd58b
--- /dev/null
+++ b/libsanitizer/include/system/linux/asm/ptrace.h
@@ -0,0 +1,8 @@
+#include_next <linux/asm/ptrace.h>
+#if defined(__arm__)
+#ifndef ARM_VFPREGS_SIZE
+/* The size of the user-visible VFP state as seen by PTRACE_GET/SETVFPREGS
+   and core dumps.  */
+#define ARM_VFPREGS_SIZE ( 32 * 8 /*fpregs*/ + 4 /*fpscr*/ )
+#endif
+#endif

Reply via email to