public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm•com>
To: Will Deacon <will@kernel•org>
Cc: Catalin Marinas <catalin.marinas@arm•com>,
	Mark Brown <broonie@kernel•org>,
	Vincenzo Frascino <Vincenzo.Frascino@arm•com>,
	Kees Cook <keescook@chromium•org>,
	linux-arm-kernel@lists•infradead.org
Subject: Re: [PATCH v2 02/10] arm64: asm: Override SYM_FUNC_START when building the kernel with BTI
Date: Wed, 6 May 2020 16:33:02 +0100	[thread overview]
Message-ID: <20200506153302.GB21779@arm.com> (raw)
In-Reply-To: <20200506144543.GB12919@willie-the-truck>

On Wed, May 06, 2020 at 03:45:44PM +0100, Will Deacon wrote:
> On Wed, May 06, 2020 at 02:40:21PM +0100, Dave Martin wrote:
> > On Wed, May 06, 2020 at 11:50:06AM +0100, Will Deacon wrote:
> > > On Wed, May 06, 2020 at 11:41:52AM +0100, Mark Brown wrote:
> > > > On Wed, May 06, 2020 at 08:10:26AM +0100, Will Deacon wrote:
> > > > > On Tue, May 05, 2020 at 06:21:00PM +0100, Mark Brown wrote:
> > > > 
> > > > > > > > > aarch64-none-linux-gnu-ld: arch/arm64/kernel/vdso/vgettimeofday.o: warning: BTI turned on by -z force-bti when all inputs do not have BTI in NOTE section.
> > > > 
> > > > > > so if this is a clang issue it looks like they fixed it in the clang-10
> > > > > > branch.  I'm not sure it's worth trying to detect and handle this or
> > > > > > not, I don't know how widely deployed toolchains that don't emit the
> > > > > > property are and there's a fairly clear solution.  What do you think?
> > > > 
> > > > > The linker fixes this up when it warns, right? If so, I think the current
> > > > 
> > > > The linker is fixing this up, yes.
> > > > 
> > > > > behaviour is fine *but* we might want to improve the diagnostic a bit not
> > > > > to worry/confuse people. e.g. something like:
> > > > 
> > > > >   "Your compiler is not emitting '.note.gnu.property' sections: forcing
> > > > >    support for BTI in the linker, but consider upgrading your toolchain."
> > > > 
> > > > Well, the theory behind the warning is that if the compiler is emitting
> > > > code suitable for the features described in the note then it should
> > > > always emit the appropriate annotations so the warning is more intended
> > > > to be telling the user that the code is trying to link in code that's
> > > > not built properly and will most likely fail at runtime.  In the current
> > > > situation that's an issue with the toolchain not emitting the
> > > > annotations but the common case expectation is that the issue will be
> > > > that there are object files that weren't built appropriately.
> > > 
> > > Hmm, I suppose, although it's a bit belt-and-braces given that we've got
> > > the right options in KBUILD_CFLAGS. What about:
> > > 
> > > 	"Your compiler is not emitting '.note.gnu.property' sections: forcing
> > > 	 support for BTI in the linker, but check your CFLAGS and consider
> > > 	 upgrading your toolchain."
> > > 
> > > I'd usually not be too bothered, but having run into this yesterday and
> > > not understood the problem, I'd like to save somebody else from puzzling
> > > over this if we can!
> > 
> > I really don't think we should fudge this: if the linker doesn't think
> > the inputs are BTI-enabled then the compiler or linker is broken, or
> > there's a bug in the kernel source tree.
> > 
> > The checking done by the toolchain is important -- if we want to
> > suppress it, we should have an override option than depends on BROKEN
> > (because yes, you're explicitly risking a broken kernel if you do this).
> > 
> > The fact that all gcc and clang both screwed this up in various ways at
> > some point is not our fault, or our problem, providing that fixes are
> > available...
> > 
> > Am I being too paranoid?
> 
> I don't think so, but I'm just looking for an answer to "What do we do if
> people start running into this warning?". As it stands, it sounds like it's
> unlikely that they will, but if they do then we're going to have to hack
> something to make it go away.

If we can do it in a way that makes it obvious that we consider it
unsafe, I guess having an override would be OK.  I feel the user should
be required to do something explicit like enable a dangerous-looking
Kconfig option, rather than us helpfully working around it
automatically.

Unless someone can explain why this is not dangerous :)

Cheers
---Dave

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

  parent reply	other threads:[~2020-05-06 15:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 21:16 [PATCH v2 00/10] arm64: BTI kernel and vDSO support Mark Brown
2020-04-29 21:16 ` [PATCH v2 01/10] arm64: bti: Support building kernel C code using BTI Mark Brown
2020-05-05 16:50   ` Dave Martin
2020-05-05 17:31     ` Mark Brown
2020-05-06 12:24       ` Amit Kachhap
2020-04-29 21:16 ` [PATCH v2 02/10] arm64: asm: Override SYM_FUNC_START when building the kernel with BTI Mark Brown
2020-05-05 14:56   ` Will Deacon
2020-05-05 15:18     ` Mark Brown
2020-05-05 16:08       ` Will Deacon
2020-05-05 17:21         ` Mark Brown
2020-05-06  7:10           ` Will Deacon
2020-05-06 10:41             ` Mark Brown
2020-05-06 10:50               ` Will Deacon
2020-05-06 11:43                 ` Mark Brown
2020-05-06 12:27                   ` Will Deacon
2020-05-06 13:03                     ` Mark Brown
2020-05-06 13:40                 ` Dave Martin
2020-05-06 14:45                   ` Will Deacon
2020-05-06 15:25                     ` Mark Brown
2020-05-06 15:48                       ` Will Deacon
2020-05-06 15:33                     ` Dave Martin [this message]
2020-04-29 21:16 ` [PATCH v2 03/10] arm64: Set GP bit in kernel page tables to enable BTI for the kernel Mark Brown
2020-04-29 21:16 ` [PATCH v2 04/10] arm64: bpf: Annotate JITed code for BTI Mark Brown
2020-04-29 21:16 ` [PATCH v2 05/10] arm64: mm: Mark executable text as guarded pages Mark Brown
2020-04-29 21:16 ` [PATCH v2 06/10] arm64: bti: Provide Kconfig for kernel mode BTI Mark Brown
2020-04-29 21:16 ` [PATCH v2 07/10] arm64: asm: Provide a mechanism for generating ELF note for BTI Mark Brown
2020-05-05 14:58   ` Will Deacon
2020-05-05 16:51     ` Dave Martin
2020-05-05 17:06     ` Mark Brown
2020-05-06 11:26       ` Will Deacon
2020-05-06 12:38         ` Mark Brown
2020-05-06 13:44           ` Will Deacon
2020-05-06 15:39             ` Mark Brown
2020-04-29 21:16 ` [PATCH v2 08/10] arm64: vdso: Annotate " Mark Brown
2020-04-29 21:16 ` [PATCH v2 09/10] arm64: vdso: Force the vDSO to be linked as BTI when built " Mark Brown
2020-04-29 21:16 ` [PATCH v2 10/10] arm64: vdso: Map the vDSO text with guarded pages " Mark Brown
2020-04-30 17:18 ` [PATCH v2 00/10] arm64: BTI kernel and vDSO support Catalin Marinas
2020-04-30 17:23   ` Mark Brown

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=20200506153302.GB21779@arm.com \
    --to=dave.martin@arm$(echo .)com \
    --cc=Vincenzo.Frascino@arm$(echo .)com \
    --cc=broonie@kernel$(echo .)org \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=keescook@chromium$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=will@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox