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: 1174375 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105823-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="dIMHCHPp"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pl9t22L1z9sSN for ; Thu, 10 Oct 2019 19:48:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=lIagpZ4MX56VQ/kQzPBL0bNEkaIpQ F+9GnBZznDjdCscLnTRUYm8sHfs4B9VwHHk0czZSy7jBF9vsslOOAC8q2CubPAy4 a1denz/Gd4YlULBoQs5vYZPNfYbk1m4E1i/TxY2xnuz40sJW/30jrW2M/Q3lZrTw 61cY8UMN7/iqHk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=jQx5VoKN5gvQ2Q0q97OLiY5zb1k=; b=dIM HCHPpCcd1aMh42p1Ff3BVv40BxsTcRxij2dhA5Itlm+ZqPmiSq+MIgVlkVmT3KB+ ET0C23pWCc8r1cObgR5VroRc1IyrCqcX1EsiwKKV18H8toClwNhgSGkSv1FL7tKO Kv8lP63xpC2INkLgi305hheRvumBRlpzAxkvw5Ek= 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) {