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: <CAEEQ3wmKGGW_FnmHrggBoQBCz2OA2EofLtts=hXLmxqdGNGMBA@mail.gmail.com>
Date: Mon, 24 Mar 2025 09:34:13 +0800
From: yunhui cui <cuiyunhui@...edance.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu, 
	alex@...ti.fr, anshuman.khandual@....com, akpm@...ux-foundation.org, 
	mingo@...nel.org, catalin.marinas@....com, ryan.roberts@....com, 
	kirill.shutemov@...ux.intel.com, namcao@...utronix.de, bjorn@...osinc.com, 
	arnd@...db.de, stuart.menefy@...asip.com, luxu.kernel@...edance.com, 
	vincenzo.frascino@....com, samuel.holland@...ive.com, 
	christophe.leroy@...roup.eu, dawei.li@...ngroup.cn, rppt@...nel.org, 
	linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [External] Re: [PATCH] riscv: introduce the ioremap_prot() function

Hi Christoph,

On Thu, Mar 20, 2025 at 11:41 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> > +{
> > +     phys_addr_t addr = PFN_PHYS(pfn);
> > +
> > +     /* avoid false positives for bogus PFNs, see comment in pfn_valid() */
> > +     if (PHYS_PFN(addr) != pfn)
> > +             return 0;
> > +
> > +     return memblock_is_map_memory(addr);
> > +}
> > +EXPORT_SYMBOL(pfn_is_map_memory);
>
> This should not be exported or even exposed.  Please just open code it
> in the only caller.
>
> > +void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
> > +                        pgprot_t pgprot)
> > +{
> > +     /* Don't allow RAM to be mapped. */
> > +     if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
> > +             return NULL;
>
> Or just use pfn_valid as that's what we usually use for that check.
> Or am I missing something specific here?
>
> It would also be nice to just life this to common code.

Thank you for your suggestion. I was planning to do just that. If
possible, I'll make the update in version 2.

Thanks,
Yunhui

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ