From: Paolo Bonzini <paolo.bonzini@lu.unisi.ch>
To: bonzini@gnu.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
bugme-daemon@bugzilla.kernel.org, linux-mm@kvack.org
Subject: Re: [Bug 9138] New: kernel overwrites MAP_PRIVATE mmap
Date: Tue, 09 Oct 2007 18:56:19 +0200 [thread overview]
Message-ID: <470BB2B3.2070800@lu.unisi.ch> (raw)
In-Reply-To: <470BA58F.8050907@lu.unisi.ch>
This testcase is not a regression, but it is still a bug, and I believe
the root cause is the same: in this case, it is ftruncate modifying the
length of MAP_PRIVATE mmaps.
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
int main()
{
system ("echo foo > gst.im");
int f = open ("gst.im", O_RDONLY);
char *p = mmap(NULL, 1628636, PROT_READ, MAP_PRIVATE, f, 0);
close (f);
f = open("gst.im", O_RDWR|O_CREAT, 0666);
printf ("%s", p);
ftruncate (f, 0);
mmap(NULL, 401408, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANON, -1, 0);
printf ("%s", p);
}
Expected (and this is what it gives on e.g. Darwin):
foo
foo
Actual output:
foo
Bus error
--
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>
prev parent reply other threads:[~2007-10-09 21:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-9138-27@http.bugzilla.kernel.org/>
2007-10-09 15:39 ` [Bug 9138] New: kernel overwrites MAP_PRIVATE mmap Andrew Morton
2007-10-09 16:00 ` Paolo Bonzini
2007-10-09 16:25 ` Hugh Dickins
2007-10-10 4:42 ` Paolo Bonzini
2007-10-09 16:56 ` Paolo Bonzini [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=470BB2B3.2070800@lu.unisi.ch \
--to=paolo.bonzini@lu.unisi.ch \
--cc=akpm@linux-foundation.org \
--cc=bonzini@gnu.org \
--cc=bugme-daemon@bugzilla.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