tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Adding truncate/ftruncate length argument checks



On Wed, Feb 26, 2014 at 05:10:49PM +0000, David Holland wrote:
> On Wed, Feb 26, 2014 at 03:43:17PM +0100, Nicolas Joly wrote:
>  > According to the OpenGroup online doccuments for truncate[1] and
>  > ftruncate[2], there are a few cases where both syscalls should fail
>  > when given some length values :
>  > 
>  > - EINVAL for negative length.
>  > - EFBIG (or EINVAL) for length bigger than process file size limit.
> 
> Isn't the process file size limit supposed to be about actual size
> (rather than length)?

Hmm, yes. That's a little more complex than i thought ... Extending a
file add no cost to file size (sparse); it then only depends on the
original file size.

For a file that is already over limit; every operation, except when
length is smaller than limit, will fail with EFBIG (+SIGXFSZ). Not
sure anymore that this will make a sensible behaviour.

>  > The attached patch add the missing length argument checks, and update
>  > the man page accordingly.
> 
> Isn't there (shouldn't there be) some lock needed to read the limit
> data?

Even for fetching a single value ? I thought it was mostly atomic ?

-- 
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index