Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: "Madhavan T. Venkataraman" <madvenka@linux.microsoft.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Julien Thierry <jthierry@redhat.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Brown <broonie@kernel.org>, 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: Mon, 1 Feb 2021 21:36:39 -0600	[thread overview]
Message-ID: <20210202033639.mjusaoqrbshzgjjl@treble> (raw)
In-Reply-To: <44a32a13-f744-b591-a68d-19cf665e5495@linux.microsoft.com>

On Mon, Feb 01, 2021 at 08:29:52PM -0600, Madhavan T. Venkataraman wrote:
> The no-ops were just a wild idea of mine. I knew I would rue it as soon as I hit
> the send button :-)

That's ok, I like wild ideas :-)

> > The original version of objtool was an awk script which basically just
> > crudely looked for the prologue/epilogue instructions.  It mostly
> > worked.
> > 
> > But it wasn't 100%, and these days the prologue isn't always at the
> > beginning, and the epilogue is usually buried in the middle.  And
> > sometimes there are more stack pushes/pops hidden outside of the formal
> > prologue/epilogue.  Not to mention asm code which does all kinds of
> > crazy things.  And other edge cases, like leaf functions which don't
> > require frame pointers, and alternatives patching/paravirt/etc which can
> > muck with the stack layout at runtime.  Eventually we realized a "full
> > coverage" objtool is the wisest approach.
> > 
> 
> Yes. I studied the objtool code. It does a fantastic job for X86. I suspect
> it took a lot of time and a lot of work to get it right. It is
> just that adding complete static analysis for an arch is daunting and
> time consuming. How would we ever prove to the community that we are
> truly done?

Objtool makes sure to visit all instructions in the file.  Otherwise it
prints an "unreachable instruction" warning.  That's how we make sure to
get full coverage.

And most compiled code is pretty straightforward, so the static analysis
is mostly "just" a matter of monitoring stack operations and following
the branches.  Of course, the devil's in the details.

It gets battle-tested pretty well with randconfigs across a lot of
different compiler versions.  When it encounters some situation it
doesn't understand, it complains, and we hear about it.

Julien and Raphael already laid a lot of the groundwork for porting it
to new arches, so as you can see with Julien's latest series there's not
much to do beyond adding the instruction decoder, and then looking at
all the warnings.

Sometimes warnings are legit, and other times they mean something's
amiss with objtool.  But once the warnings are all gone, in my
experience it means objtool's working well.

-- 
Josh


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

  reply	other threads:[~2021-02-02  3:38 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
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 [this message]
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=20210202033639.mjusaoqrbshzgjjl@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