]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kfence: drop nth_page() usage
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:56 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Sep 2025 21:22:09 +0000 (14:22 -0700)
commit56531761d4b04ea46de04f7ddab0cdc9cd1a35e1
treeaf9d77423987cc3fc37b235b4d317ede5d33521f
parentb5ba761a7f5612759770117657577925fcb2e668
kfence: drop nth_page() usage

We want to get rid of nth_page(), and kfence init code is the last user.

Unfortunately, we might actually walk a PFN range where the pages are not
contiguous, because we might be allocating an area from memblock that
could span memory sections in problematic kernel configs (SPARSEMEM
without SPARSEMEM_VMEMMAP).

We could check whether the page range is contiguous using
page_range_contiguous() and failing kfence init, or making kfence
incompatible these problemtic kernel configs.

Let's keep it simple and simply use pfn_to_page() by iterating PFNs.

Link: https://lkml.kernel.org/r/20250901150359.867252-36-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Marco Elver <elver@google.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kfence/core.c