[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[glibc] 04/05: debian/patches/hppa/submitted-dladdr.diff: update patch to fix debug/backtrace-tst test failure. Closes: #824362.



This is an automated email from the git hooks/post-receive script.

aurel32 pushed a commit to branch sid
in repository glibc.

commit 89797de30195a56c72047a333b3c5e4dda23b04f
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Tue May 31 15:48:34 2016 +0200

    debian/patches/hppa/submitted-dladdr.diff: update patch to fix debug/backtrace-tst test failure.  Closes: #824362.
---
 debian/changelog                          |  2 ++
 debian/patches/hppa/submitted-dladdr.diff | 50 +++++++++++++++++++++++--------
 2 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c7c4932..eb42a48 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,8 @@ glibc (2.22-10) UNRELEASED; urgency=medium
   [ John David Anglin ]
   * debian/patches/hppa/submitted-setcontext.diff: new patch to fix setcontext
     return code on hppa.  Closes: #824344.
+  * debian/patches/hppa/submitted-dladdr.diff: update patch to fix
+    debug/backtrace-tst test failure.  Closes: #824362.
 
  -- Aurelien Jarno <aurel32@debian.org>  Thu, 12 May 2016 18:06:35 +0200
 
diff --git a/debian/patches/hppa/submitted-dladdr.diff b/debian/patches/hppa/submitted-dladdr.diff
index 7d488a8..c637b5b 100644
--- a/debian/patches/hppa/submitted-dladdr.diff
+++ b/debian/patches/hppa/submitted-dladdr.diff
@@ -7,9 +7,11 @@
 	* sysdeps/hppa/dl-lookupcfg.h (DL_LOOKUP_ADDRESS): Don't clear bottom
 	two bits in address.
 
---- a/sysdeps/hppa/dl-fptr.c
-+++ b/sysdeps/hppa/dl-fptr.c
-@@ -321,23 +321,54 @@
+Index: glibc-2.22/sysdeps/hppa/dl-fptr.c
+===================================================================
+--- glibc-2.22.orig/sysdeps/hppa/dl-fptr.c
++++ glibc-2.22/sysdeps/hppa/dl-fptr.c
+@@ -321,23 +321,76 @@ _dl_unmap (struct link_map *map)
    map->l_mach.fptr_table = NULL;
  }
  
@@ -28,6 +30,16 @@
 +
 +  return addr;
 +}
++
++static inline int
++_dl_read_access_allowed (unsigned int *addr)
++{
++  int result;
++
++  asm ("proberi        (%1),3,%0" : "=r" (result) : "r" (addr) : );
++
++  return result;
++}
  
  ElfW(Addr)
  _dl_lookup_address (const void *address)
@@ -46,17 +58,30 @@
 -	  break;
 -	}
 -    }
-+  /* Check for special cases.  */
-+  if ((int) addr == -1
-+      || (unsigned int) addr < 4096
-+      || !((unsigned int) addr & 2))
++  /* Return ADDR if the least-significant two bits of ADDR are not consistent
++     with ADDR being a linker defined function pointer.  The normal value for
++     a code address in a backtrace is 3.  */
++  if (((unsigned int) addr & 3) != 2)
 +    return addr;
  
 -  return addr;
++  /* Handle special case where ADDR points to page 0.  */
++  if ((unsigned int) addr < 4096)
++    return addr;
++
 +  /* Clear least-significant two bits from descriptor address.  */
 +  desc = (unsigned int *) ((unsigned int) addr & ~3);
++  if (!_dl_read_access_allowed (desc))
++    return addr;
++
++  /* Load first word of candidate descriptor.  It should be a pointer
++     with word alignment and point to memory that can be read.  */
++  gptr = (unsigned int *) desc[0];
++  if (((unsigned int) gptr & 3) != 0
++      || !_dl_read_access_allowed (gptr))
++    return addr;
 +
-+  /* Check if descriptor requires resolution.  The following trampoline is
++  /* See if descriptor requires resolution.  The following trampoline is
 +     used in each global offset table for function resolution:
 +
 +		ldw 0(r20),r22
@@ -68,7 +93,6 @@
 +		.word "_dl_runtime_resolve ltp"
 +     got:	.word _DYNAMIC
 +		.word "struct link map address" */
-+  gptr = (unsigned int *) desc[0];
 +  if (gptr[0] == 0xea9f1fdd			/* b,l .-12,r20     */
 +      && gptr[1] == 0xd6801c1e			/* depwi 0,31,2,r20 */
 +      && (ElfW(Addr)) gptr[2] == elf_machine_resolve ())
@@ -76,9 +100,11 @@
 +
 +  return (ElfW(Addr)) desc[0];
  }
---- a/sysdeps/hppa/dl-lookupcfg.h
-+++ b/sysdeps/hppa/dl-lookupcfg.h
-@@ -31,9 +31,7 @@
+Index: glibc-2.22/sysdeps/hppa/dl-lookupcfg.h
+===================================================================
+--- glibc-2.22.orig/sysdeps/hppa/dl-lookupcfg.h
++++ glibc-2.22/sysdeps/hppa/dl-lookupcfg.h
+@@ -31,9 +31,7 @@ rtld_hidden_proto (_dl_symbol_address)
  
  Elf32_Addr _dl_lookup_address (const void *address);
  

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git


Reply to: