Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Feng <dingf3ng@gmail.com>
To: Ma Wupeng <mawupeng1@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Ding Feng <dingf3ng@gmail.com>
Subject: Re: [PATCH v5 4/4] mm/msync: return ENOMEM if len overflows for msync
Date: Fri, 20 Nov 2026 13:14:13 +0800	[thread overview]
Message-ID: <20261120051413.46167-1-dingf3ng@gmail.com> (raw)
In-Reply-To: <20230321074035.1526157-5-mawupeng1@huawei.com>

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?

Thanks,
Ding Feng


      reply	other threads:[~2026-11-20  5:14 UTC|newest]

Thread overview: 6+ 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 [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=20261120051413.46167-1-dingf3ng@gmail.com \
    --to=dingf3ng@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox