linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Alastair D'Silva <alastair@d-silva.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pavel Tatashin <pasha.tatashin@oracle.com>,
	Oscar Salvador <osalvador@suse.de>,
	Mike Rapoport <rppt@linux.ibm.com>, Baoquan He <bhe@redhat.com>,
	Wei Yang <richard.weiyang@gmail.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr
Date: Tue, 2 Jul 2019 08:13:10 +0200	[thread overview]
Message-ID: <20190702061310.GA978@dhcp22.suse.cz> (raw)
In-Reply-To: <7f0ac9250e6fe6318aaf0685be56b121a978ce1b.camel@d-silva.org>

On Tue 02-07-19 14:13:25, Alastair D'Silva wrote:
> On Mon, 2019-07-01 at 12:46 +0200, Michal Hocko wrote:
> > On Fri 28-06-19 10:46:28, Alastair D'Silva wrote:
> > [...]
> > > Given that there is already a VM_BUG_ON in the code, how do you
> > > feel
> > > about broadening the scope from 'VM_BUG_ON(!root)' to
> > > 'VM_BUG_ON(!root
> > > > > (root_nr == NR_SECTION_ROOTS))'?
> > 
> > As far as I understand the existing VM_BUG_ON will hit when the
> > mem_section tree gets corrupted. This is a different situation to an
> > incorrect section given so I wouldn't really mix those two. And I
> > still
> > do not see much point to protect from unexpected input parameter as
> > this
> > is internal function as already pointed out.
> > 
> 
> Hi Michael,
> 
> I was able to hit this problem as the system firmware had assigned the
> prototype pmem device an address range above the 128TB limit that we
> originally supported. This has since been lifted to 2PB with patch
> 4ffe713b7587b14695c9bec26a000fc88ef54895.
> 
> As it stands, we cannot move this range lower as the high bits are
> dictated by the location the card is connected.
> 
> Since the physical address of the memory is not controlled by the
> kernel, I believe we should catch (or at least make it easy to debug)
> the sitution where external firmware allocates physical addresses
> beyond that which the kernel supports.

Just make it clear, I am not against a sanitization. I am objecting to
put it into __section_nr because this is way too late. As already
explained, you already must have a bogus mem_section object in hand.
Why cannot you add a sanity check right there when the memory is added?
Either when the section is registered or even sooner in arch_add_memory.

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2019-07-02  6:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  6:11 [PATCH v2 0/3] mm: Cleanup & allow modules to hotplug memory Alastair D'Silva
2019-06-26  6:11 ` [PATCH v2 1/3] mm: Trigger bug on if a section is not found in __section_nr Alastair D'Silva
2019-06-26  6:21   ` Michal Hocko
2019-06-26  6:27     ` Alastair D'Silva
2019-06-26  6:57       ` Michal Hocko
2019-06-27  0:50         ` Alastair D'Silva
2019-06-27  8:10           ` Michal Hocko
2019-06-28  0:46             ` Alastair D'Silva
2019-07-01 10:46               ` Michal Hocko
2019-07-02  4:13                 ` Alastair D'Silva
2019-07-02  6:13                   ` Michal Hocko [this message]
2019-07-02  6:16                     ` Alastair D'Silva
2019-06-28 11:37             ` David Hildenbrand
2019-06-28 11:58               ` Michal Hocko
2019-06-26  6:11 ` [PATCH v2 2/3] mm: don't hide potentially null memmap pointer in sparse_remove_one_section Alastair D'Silva
2019-06-26  6:23   ` Michal Hocko
2019-06-26  6:30     ` Alastair D'Silva
2019-06-26  6:59       ` Michal Hocko
2019-06-28 11:29   ` David Hildenbrand
2019-06-26  6:11 ` [PATCH v2 3/3] mm: Don't manually decrement num_poisoned_pages Alastair D'Silva
2019-06-26  6:24   ` Michal Hocko
2019-06-28 11:29   ` David Hildenbrand
2019-06-26  7:57 ` [PATCH v2 0/3] mm: Cleanup & allow modules to hotplug memory Christoph Hellwig
2019-06-27  0:51   ` Alastair D'Silva

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=20190702061310.GA978@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alastair@d-silva.org \
    --cc=bhe@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=logang@deltatee.com \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@oracle.com \
    --cc=rafael@kernel.org \
    --cc=richard.weiyang@gmail.com \
    --cc=rppt@linux.ibm.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