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 08:38:28PM +0100, Nicolas Joly wrote:
> >  > 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 ?

+       if (length > l->l_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur) {              

Well...
l->l_proc is ok.
l_proc->p_rlimit may not be (if it is shared with another process,
  and an update by another process/thread causes the pointer to change,
  and the other owners all exit ...)
p_rlimit[RLIMIT_FSIZE].rlim_cur is uint64_t so is a problem on 32bit.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index