Re: [PATCH v5 4/4] mm/msync: return ENOMEM if len overflows for msync

From: Ding Feng

Date: Fri Nov 20 2026 - 00:14:28 EST


Hi,

This patch seems to have stalled with the mlock discussion on v4, but
the msync part does not depend on it: a range whose page-aligned length
wraps to 0 always covers unmapped addresses, so msync(2)'s "ENOMEM The
indicated memory (or part of it) was not mapped" applies.

It is still reproducible on v7.4-rc3 (65e4fd942), and the patch applies
cleanly there. On a one-page anonymous mapping p (arm64, QEMU):

call unpatched patched
msync(p, SIZE_MAX - 4094, MS_SYNC) 0 ENOMEM
msync(p, 1UL << 40, MS_SYNC) ENOMEM ENOMEM
msync(p, 4096, MS_SYNC) 0 0
msync(p, 0, MS_SYNC) 0 0

Tested-by: Ding Feng <dingf3ng@xxxxxxxxx>

Andrew, could this one go in on its own?

Thanks,
Ding Feng