All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Mark Brown <broonie@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kselftest/arm64: bti: force static linking
Date: Mon, 16 May 2022 10:35:19 +0100	[thread overview]
Message-ID: <YoIa12y700JR+RGq@arm.com> (raw)
In-Reply-To: <20220516102935.67505a91@donnerap.cambridge.arm.com>

On Mon, May 16, 2022 at 10:29:35AM +0100, Andre Przywara wrote:
> On Sun, 15 May 2022 11:05:23 +0100
> Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Wed, May 11, 2022 at 06:21:29PM +0100, Andre Przywara wrote:
> > > The "bti" selftests are built with -nostdlib, which apparently
> > > automatically creates a statically linked binary, which is what we want
> > > and need for BTI (to avoid interactions with the dynamic linker).
> > > 
> > > However this is not true when building a PIE binary, which some
> > > toolchains (Ubuntu) configure as the default.
> > > When compiling btitest with such a toolchain, it will create a
> > > dynamically linked binary, which will probably fail some tests, as the
> > > dynamic linker might not support BTI:
> > > ===================
> > > TAP version 13
> > > 1..18
> > > not ok 1 nohint_func/call_using_br_x0
> > > not ok 2 nohint_func/call_using_br_x16
> > > not ok 3 nohint_func/call_using_blr
> > > ....
> > > ===================
> > > 
> > > To make sure we create static binaries, add an explicit -static on the
> > > linker command line. This forces static linking even if the toolchain
> > > defaults to PIE builds, and fixes btitest runs on BTI enabled machines.
> > > 
> > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>  
> > 
> > Does this need to go in as a fix (cc stable, fixes tag)?
> 
> I dimly remember some discussion about stable fixes not being a real thing
> for the selftests? In any case:
> 
> Fixes: 314bcbf09f14 ("kselftest: arm64: Add BTI tests")

I'll add the fixes tag. I can see the occasional cc stable for kselftest
patches.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: Will Deacon <will@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Mark Brown <broonie@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kselftest/arm64: bti: force static linking
Date: Mon, 16 May 2022 10:35:19 +0100	[thread overview]
Message-ID: <YoIa12y700JR+RGq@arm.com> (raw)
In-Reply-To: <20220516102935.67505a91@donnerap.cambridge.arm.com>

On Mon, May 16, 2022 at 10:29:35AM +0100, Andre Przywara wrote:
> On Sun, 15 May 2022 11:05:23 +0100
> Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Wed, May 11, 2022 at 06:21:29PM +0100, Andre Przywara wrote:
> > > The "bti" selftests are built with -nostdlib, which apparently
> > > automatically creates a statically linked binary, which is what we want
> > > and need for BTI (to avoid interactions with the dynamic linker).
> > > 
> > > However this is not true when building a PIE binary, which some
> > > toolchains (Ubuntu) configure as the default.
> > > When compiling btitest with such a toolchain, it will create a
> > > dynamically linked binary, which will probably fail some tests, as the
> > > dynamic linker might not support BTI:
> > > ===================
> > > TAP version 13
> > > 1..18
> > > not ok 1 nohint_func/call_using_br_x0
> > > not ok 2 nohint_func/call_using_br_x16
> > > not ok 3 nohint_func/call_using_blr
> > > ....
> > > ===================
> > > 
> > > To make sure we create static binaries, add an explicit -static on the
> > > linker command line. This forces static linking even if the toolchain
> > > defaults to PIE builds, and fixes btitest runs on BTI enabled machines.
> > > 
> > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>  
> > 
> > Does this need to go in as a fix (cc stable, fixes tag)?
> 
> I dimly remember some discussion about stable fixes not being a real thing
> for the selftests? In any case:
> 
> Fixes: 314bcbf09f14 ("kselftest: arm64: Add BTI tests")

I'll add the fixes tag. I can see the occasional cc stable for kselftest
patches.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-16  9:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-11 17:21 [PATCH] kselftest/arm64: bti: force static linking Andre Przywara
2022-05-11 17:21 ` Andre Przywara
2022-05-11 17:26 ` Mark Brown
2022-05-11 17:26   ` Mark Brown
2022-05-15 10:05 ` Catalin Marinas
2022-05-15 10:05   ` Catalin Marinas
2022-05-16  9:29   ` Andre Przywara
2022-05-16  9:29     ` Andre Przywara
2022-05-16  9:35     ` Catalin Marinas [this message]
2022-05-16  9:35       ` Catalin Marinas
2022-05-16 18:45 ` Catalin Marinas
2022-05-16 18:45   ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoIa12y700JR+RGq@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.