Re: [PATCH] mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08.09.22 04:47, HORIGUCHI NAOYA(堀口 直也) wrote:
On Wed, Sep 07, 2022 at 01:57:45PM -0700, Andrew Morton wrote:
On Wed, 7 Sep 2022 21:11:57 +0900 Naoya Horiguchi <naoya.horiguchi@xxxxxxxxx> wrote:


NULL pointer dereference is triggered when calling thp split via debugfs
on the system with offlined memory blocks.  With debug option enabled,
the following kernel messages are printed out:

   page:00000000467f4890 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x121c000
   flags: 0x17fffc00000000(node=0|zone=2|lastcpupid=0x1ffff)
   raw: 0017fffc00000000 0000000000000000 dead000000000122 0000000000000000
   raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
   page dumped because: unmovable page
   page:000000007d7ab72e is uninitialized and poisoned
   page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p))
   ------------[ cut here ]------------
   kernel BUG at include/linux/mm.h:1248!
   invalid opcode: 0000 [#1] PREEMPT SMP PTI
   CPU: 16 PID: 20964 Comm: bash Tainted: G          I        6.0.0-rc3-foll-numa+ #41
   ...
   RIP: 0010:split_huge_pages_write+0xcf4/0xe30

This shows that page_to_nid() in page_zone() is unexpectedly called for an
offlined memmap.

Use pfn_to_online_page() to get struct page in PFN walker.

Fixes: 49071d436b51 ("thp: add debugfs handle to split all huge pages")

January of 2016!  Or was this a long-term bug which was recently
exposed by some other change?

Maybe yes, I confirmed that this issue reproduces in kernel 5.10 (released
on Dec 13, 2020, which might not be so "recent"), but does not reproduce in
kernel 5.4.  So I think that marking "5.10+" for stable is fine.


I fixed plenty of such issues in the past. For example:

aad5f69bc161 ("fs/proc/page.c: don't access uninitialized memmaps in fs/proc/page.c")

This one just wasn't found so far because it's triggered via
a debug interface.

The correct fixes tag would be:

Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online")      [visible after d0dc12e86b319]

Exposed "recently" -- 2018 ;)

--
Thanks,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux