From patchwork Fri Jul 26 10:33:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Henrik_Lindstr=C3=B6m?= X-Patchwork-Id: 1965255 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lxm.se header.i=@lxm.se header.a=rsa-sha256 header.s=loopiadkim1708025221 header.b=MzSDlzc9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WVkfJ3Nmbz20FJ for ; Fri, 26 Jul 2024 20:35:04 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A89D8384A470 for ; Fri, 26 Jul 2024 10:35:02 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp.outgoing.loopia.se (smtp.outgoing.loopia.se [93.188.3.37]) by sourceware.org (Postfix) with ESMTPS id B3431385DC1B for ; Fri, 26 Jul 2024 10:34:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B3431385DC1B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lxm.se Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lxm.se ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B3431385DC1B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=93.188.3.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721990085; cv=none; b=TuLC+DztFAMlgPUhPTS8ePyg4BhV8NihRxw34CRwsdIKZrETj9ib8bxwvKalMUDv7V/0A5LziHdXaoNXiZpKmuFjut8JswjeMt4iEGNS7mSE+vUgkjf5JCJJMVqhB9/L+mpEqBAj/AI+j63vruCFLp2Zsw6Wh4XMS7quPt+h5Qs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721990085; c=relaxed/simple; bh=rBGFfdSeIHSQa570CM6y/mki3ph9Xvy309Ef5UGCCZk=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=JEPurKZJzoDcIfjG+lahbyCCL2lCVEMs7zdWuyWXS/Qz/aStkJt5rHX3xUgNb5CJYkY23F3r5V6ozedocaP9nBns3hgQp+WblTRqcoUHuf0aHmWG73lUcnIX8EZ7HwexuNyEvNPZqAb9xsAT3O/4eze+FOKTnPBnrVE3SvPRdhc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id B56412EB10 for ; Fri, 26 Jul 2024 12:34:37 +0200 (CEST) Received: from s934.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id A1EFF2D7D2; Fri, 26 Jul 2024 12:34:37 +0200 (CEST) Received: from s474.loopia.se (unknown [172.22.191.5]) by s934.loopia.se (Postfix) with ESMTP id A03B67CEA85; Fri, 26 Jul 2024 12:34:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Score: -1.2 X-Spam-Level: X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 Authentication-Results: s474.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=lxm.se Received: from s934.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with UTF8LMTP id MmMM05pqiNfp; Fri, 26 Jul 2024 12:34:37 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: henrik@lxm.se X-Loopia-Originating-IP: 92.35.23.126 Received: from pc.arpa.home (c-7e17235c.012-196-6c6b701.bbcust.telenor.se [92.35.23.126]) (Authenticated sender: henrik@lxm.se) by s934.loopia.se (Postfix) with ESMTPSA id E684F7CEA86; Fri, 26 Jul 2024 12:34:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lxm.se; s=loopiadkim1708025221; t=1721990077; bh=yQy4akr7xPpGiXdRqRkz+mv8OzuD6jdrHwKMod/x7PU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MzSDlzc9VYmxoKihKfV56Ct2vNBLWNvBsPR7vB+4kTFxElzSRLjNrUnC4HiHzdR8H EzWFbM6lxdkXtNSHw5rCBuHHOgDBKaZi0O1GzTOuHqti71syan5whZKs+856PA6H8u q4y2kjYLj/PLiO0SM/BOijN5q+FAAQpCeLDRUue17XqswAtd++DdGggTcSDcjUJXdd AgHWS59Te8uZ8GK4ascLLsGhO37Cf66KElZodfv8/hi1z4SoXnSnk32F7y/Q2FsSPj o7j47qTIs62lp346j88u9gCa9enXgljccsMS31t9BU0/PMzMiNpEl3LDUYvEwV6fKX 8LwVm/5OqI7FQ== From: =?utf-8?q?Henrik_Lindstr=C3=B6m?= To: libc-alpha@sourceware.org Cc: adhemerval.zanella@linaro.org, =?utf-8?q?Henrik_Lindstr=C3=B6m?= Subject: [PATCH v2 2/2] rtld: Add test case for '--' option Date: Fri, 26 Jul 2024 12:33:51 +0200 Message-Id: <20240726103351.3956251-2-henrik@lxm.se> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240726103351.3956251-1-henrik@lxm.se> References: <20240726103351.3956251-1-henrik@lxm.se> MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org --- elf/Makefile | 7 +++++++ elf/tst-rtld-dash-dash.sh | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 elf/tst-rtld-dash-dash.sh Reviewed-by: Adhemerval Zanella diff --git a/elf/Makefile b/elf/Makefile index a3475f3fb5..68444e88d9 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -630,6 +630,13 @@ $(objpfx)tst-rtld-does-not-exist.out: tst-rtld-does-not-exist.sh $(objpfx)ld.so $(SHELL) $< $(objpfx)ld.so > $@; \ $(evaluate-test) +ifeq ($(run-built-tests),yes) +tests-special += $(objpfx)tst-rtld-dash-dash.out +endif +$(objpfx)tst-rtld-dash-dash.out: tst-rtld-dash-dash.sh $(objpfx)ld.so + $(SHELL) $< $(objpfx)ld.so > $@; \ + $(evaluate-test) + tests += $(tests-execstack-$(have-z-execstack)) ifeq ($(run-built-tests),yes) tests-special += \ diff --git a/elf/tst-rtld-dash-dash.sh b/elf/tst-rtld-dash-dash.sh new file mode 100644 index 0000000000..2bc1f85598 --- /dev/null +++ b/elf/tst-rtld-dash-dash.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Test for the '--' option in ld.so. +# Copyright (C) 2024 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +export LC_ALL=C + +# --inhibit-cache to suppress "No such file or directory" message when +# /etc/ld.so.cache does not exist. +rtld="$1 --inhibit-cache" +tmp_out="$(mktemp)" + +$rtld -- --program-does-not-exist 2>"$tmp_out" +status=$? +echo "$rtld exit status: $status" +echo "output (with expected error):" +cat "$tmp_out" + +if test $status -eq 127 \ + && grep -q "^--program-does-not-exist: error while loading shared libraries: --program-does-not-exist: cannot open shared object file$" "$tmp_out" \ + && test "$(wc -l < "$tmp_out")" -eq 1 ; then + status=0 +else + status=1 +fi +rm "$tmp_out" +exit $status