Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp47197lqb; Tue, 16 Apr 2024 08:26:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUeG5rjbDFKGiqM1gyMYC4FtArhJ12sKJq9yK2xdS1dv2qGiXBBH2VEFjCI3lHceQOx4n6V6+OS5aiXkJ1O7IUThSqTQhOfdkqPBdwwYQ== X-Google-Smtp-Source: AGHT+IESCM+SY6GWe0YLwa6IhEyR85bpBWyXG43o6iXdPhDP9QJaOruU0226I//aOyZg4nlgJU/a X-Received: by 2002:a05:6870:14d3:b0:22e:e0ef:3d29 with SMTP id l19-20020a05687014d300b0022ee0ef3d29mr15247989oab.13.1713281215793; Tue, 16 Apr 2024 08:26:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713281215; cv=pass; d=google.com; s=arc-20160816; b=G9CQGpRoSsIWQsj9x4XsuEJKOy/XU/ovp8+X3eHndA8DGIRd3robip38RkuS2/yi6n LkNtkfJfgoDga+pMhgDwQo/ZyJbDeRrTkmduB4wYSJ2yxtt2fxXjVxDqlrBlkHNapXya ZotLJfCKCwnbw7ND+KOEgDTmPEs2zuPJ1Kn2XiOppVRF3SNb7ak0eqG4gQejzJBbzgc9 5NHi5TTQG9RPvYYVYljdt3jN8mMzpdf+/E40ls4CrltXFfOfZPJYviBNwlY/SOekBGm+ XLdIhncabyqbMlQ2XCP6+CrK7CsuBBJQWfOClUCq3hoIeI6Ce7sOpUiPAjPXgfvHEghR wHww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:cc:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=AH62+gNelSnZzdOHEa7SUZyDZKY0aJP0NLE1ckRJgeY=; fh=i/59RJdhTyRXqulriHzrus2NLDM4bspXmCMn2/VTaz4=; b=RHnkFfehP6QEMuYc7V1Dcft/3m0J+2+mnwfkqSjNNj1COr24ttMaRk88Sp11Usvc13 LOfWiNSd7eglzuQtqDMtDAyyVqeKgqp9S0FNAI6ZJk5drkVrHJrsb+eWsXbBQTD7qixx 2BvD+qA+gE/u+p5FDU/t/BFcksi9RayWKfTs/CdTHYJeil24FcL86K2qTxXAx6GmvuyB 4sMe0IiKvMkTm1KZJ5wsEVYB29UY4vDEGt/1AkK7e6GnAeF8M466v87BKwdSVkLBfvQD /uA+mdOG7cS42DyTRv3Sv7NTJPxV1RkKPiAQHXOZKO+TlRNxafVY+2gxgBwBY88iRRFx vvHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HefGEfta; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-147123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i7-20020a636d07000000b005e83b6752bdsi9927204pgc.269.2024.04.16.08.26.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 08:26:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=HefGEfta; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-147123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D85BF285C17 for ; Tue, 16 Apr 2024 15:26:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D7A4130AFA; Tue, 16 Apr 2024 15:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="HefGEfta" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD4F2130A4B; Tue, 16 Apr 2024 15:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713281210; cv=none; b=AyUuxKXt8oOHy6o7L/WgQwpBVOytJK9Fad0ihOGu5Fx2Xrvb9Rab0sBJp94ahbooeARP/+mUCbKTQ6xx9A6e98yIHMqLZQASeQtYgu6M1bWc6riKPfFG6XcYVmAJGwuTRZv+Kx2jcD4T+tjS3npeYyoJYPZfGfAaVF+xYXS2fxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713281210; c=relaxed/simple; bh=FNHcD4Sgv7zzl0ohaid6qhEVjUCQjGVryAxf4STZYOk=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=mpebKCLeWvlXEpIqEaereA/6aE64rq2JzG9DCPeZJa3nkp857+6HSFjZQYEWwAbHm0ze89Szt/9HsbiJA3Bxu47hwcn1GNJ8POxsG5O08/+EQLqftZyPtbcuZsoXhP+nk9AlUlLHpM7Fal0S1uIz9igaVmhnNUOzlkBDM8y91fc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=HefGEfta; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1713281206; bh=FNHcD4Sgv7zzl0ohaid6qhEVjUCQjGVryAxf4STZYOk=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=HefGEftahFgejDtXc8DcfD2s20vgfqbcpqof6CwHu727DcM/DC9SfycAdes0bq8td dOGpLR7g0/h3N2J+Q+7XRmB4z6/tpbhnVqf1h/0NlzgmsfwIsbvw8SRXByijNOgaUB Pg74NYKiXzXd18H1Gaa9/o+AvsXeUsXTkhlSFMmdEtv/7pbaP44U6ISfSaE9OXXcXk ejyArPgJMY6GmxWOyGNCuOkGjGtKnvJ4ojvK0JCCPbvs/ti+5Z35fP6oRJy5HHR4+/ C8kjTlD/6j/lzeq0/YA/ZfpmejzswWwQFAJFkLRut9l6tqVylDet5M0pD0KAzwqvPz eTRSNJcvwEs+w== Received: from [10.193.1.1] (broslavsky.collaboradmins.com [68.183.210.73]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 000D937804B2; Tue, 16 Apr 2024 15:26:40 +0000 (UTC) Message-ID: <76103169-4c8c-4c70-9d42-058557115b52@collabora.com> Date: Tue, 16 Apr 2024 20:27:12 +0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] selftests: exec: make binaries position independent To: Eric Biederman , Kees Cook , Shuah Khan , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Yang Yingliang , Andrew Morton References: <20240416152341.3186853-1-usama.anjum@collabora.com> Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: <20240416152341.3186853-1-usama.anjum@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/16/24 8:23 PM, Muhammad Usama Anjum wrote: > 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 > --- > tools/testing/selftests/exec/Makefile | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile > index fb4472ddffd81..01940d9165d67 100644 > --- a/tools/testing/selftests/exec/Makefile > +++ b/tools/testing/selftests/exec/Makefile > @@ -1,5 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > -CFLAGS = -Wall > +CFLAGS = -Wall #-Wunused-command-line-argument Debugging artifact here. I'll resend by removing it as v2 > CFLAGS += -Wno-nonnull > CFLAGS += -D_GNU_SOURCE > > @@ -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 $@ -- BR, Muhammad Usama Anjum