From: Andrew Morton <akpm@linux-foundation.org>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
"open list:MEMORY MANAGEMENT" <linux-mm@kvack.org>
Subject: Re: [PATCH] mm: fix mmap overflow checking
Date: Tue, 4 Sep 2012 13:59:24 -0700 [thread overview]
Message-ID: <20120904135924.b61e04e0.akpm@linux-foundation.org> (raw)
In-Reply-To: <1346750580-11352-1-git-send-email-gaowanlong@cn.fujitsu.com>
On Tue, 4 Sep 2012 17:23:00 +0800
Wanlong Gao <gaowanlong@cn.fujitsu.com> wrote:
> POSIX said that if the file is a regular file and the value of "off"
> plus "len" exceeds the offset maximum established in the open file
> description associated with fildes, mmap should return EOVERFLOW.
That's what POSIX says, but what does Linux do? It is important that
we precisely describe and understand the behaviour change, as there is
potential here to break existing applications.
I'm assuming that Linux presently permits the mmap() and then generates
SIGBUS if an access is attempted beyond the max file size?
> /* offset overflow? */
> - if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
> - return -EOVERFLOW;
> + if (off + len < off)
> + return -EOVERFLOW;
Well, this treats sizeof(off_t) as the "offset maximum established in
the open file". But from my reading of the above excerpt, we should in
fact be checking against the underlying fs's s_maxbytes?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-09-04 20:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-04 9:23 [PATCH] mm: fix mmap overflow checking Wanlong Gao
2012-09-04 20:59 ` Andrew Morton [this message]
2012-09-05 3:20 ` Wanlong Gao
2012-09-05 20:41 ` Andrew Morton
2012-09-07 22:38 ` KOSAKI Motohiro
2012-09-08 1:44 ` Wanlong Gao
2012-09-08 1:58 ` KOSAKI Motohiro
2012-09-08 2:07 ` Wanlong Gao
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=20120904135924.b61e04e0.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=gaowanlong@cn.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).