mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
Extended ELF ABI version handling only for Linux.
If the OSABI is generic we should not allow the ABI version to be nonzero. Move all the new functionality into Linux-specific files.
This commit is contained in:
parent
8ed9a2b18b
commit
d8c47894ca
10
ChangeLog
10
ChangeLog
@ -1,5 +1,15 @@
|
|||||||
2010-03-16 Ulrich Drepper <drepper@redhat.com>
|
2010-03-16 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-load.c (VALID_ELF_ABIVERSION): Add additional osabi parameter.
|
||||||
|
Not used here.
|
||||||
|
(open_verify): Modify for extended VALID_ELF_ABIVERSION macro
|
||||||
|
interface.
|
||||||
|
* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Add
|
||||||
|
additional osabi parameter. Only acceept nonzero ABI versions if osabi
|
||||||
|
is Linux.
|
||||||
|
Fix includes.
|
||||||
|
(expected2): Don't explicitly initialize EI_ABIVERSION byte.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Update
|
* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_ABIVERSION): Update
|
||||||
definition to follow generic code.
|
definition to follow generic code.
|
||||||
|
|
||||||
|
@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
|
|||||||
#ifndef VALID_ELF_HEADER
|
#ifndef VALID_ELF_HEADER
|
||||||
# define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0)
|
# define VALID_ELF_HEADER(hdr,exp,size) (memcmp (hdr, exp, size) == 0)
|
||||||
# define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV)
|
# define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV)
|
||||||
# define VALID_ELF_ABIVERSION(ver) (ver < LIBC_ABI_MAX)
|
# define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0)
|
||||||
#elif defined MORE_ELF_HEADER_DATA
|
#elif defined MORE_ELF_HEADER_DATA
|
||||||
MORE_ELF_HEADER_DATA;
|
MORE_ELF_HEADER_DATA;
|
||||||
#endif
|
#endif
|
||||||
@ -1656,7 +1656,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
|
|||||||
/* See whether the ELF header is what we expect. */
|
/* See whether the ELF header is what we expect. */
|
||||||
if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
|
if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
|
||||||
EI_ABIVERSION)
|
EI_ABIVERSION)
|
||||||
|| !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]),
|
|| !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
|
||||||
|
ehdr->e_ident[EI_ABIVERSION]),
|
||||||
0))
|
0))
|
||||||
{
|
{
|
||||||
/* Something is wrong. */
|
/* Something is wrong. */
|
||||||
@ -1697,7 +1698,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
|
|||||||
allowed here. */
|
allowed here. */
|
||||||
else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI]))
|
else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI]))
|
||||||
errstring = N_("ELF file OS ABI invalid");
|
errstring = N_("ELF file OS ABI invalid");
|
||||||
else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]))
|
else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
|
||||||
|
ehdr->e_ident[EI_ABIVERSION]))
|
||||||
errstring = N_("ELF file ABI version invalid");
|
errstring = N_("ELF file ABI version invalid");
|
||||||
else
|
else
|
||||||
/* Otherwise we don't know what went wrong. */
|
/* Otherwise we don't know what went wrong. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Run-time dynamic linker data structures for loaded ELF shared objects.
|
/* Run-time dynamic linker data structures for loaded ELF shared objects.
|
||||||
Copyright (C) 2001, 2002, 2003, 2006, 2009 Free Software Foundation, Inc.
|
Copyright (C) 2001, 2002, 2003, 2006, 2009, 2010 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#ifndef _LDSODEFS_H
|
#ifndef _LDSODEFS_H
|
||||||
|
|
||||||
|
#include <libc-abis.h>
|
||||||
#include <kernel-features.h>
|
#include <kernel-features.h>
|
||||||
|
|
||||||
/* Get the real definitions. */
|
/* Get the real definitions. */
|
||||||
@ -58,7 +59,8 @@ extern void _dl_non_dynamic_init (void) internal_function;
|
|||||||
|| memcmp (hdr, expected2, size) == 0)
|
|| memcmp (hdr, expected2, size) == 0)
|
||||||
#define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV \
|
#define VALID_ELF_OSABI(osabi) (osabi == ELFOSABI_SYSV \
|
||||||
|| osabi == ELFOSABI_LINUX)
|
|| osabi == ELFOSABI_LINUX)
|
||||||
#define VALID_ELF_ABIVERSION(ver) (ver < LIBC_ABI_MAX)
|
#define VALID_ELF_ABIVERSION(osabi,ver) \
|
||||||
|
(ver == 0 || (osabi == ELFOSABI_LINUX && ver < LIBC_ABI_MAX))
|
||||||
#define MORE_ELF_HEADER_DATA \
|
#define MORE_ELF_HEADER_DATA \
|
||||||
static const unsigned char expected2[EI_PAD] = \
|
static const unsigned char expected2[EI_PAD] = \
|
||||||
{ \
|
{ \
|
||||||
@ -69,8 +71,7 @@ extern void _dl_non_dynamic_init (void) internal_function;
|
|||||||
[EI_CLASS] = ELFW(CLASS), \
|
[EI_CLASS] = ELFW(CLASS), \
|
||||||
[EI_DATA] = byteorder, \
|
[EI_DATA] = byteorder, \
|
||||||
[EI_VERSION] = EV_CURRENT, \
|
[EI_VERSION] = EV_CURRENT, \
|
||||||
[EI_OSABI] = ELFOSABI_LINUX, \
|
[EI_OSABI] = ELFOSABI_LINUX \
|
||||||
[EI_ABIVERSION] = 0 \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ldsodefs.h */
|
#endif /* ldsodefs.h */
|
||||||
|
Loading…
Reference in New Issue
Block a user