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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191031154916.GA24152@nazgul.tnic>
Date:   Thu, 31 Oct 2019 16:49:16 +0100
From:   Borislav Petkov <bp@...en8.de>
To:     zhong jiang <zhongjiang@...wei.com>
Cc:     peterz@...radead.org, tglx@...utronix.de, mingo@...hat.com,
        dave.hansen@...ux.intel.com, hpa@...or.com, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/ioremap: Use WARN_ONCE instead of printk() +
 WARN_ON_ONCE()

On Thu, Oct 31, 2019 at 07:54:09PM +0800, zhong jiang wrote:
> Look at this again, It should not works. Because that will change the logical.
> if phys_addr_valid is false, we should drop out in time.

That you can do too:

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index a39dcdb5ae34..13f44cc064af 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -171,12 +171,10 @@ __ioremap_caller(resource_size_t phys_addr, unsigned long size,
 	if (!size || last_addr < phys_addr)
 		return NULL;
 
-	if (!phys_addr_valid(phys_addr)) {
-		printk(KERN_WARNING "ioremap: invalid physical address %llx\n",
-		       (unsigned long long)phys_addr);
-		WARN_ON_ONCE(1);
+	if (WARN_ONCE(!phys_addr_valid(phys_addr),
+	    "ioremap: invalid physical address %llx\n",
+	    (unsigned long long)phys_addr))
 		return NULL;
-	}
 
 	__ioremap_check_mem(phys_addr, size, &io_desc);
 
---

I'm not sure whether we care about printing every invalid address, as
Joe points out. Maybe we do... *shrug*

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ