From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: Zhaoyang Huang <huangzhaoyang@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Zhaoyang Huang <zhaoyang.huang@unisoc.com>,
Rob Herring <robh@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Doug Berger <opendmb@gmail.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch : arm : add a criteria for pfn_valid
Date: Sun, 18 Aug 2019 11:15:51 +0100 [thread overview]
Message-ID: <20190818101551.GN13294@shell.armlinux.org.uk> (raw)
In-Reply-To: <20190818082035.GD10627@rapoport-lnx>
On Sun, Aug 18, 2019 at 11:20:35AM +0300, Mike Rapoport wrote:
> On Sun, Aug 18, 2019 at 03:46:51PM +0800, Zhaoyang Huang wrote:
> > On Sun, Aug 18, 2019 at 2:32 AM Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> wrote:
> > >
> > > On Sat, Aug 17, 2019 at 11:00:13AM +0800, Zhaoyang Huang wrote:
> > > > From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> > > >
> > > > pfn_valid can be wrong while the MSB of physical address be trimed as pfn
> > > > larger than the max_pfn.
> > >
> > > What scenario are you addressing here? At a guess, you're addressing
> > > the non-LPAE case with PFNs that correspond with >= 4GiB of memory?
> > Please find bellowing for the callstack caused by this defect. The
> > original reason is a invalid PFN passed from userspace which will
> > introduce a invalid page within stable_page_flags and then kernel
> > panic.
Thanks.
> Yeah, arm64 hit this issue a while ago and it was fixed with commit
> 5ad356eabc47 ("arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid()").
>
> IMHO, the check
>
> if ((addr >> PAGE_SHIFT) != pfn)
>
> is more robust than comparing pfn to max_pfn.
Yep, I'd prefer to see:
phys_addr_t addr = __pfn_to_phys(pfn);
if (__pfn_to_phys(addr) != pfn)
return 0;
return memblock_is_map_memory(addr);
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
prev parent reply other threads:[~2019-08-18 10:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-17 3:00 Zhaoyang Huang
2019-08-17 3:34 ` Matthew Wilcox
2019-08-17 9:00 ` Mike Rapoport
2019-08-17 9:14 ` Zhaoyang Huang
2019-08-17 18:32 ` Russell King - ARM Linux admin
2019-08-18 7:46 ` Zhaoyang Huang
2019-08-18 8:20 ` Mike Rapoport
2019-08-18 10:15 ` Russell King - ARM Linux admin [this message]
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=20190818101551.GN13294@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=f.fainelli@gmail.com \
--cc=geert@linux-m68k.org \
--cc=huangzhaoyang@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=opendmb@gmail.com \
--cc=robh@kernel.org \
--cc=rppt@linux.ibm.com \
--cc=zhaoyang.huang@unisoc.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