From patchwork Fri Mar 1 14:27:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1050224 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-100347-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="l/2trC1F"; 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 449sGJ2tYYz9s2R for ; Sat, 2 Mar 2019 01:28:07 +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:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=It11NTvP8D5lCPQt F/S6S7vIB+z43zW3O3LmLbt/nDHcbmiAXyekK1NSUJr4WOwD1LPl/OE/tfy3DQWT grEX5VbKUKvju8zlYcDqp9+XRuqUGwiAojHOdJ7aBsiNTLnnut+AG9+kj0kJ5Flq zi3XZ28r6xNdms9HWWfXg+0xQzo= 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:cc:subject:date:message-id :mime-version:content-type; s=default; bh=+sJ6qS5PgOZ1ozMQ4iIF3D /b/hQ=; b=l/2trC1FNVMLSZMMOvYRhpvb9xL0bsSRg1SSGXz0EVgUHyqHRw8tzY uS68/oU4y41bcoAtYtqnrfobj/kYdcO/yaOhtUE1b7qgw+cQp4OVi0YFUjMxkkWF iHGmqsolrvqapFXtmTstwwgIaIbE7Gnk9wSgfcox7k0GVyKboeCwU= Received: (qmail 121946 invoked by alias); 1 Mar 2019 14:28:02 -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 121905 invoked by uid 89); 1 Mar 2019 14:28:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:glibc-2, exercised, sk:glibc2, Hx-languages-length:2126 X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Cc: Paul Pluzhnikov , carlos@redhat.com Subject: [PATCH] elf/tst-big-note: Improve accuracy of test [BZ #20419] Date: Fri, 01 Mar 2019 15:27:54 +0100 Message-ID: <878sxyy8id.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 It is possible that the link editor injects an allocated ABI tag note before the artificial, allocated large note in the test. Note parsing in open_verify stops when the first ABI tag note is encountered, so if the ABI tag note comes first, the problematic code is not actually exercised. Also tweak the artificial note so that it is a syntactically valid 4-byte aligned note, in case the link editor tries to parse notes and process them. Improves the testing part of commit 0065aaaaae51cd60210ec3a7e13. Tested on ppc64le, including that the test now crashes as expected on a glibc-2.17-derived glibc without the backport of the original fix. 2019-03-01 Florian Weimer [BZ #20419] * elf/tst-big-note-lib.S: Create a syntactically valid note. * elf/Makefile (tst-big-note-lib.so): Do not link with startup code, to avoid creating an ABI tag note. Reviewed-by: Carlos O'Donell diff --git a/elf/Makefile b/elf/Makefile index 55204073a3..cc48b5d273 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1515,6 +1515,11 @@ tst-libc_dlvsym-static-ENV = \ $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so +# Avoid creating an ABI tag note, which may come before the +# artificial, large note in tst-big-note-lib.o and invalidate the +# test. +$(objpfx)tst-big-note-lib.so: $(objpfx)tst-big-note-lib.o + $(LINK.o) -shared -o $@ $(LDFLAGS.so) $< $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so diff --git a/elf/tst-big-note-lib.S b/elf/tst-big-note-lib.S index e2008cf4ae..721686fa0e 100644 --- a/elf/tst-big-note-lib.S +++ b/elf/tst-big-note-lib.S @@ -20,7 +20,13 @@ On a typical Linux system with 8MiB "ulimit -s", that was enough to trigger stack overflow in open_verify. */ +#define NOTE_SIZE 8*1024*1024 + .pushsection .note.big,"a" -.balign 4 -.fill 8*1024*1024, 1, 0 + .balign 4 + .long 5 /* n_namesz. Length of "GLIBC". */ + .long NOTE_SIZE /* n_descsz. */ + .long 0 /* n_type. */ + .ascii "GLIBC\0\0\0" /* Name and alignment to four bytes. */ + .fill NOTE_SIZE, 1, 0 .popsection