From patchwork Tue Apr 16 15:28:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13632074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50B04C4345F for ; Tue, 16 Apr 2024 15:28:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC7A86B009A; Tue, 16 Apr 2024 11:28:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D78266B009B; Tue, 16 Apr 2024 11:28:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3FAE6B009C; Tue, 16 Apr 2024 11:28:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A6EEA6B009A for ; Tue, 16 Apr 2024 11:28:13 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 737D880B85 for ; Tue, 16 Apr 2024 15:28:13 +0000 (UTC) X-FDA: 82015776066.04.9B4DAFD Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf22.hostedemail.com (Postfix) with ESMTP id D88B4C0015 for ; Tue, 16 Apr 2024 15:28:11 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=q5ie51gk; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf22.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1713281292; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=qF6p1YPdfboNLsIrMgn/7HauXXlP04nm6WbKlQhhMqY=; b=J8yfxip6RtZp8iWmqrPaEASc4mrndqLLmIjlB65CXeAya2ZGc6iP4XeMQ92xVYeufQIOuc 2YPtT+J/JAw4Hgp5trywjmB/vYAf/U0wYbMhbkOzuByQ1LiGrV7mvgAaMpUat/76N7Pu1M TCm06mU34igRxBN9BWiT6wFlulgke9Q= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=q5ie51gk; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf22.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1713281292; a=rsa-sha256; cv=none; b=d7IKJrEtPQtRZaLrAYy0g9G/Ekhwv6iHF0SNeC1ZpmbfPa4IyAModTbZvv5QC3FVfZK2S+ d7pdrYtpCQqkOoaJ+2v25zjobMHTzwwlbxtp+fnz6uucXeEKCRTM7uW2xR+acmj58/vB8+ /Z8+fNLB1gVi4Jih/Ad4NPjBe/ufzB4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713281290; bh=NGtY+NfH5eSYN/zT1SdxCb+w6K6ZM2eMh40eWe83mAw=; h=From:To:Cc:Subject:Date:From; b=q5ie51gkGiYUIkIH7VFgHFaGbHNjJNJ4bmSL6eUqT6OilkJU0r80xLkLOQ+sgdSV0 bwIQNhl/g6vndbJtGrPydob0tNnkA6xAM+8ACZBUs5mMSG8yaQV95MIjCBLOIkR2gg I/9NAhQzY+7q7rPZFUWjTlggR6pWcc98f+TN+0wZLphdL6WXtrt1zCZVeugwK1qOxc 3Xpae/6sqP1L8jRvh5so3zjTJ485iyp9ij+YUZ+gXP3SuxfjGRCfFMXB5SklzTKl3M GNBjmU4IlCAcr7USdFHByfH9ALNfEMvvs/KD3ajrd16vPRwg362veCUjo1c8wJbjld KqR92gMgfFgsQ== Received: from localhost.localdomain (broslavsky.collaboradmins.com [68.183.210.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id B359B37804B2; Tue, 16 Apr 2024 15:28:03 +0000 (UTC) From: Muhammad Usama Anjum To: Eric Biederman , Kees Cook , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Muhammad Usama Anjum , Andrew Morton , Yang Yingliang Cc: kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH v2] selftests: exec: make binaries position independent Date: Tue, 16 Apr 2024 20:28:29 +0500 Message-Id: <20240416152831.3199999-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: D88B4C0015 X-Stat-Signature: 344j7km7de4gquhpjp4me4uhcbj4xe8k X-HE-Tag: 1713281291-605870 X-HE-Meta: U2FsdGVkX18OGLMooueM5NHDG5gXkqKQAgyNVz8RX1EcHdB0EcT2mn8b3yKZX+1C7vDpRO/y+gdQAiQUS+d86CUSepMunYhHeiB9enPj6eYk0zyZNOfPTNSWGFh0WjP4MJWIV1XLpUJzrHpBWbjxLRgiCmdQkC+14Hqx34zlyoU8y5SAqX3xsuwZwCRO4HOG2T3kiz77iBvXGbxNfS4oYUBHmWigNOvjYe/izhnKRVCu8KCeZZLCtkBchLmlDEcBajZOHgWOCaaTovZvwxnOkPvUeIc3hupbZDiRrJBTzmuLYlQUnmnzUBI3lKtuNBDQrTeZ+b88IJXZNCDBNY5oR0WTKavHCEtZXarYVHD4r3J0QD9yj9UWHcqTqyBTi595KietYndHGzEXa2XpbMpORfqMF8pE/YJ4UXGkrK264E6hq6IBHigROh2c6i9SF+smabvI+Wou+08buxGrmMrlWh3y1LznDNLYhk0VTLt77K228FApfXFAypEZ8DrnY3Lvz3U/9OyTmDLwxknpBVZbCO5Oji5JPzErSgvugc6ohwZBHfjnqQBO6uF+XN+hxbERcktEBP1hnZnAbEALUgL2nsNLuQKhF0r9aKbaGCz8qbN744kSFVtOGGHZ58PWyKVn0A+g9uOBjn7qB0ye3PQmqvbD3L46dOJLWfn4ITBwZ8PJJviwZPQeQheEocVXl+T7Dni1xBeEiOnsrtEWmb27Es/JqkslkTKIAAa7VGatdmeiiSIxFfV4N+ozezQvq/tNNs/HVKcRRFKKvUpe6gNdh3hFrrkzbdeuuw4pnTJOD2bLmjNkEWDjAbA8avL/0AEMlE/Z3Kr6c5c5TbML5S2OFVWGXVJh8SBzGYQ9LSFAt8Uq8O/0xVk1Gs0oTv8tXYuMPeHgHGnV0omNc5F5ihpmOEDrSACWOhyw/Y2UYkcJutc7Dr2I37Z14OciXPsoEOwpH6BpjlZUhnB+LL+UuyJ PSaEPCia tIkzdONLziHjzLsbV3G6yTdW6+lnlnHhe/FUE2LWs5oRMP+RilmhtsW8u5nZ2dTQeEoHkQgxxJX9Ac8Bak5nHlOWehl5PfubH2WQg43VQXtqnutq/jd06u3mZjMEElK1IGtxPLnhSc5+QQ3gC+j2QaqBjeVB5YUG34UkqGcD03iKYYmF/mANQffEdDOJ9fx0tvRpsxcsNt5V0lVjQiA2Fef9Nk1v6mYPYT2qF3RtgcyAGyVQWTq0pxxu9kXENKKNmVVE9 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The -static overrides the -pie and binaries aren't position independent anymore. Use -static-pie instead which would produce a static and position independent binary. This has been caught by clang's warnings: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument] Tested with both gcc and clang after this change. Fixes: 4d1cd3b2c5c1 ("tools/testing/selftests/exec: fix link error") Signed-off-by: Muhammad Usama Anjum Reviewed-by: Kees Cook --- Changes since v1: - Remove unneeded comment --- tools/testing/selftests/exec/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile index fb4472ddffd81..3c79ec9bf780f 100644 --- a/tools/testing/selftests/exec/Makefile +++ b/tools/testing/selftests/exec/Makefile @@ -29,8 +29,8 @@ $(OUTPUT)/execveat.denatured: $(OUTPUT)/execveat cp $< $@ chmod -x $@ $(OUTPUT)/load_address_4096: load_address.c - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -pie -static $< -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000 -static-pie $< -o $@ $(OUTPUT)/load_address_2097152: load_address.c - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -pie -static $< -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x200000 -static-pie $< -o $@ $(OUTPUT)/load_address_16777216: load_address.c - $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -pie -static $< -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-z,max-page-size=0x1000000 -static-pie $< -o $@