From: Will Deacon <will@kernel.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
Sami Tolvanen <samitolvanen@google.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Catalin Marinas <catalin.marinas@arm.com>,
ben.dai@unisoc.com, Nathan Chancellor <nathan@kernel.org>,
Kees Cook <keescook@chromium.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Daniel Thompson <daniel.thompson@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
llvm@lists.linux.dev
Subject: Re: [PATCH v2] arm64: ftrace: use function_nocfi for _mcount as well
Date: Fri, 8 Oct 2021 09:05:46 +0100 [thread overview]
Message-ID: <20211008080546.GA495@willie-the-truck> (raw)
In-Reply-To: <CAFA6WYMvVuwAsU09iW7LonZGK92hX2rH3f8Xtktqs6t1wVtLUw@mail.gmail.com>
Hi Sumit,
On Wed, Oct 06, 2021 at 11:05:52AM +0530, Sumit Garg wrote:
> On Tue, 5 Oct 2021 at 21:05, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Oct 05, 2021 at 08:20:02AM -0700, Sami Tolvanen wrote:
> > > On Tue, Oct 5, 2021 at 5:37 AM Sumit Garg <sumit.garg@linaro.org> wrote:
> > > > diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> > > > index 91fa4baa1a93..347b0cc68f07 100644
> > > > --- a/arch/arm64/include/asm/ftrace.h
> > > > +++ b/arch/arm64/include/asm/ftrace.h
> > > > @@ -15,7 +15,7 @@
> > > > #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> > > > #define ARCH_SUPPORTS_FTRACE_OPS 1
> > > > #else
> > > > -#define MCOUNT_ADDR ((unsigned long)_mcount)
> > > > +#define MCOUNT_ADDR ((unsigned long)function_nocfi(_mcount))
> > > > #endif
> > > >
> > > > /* The BL at the callsite's adjusted rec->ip */
> > > > --
> > > > 2.17.1
> > > >
> > >
> > > Clang >= 10 supports -fpatchable-function-entry and CFI requires Clang
> > > 12, so I assume this is only an issue if
> > > CONFIG_DYNAMIC_FTRACE_WITH_REGS is explicitly disabled?
> >
> > I don't believe it's possible to disable explicitly, since
> > DYNAMIC_FTRACE_WITH_REGS isn't user selectable, and is def bool y,
> > depending on HAVE_DYNAMIC_FTRACE_WITH_REGS.
> >
>
> Ah, I see.
>
> > Sumit, have you actually seen a problem, or was this found by
> > inspection?
> >
>
> Actually I have seen this ftrace problem with the android11-5.4-lts
> kernel and AOSP master user-space on db845c. The reason being kernel
> v5.4 LTS doesn't support ftrace with -fpatchable-function-entry on
> arm64.
>
> With the mainline, I haven't tried to reproduce this issue but it was
> rather by inspection that this needs to be fixed as well.
>
> > If this isn't an issue in practice, we could add the funciton_nocfi()
> > for consistency, but we should make that clear in the commit message,
> > and drop the fixes tag.
>
> Sure, let me drop the fixes tag and update the commit description in
> v3 as mainline only enabled CFI_CLANG for arm64 when
> "-fpatchable-function-entry" is supported.
Did you post a v3? Just want to make sure I didn't miss it.
Will
_______________________________________________
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-10-08 8:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 12:36 [PATCH v2] arm64: ftrace: use function_nocfi for _mcount as well Sumit Garg
2021-10-05 15:20 ` Sami Tolvanen
2021-10-05 15:35 ` Mark Rutland
2021-10-06 5:35 ` Sumit Garg
2021-10-08 8:05 ` Will Deacon [this message]
2021-10-11 12:53 ` Sumit Garg
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=20211008080546.GA495@willie-the-truck \
--to=will@kernel.org \
--cc=ben.dai@unisoc.com \
--cc=catalin.marinas@arm.com \
--cc=daniel.thompson@linaro.org \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=sumit.garg@linaro.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