summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-10 17:21:29 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-10 17:21:29 +0000
commit40e2fc8b708d74c59548fd5a5673b2d3329f34c0 (patch)
tree8be4e4504aefe4307f20a37d640dd6360a75b6b0 /sysdeps
parent6c03cd11e9c253211c831a70dfece6f5bd07e12c (diff)
* elf/dl-load.c (open_verify): In case VALID_ELF_HEADER is
defined, allow additional data to be added using the optional MORE_ELF_HEADER_DATA macro. * sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_HEADER, VALID_ELF_OSABI, VALID_ELF_ABIVERSION, MORE_ELF_HEADER_DATA): Define.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/ldsodefs.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
index 0bdca3c3fd..0965f1496f 100644
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -53,4 +53,24 @@ extern void _dl_non_dynamic_init (void) internal_function;
# define HAVE_AUX_PAGESIZE
#endif
+/* Accept binaries which identify the binary as using Linux extensions. */
+#define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0 \
+ || memcmp (hdr, expected2, size) == 0)
+#define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV \
+ || osabi == ELFOSABI_LINUX)
+#define VALID_ELF_ABIVERSION(ver) (ver == 0)
+#define MORE_ELF_HEADER_DATA \
+ static const unsigned char expected2[EI_PAD] = \
+ { \
+ [EI_MAG0] = ELFMAG0, \
+ [EI_MAG1] = ELFMAG1, \
+ [EI_MAG2] = ELFMAG2, \
+ [EI_MAG3] = ELFMAG3, \
+ [EI_CLASS] = ELFW(CLASS), \
+ [EI_DATA] = byteorder, \
+ [EI_VERSION] = EV_CURRENT, \
+ [EI_OSABI] = ELFOSABI_LINUX, \
+ [EI_ABIVERSION] = 0 \
+ }
+
#endif /* ldsodefs.h */