lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <yie5ice3gl47ayfbty2oxppu6sp76ho6k5qt4g7jqy3qw5rrx6@s4cc4kyp3dun>
Date: Wed, 16 Apr 2025 10:26:53 +0300
From: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Chenyuan Yang <chenyuan0y@...il.com>, lenb@...nel.org, 
	tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com, 
	x86@...nel.org, hpa@...or.com, bhe@...hat.com, kai.huang@...el.com, 
	sathyanarayanan.kuppuswamy@...ux.intel.com, linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/acpi: fix potential NULL deref in acpi_wakeup_cpu()

On Tue, Apr 15, 2025 at 03:39:24PM +0200, Rafael J. Wysocki wrote:
> On Fri, Apr 11, 2025 at 9:48 PM Chenyuan Yang <chenyuan0y@...il.com> wrote:
> >
> > The result of memremap() may be NULL on failure, leading to a NULL
> > dereference. Add explicit checks after memremap() call: if the
> > MADT mailbox fails to map, return immediately.
> >
> > This is similar to the commit 966d47e1f27c
> > ("efi: fix potential NULL deref in efi_mem_reserve_persistent").
> >
> > This is found by our static analysis tool KNighter.
> >
> > Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
> > Fixes: 2b5e22afae07 ("x86/acpi: Extract ACPI MADT wakeup code into a separate file")
> 
> Well, it's good to add the author of the commit you're trying to fix
> to the CC list.
> 
> Kirill, what do you think about this?

Looks reasonable to me.

We fail to remap a single page. It is likely to be fatally broken system
if we get there. But okay, let's handle it.

Maybe use pr_err_once(). No need to spam an error for every CPU.

> > ---
> >  arch/x86/kernel/acpi/madt_wakeup.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c
> > index f36f28405dcc..b386ec4b87c2 100644
> > --- a/arch/x86/kernel/acpi/madt_wakeup.c
> > +++ b/arch/x86/kernel/acpi/madt_wakeup.c
> > @@ -143,6 +143,10 @@ static int acpi_wakeup_cpu(u32 apicid, unsigned long start_ip)
> >                 acpi_mp_wake_mailbox = memremap(acpi_mp_wake_mailbox_paddr,
> >                                                 sizeof(*acpi_mp_wake_mailbox),
> >                                                 MEMREMAP_WB);
> > +               if (!acpi_mp_wake_mailbox) {
> > +                       pr_err("Failed to remap MADT mailbox\n");
> > +                       return -ENOMEM;
> > +               }
> >         }
> >
> >         /*
> > --
> > 2.34.1
> >

-- 
  Kiryl Shutsemau / Kirill A. Shutemov

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ