[PATCH v2 27/47] mm/mmu_gather: fix flushing ranges with 4 GiB or larger
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Oct 29 20:41:37 PDT 2026
> From: Josef Bacik <josef at toxicpanda.com>
>
> __tlb_adjust_range() takes the size of the range which has to be flushed
> as an unsigned int. Its callers, tlb_flush_{pte,pmd,pud,p4d}_range(), get
> and pass an unsigned long. Consequently, a range that is 4 GiB or larger
> gets truncated, possibly to 0.
>
> On arm64 with hugetlb, a 64k kernel can have 16 GiB hugetlb folios
> mapped contiguously at the PMD level and flush them when unmapping, and a
> 16k kernel can flush 64 GiB PUDs through tlb_unshare_pmd_ptdesc(). So
> at least these two scenarios are affected.
>
> Fix it by flushing the proper range instead of the truncated one by
> properly using "unsigned long" for range_size.
>
> Fix generated by an LLM and sent by Josef Bacik in private.
>
> Fixes: b528e4b6405b ("mm/hugetlb: add tlb_remove_hugetlb_entry for handling hugetlb pages")
> Fixes: 8ce720d5bd91 ("mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather")
> Cc: stable at vger.kernel.org
> Signed-off-by: Josef Bacik <josef at toxicpanda.com>
> Acked-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> [ david: use two-tab indent, simplify description ]
> Reviewed-by: Qi Zheng <qi.zheng at linux.dev>
> Reviewed-by: Gregory Price (Meta) <gourry at gourry.net>
> Tested-by: Gregory Price (Meta) <gourry at gourry.net>
> Reviewed-by: Dev Jain <dev.jain at arm.com>
> Reviewed-by: Muchun Song <muchun.song at linux.dev>
> Reviewed-by: Pedro Falcato <pfalcato at suse.de>
> Signed-off-by: David Hildenbrand (Arm) <david at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029-fixes_core-v2-0-a64ce7f83abb@kernel.org?part=27
More information about the kexec
mailing list