From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Ding Feng <dingf3ng@gmail.com>
Cc: Ma Wupeng <mawupeng1@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/4] mm/msync: return ENOMEM if len overflows for msync
Date: Fri, 20 Nov 2026 10:11:39 +0000 [thread overview]
Message-ID: <awAZLIPNrcHeNr6a@lucifer> (raw)
In-Reply-To: <20261120051413.46167-1-dingf3ng@gmail.com>
On Fri, Nov 20, 2026 at 01:14:13PM +0800, Ding Feng wrote:
> 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@gmail.com>
>
> Andrew, could this one go in on its own?
This is from 3.5 years ago, so please no :)
This doesn't really matter all the much and is a nice to have I suppose, so
let me send a patch for it to make life easier.
>
> Thanks,
> Ding Feng
--
Cheers, Lorenzo
prev parent reply other threads:[~2026-11-20 10:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 7:40 [PATCH v5 0/4] Add overflow checks for several syscalls Wupeng Ma
2023-03-21 7:40 ` [PATCH v5 1/4] mm/mlock: return EINVAL if len overflows for mlock/munlock Wupeng Ma
2023-03-21 7:40 ` [PATCH v5 2/4] mm/mempolicy: return EINVAL for if len overflows for set_mempolicy_home_node Wupeng Ma
2023-03-21 7:40 ` [PATCH v5 3/4] mm/mempolicy: return EINVAL if len overflows for mbind Wupeng Ma
2023-03-21 7:40 ` [PATCH v5 4/4] mm/msync: return ENOMEM if len overflows for msync Wupeng Ma
2026-11-20 5:14 ` Ding Feng
2026-11-20 10:11 ` Lorenzo Stoakes (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=awAZLIPNrcHeNr6a@lucifer \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=dingf3ng@gmail.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mawupeng1@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.