public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Jarkko Sakkinen <jarkko@kernel.org>,
	James Bottomley <jejb@linux.ibm.com>,
	Hyeonggon Yoo <42.hyeyoo@gmail.com>,
	David Kaplan <David.Kaplan@amd.com>,
	Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>,
	x86@kernel.org
Subject: Re: Linux 6.6-rc3 (DEBUG_VIRTUAL is unhappy on x86)
Date: Tue, 3 Oct 2023 18:41:57 +0200	[thread overview]
Message-ID: <20231003164157.GH1539@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <5427bc3d-1e14-781a-53a2-f702774715f4@linaro.org>

On Tue, Oct 03, 2023 at 05:36:27PM +0530, Sumit Garg wrote:
> Hi Linus,
> 
> On 10/2/23 02:18, Linus Torvalds wrote:
> > On Sun, 1 Oct 2023 at 07:17, Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
> > > > > Peter Zijlstra (1):
> > > > >        x86,static_call: Fix static-call vs return-thunk
> > > > Hello, the commit above caused a crash on x86 kernel with
> > > > CONFIG_DEBUG_VIRTUAL=y.
> > > OK, I looked into this a little bit, and it turns out that the problematic
> > > address here is from cleanup_trusted() in
> > > security/keys/trusted-keys/trusted_core.c.
> > > (and it's builtin due to CONFIG_TRUSTED_KEYS=y)
> > > 
> > > The function is marked as __exit, so it does not fall within the
> > > 'core kernel text address range,' which is between _stext and _etext
> > > (or between _sinittext and _einittext). and thus __text_poke() thinks that
> > > it's vmalloc/module area.
> > > 
> > > I think __text_poke() should be taught that functions marked as __exit
> > > also belong to kernel code just like __init.
> > I think your patch is fine (well, whitespace-damaged, but conceptually good).
> > 
> > But I also wonder about that
> > 
> >          static_call_cond(trusted_key_exit)();
> > 
> > in cleanup_trusted(). It seems all kinds of pointless to use static
> > calls for something that is done *once*. That's not an optimization,
> > that's honestly just _stupid_. It costs more to do the rewriting that
> > it does to just do the one dynamic indirect call.
> 
> That's true, there isn't any real performance benefit here. It is something
> which I mentioned when I was asked to incorporate it here [1]. However, on
> the flip side I think there are security benefits here. We wouldn't like any
> indirect branch speculation attack to leak the trusted key material contents
> here.

1) retpolines;
2) if you can unload modules, you've got bigger problems.

  reply	other threads:[~2023-10-03 16:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24 21:36 Linux 6.6-rc3 Linus Torvalds
2023-09-25 11:32 ` Build regressions/improvements in v6.6-rc3 Geert Uytterhoeven
2023-09-25 11:43   ` Geert Uytterhoeven
2023-09-30 16:26 ` Linux 6.6-rc3 (DEBUG_VIRTUAL is unhappy on x86) Hyeonggon Yoo
2023-10-01 12:24   ` Linux regression tracking #adding (Thorsten Leemhuis)
2023-10-08 11:32     ` Linux regression tracking #update (Thorsten Leemhuis)
2023-10-01 14:17   ` Hyeonggon Yoo
2023-10-01 20:48     ` Linus Torvalds
2023-10-03 12:06       ` Sumit Garg
2023-10-03 16:41         ` Peter Zijlstra [this message]
2023-10-05  0:46         ` Linus Torvalds
2023-10-05  5:09           ` Sumit Garg
2023-10-02 10:40     ` Peter Zijlstra
2023-10-05  8:26       ` Hyeonggon Yoo

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=20231003164157.GH1539@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=David.Kaplan@amd.com \
    --cc=bp@alien8.de \
    --cc=jarkko@kernel.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sumit.garg@linaro.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=zohar@linux.ibm.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