Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Zhaoyang Huang <huangzhaoyang@gmail.com>
Cc: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	James Morse <james.morse@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, steve.kang@unisoc.com,
	jeson.gao@unisoc.com, xuewen.yan@unisoc.com
Subject: Re: [RESEND PATCH] arch: arm64: set __nocfi on swsusp_arch_resume
Date: Thu, 22 Jan 2026 12:24:29 +0000	[thread overview]
Message-ID: <aXIW_U72IIEETsi0@willie-the-truck> (raw)
In-Reply-To: <CAGWkznFBLDr44tTCME1RVNTZ9SLDZA+By0eoTQ+-HrfnTBAoqw@mail.gmail.com>

On Thu, Jan 22, 2026 at 07:39:34PM +0800, Zhaoyang Huang wrote:
> On Thu, Jan 22, 2026 at 6:32 PM Will Deacon <will@kernel.org> wrote:
> > On Tue, Jan 20, 2026 at 02:06:19PM +0800, zhaoyang.huang wrote:
> > > diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
> > > index 18749e9a6c2d..9717568518ba 100644
> > > --- a/arch/arm64/kernel/hibernate.c
> > > +++ b/arch/arm64/kernel/hibernate.c
> > > @@ -402,7 +402,7 @@ int swsusp_arch_suspend(void)
> > >   * Memory allocated by get_safe_page() will be dealt with by the hibernate code,
> > >   * we don't need to free it here.
> > >   */
> > > -int swsusp_arch_resume(void)
> > > +int __nocfi swsusp_arch_resume(void)
> > >  {
> > >       int rc;
> > >       void *zero_page;
> >
> > Why does is the '__nocfi' annotation here rather than on the
> > 'hibernate_exit' pointer?
> Our first try is to have the callee function(swsusp_arch_suspend_exit)
> waived by set __nocfi but failed. It seems like the CFI watched the
> caller of function pointer and plant stub code.

Thinking about this some more, you're right that the '__nocfi'
annotation has to happen at the call-site, because that's where the
check takes place.

I did start looking at what it would take to emit the CFI type prefix
for swsusp_arch_suspend_exit() using SYM_TYPED_FUNC_START() but it's a
bit grotty having to offset into .hibernate_exit.text when jumping to
the copy and, given that trans_pgd_idmap_page doesn't seem to bother
with BTI at all, your patch looks like the simplest point fix.

I'll ack the resend...

Will


      reply	other threads:[~2026-01-22 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  6:06 [RESEND PATCH] arch: arm64: set __nocfi on swsusp_arch_resume zhaoyang.huang
2026-01-22 10:32 ` Will Deacon
2026-01-22 11:39   ` Zhaoyang Huang
2026-01-22 12:24     ` Will Deacon [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=aXIW_U72IIEETsi0@willie-the-truck \
    --to=will@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=huangzhaoyang@gmail.com \
    --cc=james.morse@arm.com \
    --cc=jeson.gao@unisoc.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.kang@unisoc.com \
    --cc=xuewen.yan@unisoc.com \
    --cc=zhaoyang.huang@unisoc.com \
    /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