From: duwe@lst.de (Torsten Duwe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 2/3] arm64: implement live patching
Date: Mon, 12 Nov 2018 12:01:27 +0100 [thread overview]
Message-ID: <20181112110127.GA30967@lst.de> (raw)
In-Reply-To: <CAKv+Gu_D2vzk-sBkufK7JvaPawC+QnpZwkC0+ikTb7A6qko8ng@mail.gmail.com>
On Thu, Nov 08, 2018 at 01:42:35PM +0100, Ard Biesheuvel wrote:
> On 26 October 2018 at 16:21, Torsten Duwe <duwe@lst.de> wrote:
> > /* The program counter just after the ftrace call site */
> > str lr, [x9, #S_PC]
> > +
> > /* The stack pointer as it was on ftrace_caller entry... */
> > add x28, fp, #16
> > str x28, [x9, #S_SP]
>
> Please drop this hunk
Sure. I missed that one during cleanup.
> > @@ -233,6 +234,10 @@ ftrace_common:
^^^^^^^^^^^^^^
> > ldr x28, [fp, 8]
> > str x28, [x9, #S_LR] /* to pt_regs.r[30] */
> >
> > +#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_FUNCTION_GRAPH_TRACER)
> > + mov x28, lr /* remember old return address */
> > +#endif
> > +
> > ldr_l x2, function_trace_op, x0
> > ldr x1, [fp, #8]
> > sub x0, lr, #8 /* function entry == IP */
> > @@ -245,6 +250,17 @@ ftrace_call:
> >
> > bl ftrace_stub
> >
> > +#if defined(CONFIG_LIVEPATCH) && defined(CONFIG_FUNCTION_GRAPH_TRACER)
> > + /* Is the trace function a live patcher an has messed with
> > + * the return address?
> > + */
> > + add x9, sp, #16 /* advance to pt_regs for restore */
> > + ldr x0, [x9, #S_PC]
> > + cmp x0, x28 /* compare with the value we remembered */
> > + /* to not call graph tracer's "call" mechanism twice! */
> > + b.ne ftrace_common_return
>
> Is ftrace_common_return guaranteed to be in range? Conditional
> branches have only -/+ 1 MB range IIRC.
It's the same function. A "1f" would do the same job, but the long label
is a talking identifier that saves a comment. I'd more be worried about
the return from the graph trace caller, which happens to be the _next_
function ;-)
If ftrace_caller or graph_caller grow larger than a meg, something else is
_very_ wrong.
> > +#endif
> > +
> > #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>
> Can we fold these #ifdef blocks together (i.e, incorporate the
> conditional livepatch sequence here)
I'll see how to make it fit. But remember some people might want ftrace
but no live patching capability.
Thanks for the review!
Torsten
next prev parent reply other threads:[~2018-11-12 11:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 14:20 [PATCH v4 0/3] arm64 live patching Torsten Duwe
2018-10-26 14:21 ` [PATCH v4 1/3] arm64: implement ftrace with regs Torsten Duwe
2018-10-31 12:10 ` Mark Rutland
2018-10-31 13:19 ` Jiri Kosina
2018-10-31 14:18 ` Mark Rutland
2018-10-31 17:58 ` Torsten Duwe
2018-11-08 12:12 ` Ard Biesheuvel
2018-11-12 11:51 ` Torsten Duwe
2018-10-26 14:21 ` [PATCH v4 2/3] arm64: implement live patching Torsten Duwe
2018-11-06 16:49 ` Miroslav Benes
2018-11-08 12:42 ` Ard Biesheuvel
2018-11-12 11:01 ` Torsten Duwe [this message]
2018-11-12 11:06 ` Ard Biesheuvel
2018-10-26 14:21 ` [PATCH v4 3/3] arm64: reliable stacktraces Torsten Duwe
2018-10-26 15:37 ` Josh Poimboeuf
2018-10-29 9:28 ` Mark Rutland
2018-10-29 15:42 ` Josh Poimboeuf
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=20181112110127.GA30967@lst.de \
--to=duwe@lst.de \
--cc=linux-arm-kernel@lists.infradead.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