lkml.org 
[lkml]   [2004]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [BUG][2.6.8.1] Nevver dump core while /dev/men is mmaped
On Tue, 21 Sep 2004, Peter Seiderer wrote:

> Hello,
> the following short program stops my computer immediately (no more
> input, telnet etc. possible):
>
> --- begin ---
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <sys/mman.h>
> #include <assert.h>
>
> int main(int argc, char *argv[]) {
> int fd;
> assert((fd = open("/dev/mem", O_RDWR)) != (-1));
>
> size_t s = 67108864;
> void *m;
> assert((m = mmap(NULL, s, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
> 0xd0000000)) != NULL);
^^^^^^^^^^^^^^^
Incorrect. mmap() returns MAP_FAILED, (void *)-1, when it fails, not
NULL, (void *)0.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.034 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site