diff options
author | Tejun Heo <tj@kernel.org> | 2008-09-03 16:09:47 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-03 19:58:53 -0700 |
commit | ce36394269ccd9d1d286d6192ba09fa6894365e9 (patch) | |
tree | fb235ff6ea1363ae4fd933e29268e76cdade5682 /mm/mmu_notifier.c | |
parent | d210baf53b699fc61aa891c177b71d7082d3b957 (diff) | |
download | blackbird-op-linux-ce36394269ccd9d1d286d6192ba09fa6894365e9.tar.gz blackbird-op-linux-ce36394269ccd9d1d286d6192ba09fa6894365e9.zip |
mmap: fix petty bug in anonymous shared mmap offset handling
Anonymous mappings should ignore offset but shared anonymous mapping
forgot to clear it and makes the following legit test program trigger
SIGBUS.
#include <sys/mman.h>
#include <stdio.h>
#include <errno.h>
#define PAGE_SIZE 4096
int main(void)
{
char *p;
int i;
p = mmap(NULL, 2 * PAGE_SIZE, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS, -1, PAGE_SIZE);
if (p == MAP_FAILED) {
perror("mmap");
return 1;
}
for (i = 0; i < 2; i++) {
printf("page %d\n", i);
p[i * 4096] = i;
}
return 0;
}
Fix it.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Hugh Dickins <hugh@veritas.com>
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmu_notifier.c')
0 files changed, 0 insertions, 0 deletions