The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Mario Limonciello <mario.limonciello@amd.com>,
	Yazen Ghannam <yazen.ghannam@amd.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	"open list:AMD NODE DRIVER" <linux-kernel@vger.kernel.org>,
	regressions@lists.linux.dev
Subject: Re: kernel NULL pointer dereference in quirk_clear_strap_no_soft_reset_dev2_f0 -> amd_smn_read
Date: Sat, 6 Jun 2026 01:37:03 +0200	[thread overview]
Message-ID: <aiNdoGL2JCC1VIiW@mail-itl> (raw)
In-Reply-To: <20260605230949.GBaiNXPZ2ztjVL7DBg@fat_crate.local>

[-- Attachment #1: Type: text/plain, Size: 1366 bytes --]

On Fri, Jun 05, 2026 at 04:09:49PM -0700, Borislav Petkov wrote:
> On Sat, Jun 06, 2026 at 12:40:20AM +0200, Marek Marczykowski-Górecki wrote:
> > There is nothing here that would prevent amd_smn_read() being called
> > inside a guest...
> 
> Yah, there should've been...
> 
> Anyway, something like the untested below, pls give it a run.
> 
> Thx.
> 
> ---
> diff --git a/arch/x86/kernel/amd_node.c b/arch/x86/kernel/amd_node.c
> index 0be01725a2a4..52eff7fac667 100644
> --- a/arch/x86/kernel/amd_node.c
> +++ b/arch/x86/kernel/amd_node.c
...
> @@ -311,6 +324,10 @@ static int __init amd_smn_init(void)
>  	smn_exclusive = true;
>  
>  	return 0;
> +
> +err_out:
> +	amd_node_off = true;
> +	return err;
>  }
>  
>  fs_initcall(amd_smn_init);

Is it actually guaranteed to run before PCI fixups? They are done via
fs_initcall_sync. IMO it would be safer to guard __amd_smn_rw() with
something that would also detect calls before amd_smn_init() is called.
Like using smn_exclusive in the Penny's patch, or amd_roots in the
Mario's patch.

That said, amd_smn_read() called before amd_smn_init() would (should?)
fail anyway, even in non-virtualized case. So, maybe this approach
(still crash on NULL ptr when called before amd_smn_init()) is
acceptable?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2026-06-05 23:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13  1:01 kernel NULL pointer dereference in quirk_clear_strap_no_soft_reset_dev2_f0 -> amd_smn_read Marek Marczykowski-Górecki
2026-01-13  2:47 ` Mario Limonciello
2026-01-13 16:04   ` Borislav Petkov
2026-06-05 17:34   ` Marek Marczykowski-Górecki
2026-06-05 17:36     ` Mario Limonciello
2026-06-05 17:45       ` Marek Marczykowski-Górecki
2026-06-05 18:54         ` Mario Limonciello
2026-06-05 20:23           ` Marek Marczykowski-Górecki
2026-06-05 21:15             ` Borislav Petkov
2026-06-05 21:55               ` Marek Marczykowski-Górecki
2026-06-05 22:26                 ` Borislav Petkov
2026-06-05 22:40                   ` Marek Marczykowski-Górecki
2026-06-05 23:09                     ` Borislav Petkov
2026-06-05 23:37                       ` Marek Marczykowski-Górecki [this message]
2026-06-06  1:59                         ` Borislav Petkov
2026-01-30 17:01 ` Yazen Ghannam
2026-02-07  1:57   ` Marek Marczykowski-Górecki

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=aiNdoGL2JCC1VIiW@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=regressions@lists.linux.dev \
    --cc=x86@kernel.org \
    --cc=yazen.ghannam@amd.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