Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Maria Yu <quic_aiquny@quicinc.com>,
	linux@armlinux.org.uk, mhiramat@kernel.org, kernel@quicinc.com,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	quic_lijuang@quicinc.com, stable@vger.kernel.org
Subject: Re: [PATCH v3 1/1] ARM: kprobes: Explicitly reserve r7 for local variables
Date: Tue, 21 Nov 2023 09:38:30 -0700	[thread overview]
Message-ID: <20231121163830.GA3437094@dev-arch.thelio-3990X> (raw)
In-Reply-To: <CAMj1kXHLT6PhT0v6=9DWS1bXDV+QSZDwnYDo=+KvpzrCBqPNrw@mail.gmail.com>

On Tue, Nov 21, 2023 at 11:11:56AM -0500, Ard Biesheuvel wrote:
> On Sun, 19 Nov 2023 at 22:29, Maria Yu <quic_aiquny@quicinc.com> wrote:
> >
> > Registers r7 is removed in clobber list, so compiler may choose r7 for
> > local variables usage, while r7 will be actually updated by the inline asm
> > code. This caused the runtime behavior wrong.
> > While those kind of reserved registers cannot be set to clobber list
> > because of error like "inline asm clobber list contains reserved
> > registers".
> > Explicitly reserve r7 by adding attribute no-omit-frame-pointer for this
> > file, then in T32 asm code r7 is used as a frame pointer and is not
> > available for use as a general-purpose register.
> > Note that "no-omit-frame-pointer" will make the code size a little bigger
> > to store the stack frame pointer.
> >
> > Fixes: dd12e97f3c72 ("ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds")
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Maria Yu <quic_aiquny@quicinc.com>
> > Cc: stable@vger.kernel.org
> > ---
> >  arch/arm/probes/kprobes/Makefile | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/probes/kprobes/Makefile b/arch/arm/probes/kprobes/Makefile
> > index 6159010dac4a..b1f21e78950b 100644
> > --- a/arch/arm/probes/kprobes/Makefile
> > +++ b/arch/arm/probes/kprobes/Makefile
> > @@ -8,6 +8,7 @@ test-kprobes-objs               := test-core.o
> >
> >  ifdef CONFIG_THUMB2_KERNEL
> >  obj-$(CONFIG_KPROBES)          += actions-thumb.o checkers-thumb.o
> > +CFLAGS_actions-thumb.o         += -fno-omit-frame-pointer
> >  test-kprobes-objs              += test-thumb.o
> >  else
> >  obj-$(CONFIG_KPROBES)          += actions-arm.o checkers-arm.o
> >
> 
> If Nathan is happy with this, I think we can drop this into the patch tracker.

I have no qualms with this approach, there are no issues with the couple
of LLVM versions that I tested.

Cheers,
Nathan

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

      reply	other threads:[~2023-11-21 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  3:29 [PATCH v3 1/1] ARM: kprobes: Explicitly reserve r7 for local variables Maria Yu
2023-11-21 16:11 ` Ard Biesheuvel
2023-11-21 16:38   ` Nathan Chancellor [this message]

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=20231121163830.GA3437094@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=ardb@kernel.org \
    --cc=kernel@quicinc.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mhiramat@kernel.org \
    --cc=quic_aiquny@quicinc.com \
    --cc=quic_lijuang@quicinc.com \
    --cc=stable@vger.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