forked from rpms/glibc
42eb238e49
* Tue Mar 15 2022 Florian Weimer <fweimer@redhat.com> - 2.34-29 - Sync with upstream branch release/2.34/master, commit 224d8c1890b6c57c7e4e8ddbb792dd9552086704: - debug: Synchronize feature guards in fortified functions [BZ #28746] - debug: Autogenerate _FORTIFY_SOURCE tests - Enable _FORTIFY_SOURCE=3 for gcc 12 and above - fortify: Fix spurious warning with realpath - __glibc_unsafe_len: Fix comment - debug: Add tests for _FORTIFY_SOURCE=3 - Make sure that the fortified function conditionals are constant - Don't add access size hints to fortifiable functions - nss: Protect against errno changes in function lookup (bug 28953) - nss: Do not mention NSS test modules in <gnu/lib-names.h> - io: Add fsync call in tst-stat - hppa: Fix warnings from _dl_lookup_address - nptl: Fix cleanups for stack grows up [BZ# 28899] - hppa: Revise gettext trampoline design - hppa: Fix swapcontext - Fix elf/tst-audit2 on hppa - localedef: Handle symbolic links when generating locale-archive - NEWS: Add a bug fix entry for BZ #28896 - x86: Fix TEST_NAME to make it a string in tst-strncmp-rtm.c - x86: Test wcscmp RTM in the wcsncmp overflow case [BZ #28896] - x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #28896] - string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755] - linux: fix accuracy of get_nprocs and get_nprocs_conf [BZ #28865] - Add reference to BZ#28860 on NEWS - linux: Fix missing __convert_scm_timestamps (BZ #28860) Resolves: #2063230 Resolves: #2033683 Resolves: #2063041 Resolves: #2063142
123 lines
4.4 KiB
Diff
123 lines
4.4 KiB
Diff
commit 6c9c2307657529e52c5fa7037618835f2a50b916
|
|
Author: John David Anglin <danglin@gcc.gnu.org>
|
|
Date: Sun Mar 6 16:04:32 2022 +0000
|
|
|
|
hppa: Fix warnings from _dl_lookup_address
|
|
|
|
This change fixes two warnings from _dl_lookup_address.
|
|
|
|
The first warning comes from dropping the volatile keyword from
|
|
desc in the call to _dl_read_access_allowed. We now have a full
|
|
atomic barrier between loading desc[0] and the access check, so
|
|
desc no longer needs to be declared as volatile.
|
|
|
|
The second warning comes from the implicit declaration of
|
|
_dl_fix_reloc_arg. This is fixed by including dl-runtime.h and
|
|
declaring _dl_fix_reloc_arg in dl-runtime.h.
|
|
|
|
diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c
|
|
index 62ef68b62bd601f4..cd4f77c0ecfd376f 100644
|
|
--- a/sysdeps/hppa/dl-fptr.c
|
|
+++ b/sysdeps/hppa/dl-fptr.c
|
|
@@ -26,6 +26,7 @@
|
|
#include <ldsodefs.h>
|
|
#include <elf/dynamic-link.h>
|
|
#include <dl-fptr.h>
|
|
+#include <dl-runtime.h>
|
|
#include <dl-unmap-segments.h>
|
|
#include <atomic.h>
|
|
#include <libc-pointer-arith.h>
|
|
@@ -351,21 +352,20 @@ _dl_lookup_address (const void *address)
|
|
{
|
|
ElfW(Addr) addr = (ElfW(Addr)) address;
|
|
ElfW(Word) reloc_arg;
|
|
- volatile unsigned int *desc;
|
|
- unsigned int *gptr;
|
|
+ unsigned int *desc, *gptr;
|
|
|
|
/* 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)
|
|
+ if (((uintptr_t) addr & 3) != 2)
|
|
return addr;
|
|
|
|
/* Handle special case where ADDR points to page 0. */
|
|
- if ((unsigned int) addr < 4096)
|
|
+ if ((uintptr_t) addr < 4096)
|
|
return addr;
|
|
|
|
/* Clear least-significant two bits from descriptor address. */
|
|
- desc = (unsigned int *) ((unsigned int) addr & ~3);
|
|
+ desc = (unsigned int *) ((uintptr_t) addr & ~3);
|
|
if (!_dl_read_access_allowed (desc))
|
|
return addr;
|
|
|
|
@@ -376,7 +376,7 @@ _dl_lookup_address (const void *address)
|
|
/* Then 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
|
|
+ if (((uintptr_t) gptr & 3) != 0
|
|
|| !_dl_read_access_allowed (gptr))
|
|
return addr;
|
|
|
|
@@ -400,10 +400,11 @@ _dl_lookup_address (const void *address)
|
|
|
|
/* If gp has been resolved, we need to hunt for relocation offset. */
|
|
if (!(reloc_arg & PA_GP_RELOC))
|
|
- reloc_arg = _dl_fix_reloc_arg (addr, l);
|
|
+ reloc_arg = _dl_fix_reloc_arg ((struct fdesc *) addr, l);
|
|
|
|
_dl_fixup (l, reloc_arg);
|
|
}
|
|
|
|
return (ElfW(Addr)) desc[0];
|
|
}
|
|
+rtld_hidden_def (_dl_lookup_address)
|
|
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
|
|
index a9a927f26c6fec09..2f6991aa16e87a00 100644
|
|
--- a/sysdeps/hppa/dl-lookupcfg.h
|
|
+++ b/sysdeps/hppa/dl-lookupcfg.h
|
|
@@ -30,6 +30,7 @@ rtld_hidden_proto (_dl_symbol_address)
|
|
#define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
|
|
|
|
Elf32_Addr _dl_lookup_address (const void *address);
|
|
+rtld_hidden_proto (_dl_lookup_address)
|
|
|
|
#define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address ((const void *) addr)
|
|
|
|
diff --git a/sysdeps/hppa/dl-runtime.c b/sysdeps/hppa/dl-runtime.c
|
|
index e7fbb7417d866bb0..a71b5b2013abf723 100644
|
|
--- a/sysdeps/hppa/dl-runtime.c
|
|
+++ b/sysdeps/hppa/dl-runtime.c
|
|
@@ -25,8 +25,7 @@
|
|
return that to the caller. The caller will continue on to call
|
|
_dl_fixup with the relocation offset. */
|
|
|
|
-ElfW(Word)
|
|
-attribute_hidden __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
|
|
+ElfW(Word) __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
|
|
_dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l)
|
|
{
|
|
Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type;
|
|
@@ -52,3 +51,4 @@ _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l)
|
|
ABORT_INSTRUCTION;
|
|
return 0;
|
|
}
|
|
+rtld_hidden_def (_dl_fix_reloc_arg)
|
|
diff --git a/sysdeps/hppa/dl-runtime.h b/sysdeps/hppa/dl-runtime.h
|
|
index 5d6ee53b076d5e0e..9913539b5f0e7435 100644
|
|
--- a/sysdeps/hppa/dl-runtime.h
|
|
+++ b/sysdeps/hppa/dl-runtime.h
|
|
@@ -17,6 +17,9 @@
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
+ElfW(Word) _dl_fix_reloc_arg (struct fdesc *, struct link_map *);
|
|
+rtld_hidden_proto (_dl_fix_reloc_arg)
|
|
+
|
|
/* Clear PA_GP_RELOC bit in relocation offset. */
|
|
static inline uintptr_t
|
|
reloc_offset (uintptr_t plt0, uintptr_t pltn)
|