Linux Power Management development
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Yogesh Gaur <yogeshgaur.83@gmail.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Pavel Machek <pavel@kernel.org>, Len Brown <lenb@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+609c80047e3e808b465c@syzkaller.appspotmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] PM: hibernate: skip offline memory in mark_free_pages()
Date: Tue, 13 Oct 2026 09:02:19 +0200	[thread overview]
Message-ID: <c08d306e-ae10-40d5-942c-791efa08e232@kernel.org> (raw)
In-Reply-To: <20261006125849.1998-1-yogeshgaur.83@gmail.com>

On 10/6/26 14:58, Yogesh Gaur wrote:
> mark_free_pages() walks every valid PFN of a zone and calls page_zone()
> on its struct page.  A PFN in an offlined memory block is still valid,
> but its memmap is no longer initialised: offlining poisons it.  With
> CONFIG_DEBUG_VM that is caught on the first such page:
> 
>   page:ffffea0005400000 is uninitialized and poisoned
>   page dumped because: VM_BUG_ON_PAGE(PagePoisoned(page))
>   kernel BUG at ./include/linux/mm.h:2402!
>   RIP: 0010:mark_free_pages+0x49a/0x4b0 kernel/power/snapshot.c:1266
>    count_data_pages kernel/power/snapshot.c:1417 [inline]
>    hibernate_preallocate_memory+0x14f/0x750 kernel/power/snapshot.c:1859
>    hibernation_snapshot+0xd5/0x3d0 kernel/power/hibernate.c:416
>    hibernate+0x28f/0x680 kernel/power/hibernate.c:813
> 
> syzbot's reproducer offlines memory42 and then writes "disk" to
> /sys/power/state; that page is the first one of memory42.  Without
> CONFIG_DEBUG_VM the walk reads stale page flags instead.
> 
> saveable_page() and saveable_highmem_page() already use
> pfn_to_online_page() for this since commit 5b56db37218e ("PM/Hibernate:
> use pfn_to_online_page()").  Do the same here.  Offline pages are never
> on a free list, so the second loop in this function does not need it.
> 
> Fixes: d33695b16a9f ("mm/memory_hotplug: poison memmap in remove_pfn_range_from_zone()")

That's very likely the wrong commit. Memory that was added but never onlined similarly
has garbage in its memmap.

Like similar commits, this should likely be

Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online")

-- 
Cheers,

David

      reply	other threads:[~2026-10-13  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 12:58 [PATCH] PM: hibernate: skip offline memory in mark_free_pages() Yogesh Gaur
2026-10-13  7:02 ` David Hildenbrand (Arm) [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=c08d306e-ae10-40d5-942c-791efa08e232@kernel.org \
    --to=david@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+609c80047e3e808b465c@syzkaller.appspotmail.com \
    --cc=yogeshgaur.83@gmail.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