Subject: Re: Oh oh
To: Theo Deraadt <deraadt@fsa.ca>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: port-sparc
Date: 11/28/1993 12:41:26
> 
> I think I found the first case of Sun's merged buffercache/vm
> system ``showing itself''.
> 
> A trace of ldconfig shows this:
> 
> mmap (0, 1048576, 0x3, 0x80000001, 3, 0) = 0xf75f0000
> getpagesize () = 4096
> ftruncate (3, 4096) = 0
> <we dump core here>
> 
> I bet right after the ftruncate it attempts to access 0xf75f0000
> + N (4096 > N >= 0).
> 

ldconfig works just fine on my diskless ELC, so I assume you are seeing the
effect of ftruncate(2) not being able to extend a file on an UFS file system.

I have hacked my ufs_inode.c to do this. It works reasonably for small files,
but Chris Torek says it's a much more complex problem for things like
ftruncate(<fd>, 2^64 - 1). This is supposedly solved in 4.4.

On the other hand, isn't mmap(2) supposed to map addresses in excess of the
actual file size to demand zero pages? Hmm, maybe only up to the next page
boundary.

-pk

------------------------------------------------------------------------------