[PATCH v2 20/47] mm/gup: fix clearing folios in memfd_pin_folios()
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Oct 29 20:41:14 PDT 2026
> From: Chris Mason <mason at kernel.org>
>
> memfd_pin_folios() pins folios obtained directly from the page cache
> without checking whether they are uptodate. However, shmem fallocate()
> can leave newly allocated folios uncleared and not uptodate. Callers
> such as udmabuf can then expose uninitialized memory to userspace.
>
> Clear non-uptodate folios and mark them uptodate under the folio lock
> before returning them to the caller.
>
> Fix generated by an LLM and sent by Chris Mason in private.
>
> Fixes: 89c1905d9c14 ("mm/gup: introduce memfd_pin_folios() for pinning memfd folios")
> Cc: stable at vger.kernel.org
> Signed-off-by: Chris Mason <mason at kernel.org>
> [ david: simplify description and comment ]
> Reviewed-by: Pratyush Yadav (Google) <pratyush at kernel.org>
> Reviewed-by: Samiullah Khawaja <skhawaja at google.com>
> Tested-by: Samiullah Khawaja <skhawaja at google.com>
> 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=20
More information about the kexec
mailing list