[lkml]   [1997]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 2.0000
On Wed, 2 Apr 1997, Johnny Stenback wrote:

> > > Oh yearh.. I know, kernel hacking is good... But Linux will never be a real
> > > commercially-supported OS, if a release kernel will not be released...
> > >
> > > So, we want 2.0.30 or .31 or any release. Is there a chance to hope ? :)
> >
> > When it works absolutely perfectly. 2.0.x is assumed to be _very_ stable. It
> > is important that remains true
> >
> >
> In that case someone with the knowledge should take a look at the mmap
> problem caused by the program posted recently by John Carter or by the
> program listed below...
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/mman.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <string.h>
> #include <errno.h>
> void main ()
> {
> int fd;
> void *p;
> char buf[1024];
> fd = open("test", O_RDONLY);
> p = mmap(NULL, 200, PROT_WRITE, MAP_PRIVATE, fd, 0);
> strncpy (buf, p, 100);
> printf ("%s\n", buf);
> munmap (p, 200);
> exit (0);
> }
> This has been discussed several times allready but no one has yet come
> up with a patch that fixes the problem...

I, for one, can find no such problem. I tried what I thought would cause
the problem discussed on the list, gave up, "well, his code causes it, so
let's start there." And, uh, your code doesn't do anything toooo unusual.
(I did these tests with a test full of random blah).

I get a segfault before anything is printed with this as it is now. If I
add a buf[100]=0; after that strncpy and change it to PROT_READ, I get no
error. We get SIGBUS if the only change is changing that to MAP_SHARED.
changing the order of the strncpy to write to *p instead of *buf is
harmless, as well, because MAP_PRIVATE is COW.
I see no bug. If anyone _can_ produce this bug (for real), please
send it to me, I would like to at least dig. From the comments others have
made, this should hopefully be fairly uncomplex to, at the least, kludge

Greg Alexander
Anyone who cannot cope with mathematics is not fully human. At best he is a
tolerable subhuman who has learned to wear shoes, bathe and not make messes
in the house.
-- Paul Erdos
also -- Lazarus Long, "Time Enough for Love"

 \ /
  Last update: 2005-03-22 13:39    [W:0.040 / U:0.888 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site