From d6f373d21b19565838cb9848c15b8070f2fe1305 Mon Sep 17 00:00:00 2001 From: Matthew Fortune Date: Wed, 1 Oct 2014 17:08:51 +0100 Subject: Add a hook to enable load-time inspection of program headers This hook can be used to perform additional compatibility checks between shared libraries by inspecting custom program header information. * elf/dl-machine-reject-phdr.h: New file. * elf/dl-load.c: #include that. (open_verify): Call elf_machine_reject_phdr_p and ignore the file if that returned true. --- elf/dl-load.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'elf/dl-load.c') diff --git a/elf/dl-load.c b/elf/dl-load.c index ce5b626b26..7a03ccfd2a 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -1683,6 +1684,11 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader, } } + if (__glibc_unlikely (elf_machine_reject_phdr_p + (phdr, ehdr->e_phnum, fbp->buf, fbp->len, + loader, fd))) + goto close_and_out; + /* Check .note.ABI-tag if present. */ for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph) if (ph->p_type == PT_NOTE && ph->p_filesz >= 32 && ph->p_align >= 4) -- cgit v1.2.3