From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Julien Thierry <jthierry@redhat.com>,
Catalin Marinas <catalin.marinas@arm.com>,
"Madhavan T. Venkataraman" <madvenka@linux.microsoft.com>,
Miroslav Benes <mbenes@suse.cz>, Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 0/3] arm64: Implement reliable stack trace
Date: Thu, 28 Jan 2021 09:26:49 -0600 [thread overview]
Message-ID: <20210128152649.6zin3hzim3etbv2p@treble> (raw)
In-Reply-To: <20210128142250.GC4537@sirena.org.uk>
Hi all,
I know this is an old patch set, but I'm not able to see the context,
because I'm not subcribed to the ML. For future patch sets can you also
add live-patching and lkml?
Are we still considering the shadow stack thing? Just wondering why
we're talking about objtool again.
On Thu, Jan 28, 2021 at 02:22:50PM +0000, Mark Brown wrote:
> On Wed, Jan 27, 2021 at 01:54:21PM -0600, Madhavan T. Venkataraman wrote:
> > Instead of failing the kernel build, can we just mark the functions as:
>
> > FP Functions that have proper FP code
> > no-FP Functions that don't
>
> > May be, we can add an "FP" flag in the symbol table entry for this.
>
> > Then, the unwinder can check the functions it encounters in the stack trace and
> > inform the caller if it found any no-FP functions. The caller of the unwinder can
> > decide what he wants to do with that information.
> >
> > - the caller can ignore it
> >
> > - the caller can print the stack trace with a warning that no-FP functions
> > were found
> >
> > - if the caller is livepatch, the caller can retry until the no-FP functions
> > disappear from the stack trace. This way, we can have live patching even
> > when some of the functions in the kernel are no-FP.
> >
> > Does this make any sense? Is this acceptable? What are the pitfalls?
Why not just fix the reported no-FP functions?
> > If we can do this, the unwinder could detect cases such as:
>
> > - If gcc thinks that a function is a leaf function but the function contains
> > inline assembly code that calls another function.
>
> > - If a call to a function bounces through some intermediate code such as a
> > trampoline.
>
> > - etc.
>
> > For specific no-FP functions, the unwinder might be able to deduce the original
> > caller. In these cases, the stack trace would still be reliable. For all the others,
> > the stack trace would be considered unreliable.
>
> I'm not entirely sure I see the distinction from the current situation
> here?
>
> > Compiler instead of objtool
> > ===========================
> >
> > If the above suggestion is acceptable, I have another suggestion.
> >
> > It is a lot of work for every new architecture to add frame pointer verification
> > support in objtool. Can we get some help from the compiler?
> >
> > The compiler knows which C functions it generates the FP prolog and epilog for. It can
> > mark those functions as FP. As for assembly functions, kernel developers could manually
> > annotate functions that have proper FP code. The compiler/assembler would mark them
> > as FP. Only a small subset of assembly functions would even have FP prolog and epilog.
>
> > Is this acceptable? What are the pitfalls?
>
> If we're trusting the compiler we can probably just do that without any
> explicit support from the compiler - it should be doing the standard
> stuff unless we explicitly ask it to and if it isn't then it might be a
> result of a mismatch in assumptions rather than a deliberate decision to
> do something non-standard. My understanding with objtool is that a big
> part of the idea is to provide a static check that the binary we end up
> with matches the assumptions that we are making so the fact that it's a
> separate implementation is important.
For C code, even if we trusted the compiler (which we don't), we still
have inline asm which the compiler doesn't have any visibility to, which
is more than capable of messing up frame pointers (we had several cases
of this in x86).
Getting the assembler to annotate which functions are FP could be
interesting but:
a) good luck getting the assembler folks to do that; they tend to be
insistent on being ignorant of code semantics;
b) assembly often resembles spaghetti and the concept of a function is
quite fluid; in fact many functions aren't annotated as such.
--
Josh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-01-28 15:28 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 17:26 [RFC PATCH 0/3] arm64: Implement reliable stack trace Mark Brown
2020-10-12 17:26 ` [RFC PATCH 1/3] arm64: remove EL0 exception frame record Mark Brown
2020-10-12 17:26 ` [RFC PATCH 2/3] arm64: stacktrace: Report when we reach the end of the stack Mark Brown
2020-10-13 11:07 ` Mark Rutland
2020-10-12 17:26 ` [RFC PATCH 3/3] arm64: stacktrace: Implement reliable stacktrace Mark Brown
2020-10-13 10:42 ` Mark Brown
2020-10-13 11:42 ` Mark Rutland
2020-10-13 16:12 ` Mark Brown
2020-10-15 13:33 ` Miroslav Benes
2020-10-15 15:57 ` Mark Brown
2020-10-16 10:13 ` Miroslav Benes
2020-10-16 12:30 ` Mark Brown
2020-10-15 13:39 ` [RFC PATCH 0/3] arm64: Implement reliable stack trace Miroslav Benes
2020-10-15 14:16 ` Mark Rutland
2020-10-15 15:49 ` Mark Brown
2020-10-15 21:29 ` Josh Poimboeuf
2020-10-16 11:14 ` Mark Rutland
2020-10-20 10:03 ` Mark Rutland
2020-10-20 15:58 ` Josh Poimboeuf
2020-10-16 12:15 ` Mark Brown
2020-10-19 23:41 ` Josh Poimboeuf
2020-10-20 15:39 ` Mark Brown
2020-10-20 16:28 ` Josh Poimboeuf
2021-01-27 14:02 ` Madhavan T. Venkataraman
2021-01-27 16:40 ` Mark Rutland
2021-01-27 17:11 ` Mark Brown
2021-01-27 17:24 ` Madhavan T. Venkataraman
2021-01-27 19:54 ` Madhavan T. Venkataraman
2021-01-28 14:22 ` Mark Brown
2021-01-28 15:26 ` Josh Poimboeuf [this message]
2021-01-29 21:39 ` Madhavan T. Venkataraman
2021-02-01 3:20 ` Madhavan T. Venkataraman
2021-02-01 14:39 ` Mark Brown
2021-01-30 4:38 ` Madhavan T. Venkataraman
2021-02-01 15:21 ` Madhavan T. Venkataraman
2021-02-01 15:46 ` Madhavan T. Venkataraman
2021-02-01 16:02 ` Mark Rutland
2021-02-01 16:22 ` Mark Brown
2021-02-01 21:40 ` Madhavan T. Venkataraman
2021-02-01 21:38 ` Madhavan T. Venkataraman
2021-02-01 23:00 ` Josh Poimboeuf
2021-02-02 2:29 ` Madhavan T. Venkataraman
2021-02-02 3:36 ` Josh Poimboeuf
2021-02-02 10:05 ` Mark Rutland
2021-02-02 13:33 ` Madhavan T. Venkataraman
2021-02-02 13:35 ` Madhavan T. Venkataraman
2021-02-02 23:32 ` Madhavan T. Venkataraman
2021-02-03 16:53 ` Mark Rutland
2021-02-03 19:03 ` Madhavan T. Venkataraman
2021-02-05 2:36 ` Madhavan T. Venkataraman
2021-02-01 21:59 ` Madhavan T. Venkataraman
2021-02-02 13:36 ` 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=20210128152649.6zin3hzim3etbv2p@treble \
--to=jpoimboe@redhat.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jthierry@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=madvenka@linux.microsoft.com \
--cc=mark.rutland@arm.com \
--cc=mbenes@suse.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox