From patchwork Thu Oct 10 08:48:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 34904 Received: (qmail 28773 invoked by alias); 10 Oct 2019 08:48:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 27661 invoked by uid 89); 10 Oct 2019 08:48:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=fingerprint, schwab X-HELO: mx1.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Simplify note processing X-Yow: ...PENGUINS are floating by... Date: Thu, 10 Oct 2019 10:48:29 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 This removes dead code during note processing. * elf/dl-load.c (open_verify): Remove dead code. --- elf/dl-load.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index 24e2819345..1ed7a7bbd6 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1682,21 +1682,10 @@ open_verify (const char *name, int fd, /* 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) + if (ph->p_type == PT_NOTE && ph->p_filesz >= 32 + && (ph->p_align == 4 || ph->p_align == 8)) { ElfW(Addr) size = ph->p_filesz; - /* NB: Some PT_NOTE segment may have alignment value of 0 - or 1. gABI specifies that PT_NOTE segments should be - aligned to 4 bytes in 32-bit objects and to 8 bytes in - 64-bit objects. As a Linux extension, we also support - 4 byte alignment in 64-bit objects. If p_align is less - than 4, we treate alignment as 4 bytes since some note - segments have 0 or 1 byte alignment. */ - ElfW(Addr) align = ph->p_align; - if (align < 4) - align = 4; - else if (align != 4 && align != 8) - continue; if (ph->p_offset + size <= (size_t) fbp->len) abi_note = (void *) (fbp->buf + ph->p_offset); @@ -1727,7 +1716,7 @@ open_verify (const char *name, int fd, { ElfW(Addr) note_size = ELF_NOTE_NEXT_OFFSET (abi_note[0], abi_note[1], - align); + ph->p_align); if (size - 32 < note_size) {