Re: DoS with POSIX file locks?

Matthew Wilcox
2006-03-20T12:39:50Z

On Mon, Mar 20, 2006 at 01:19:12PM +0100, Miklos Szeredi wrote:
> > > Unlike open files there doesn't seem to be any limit on the number of
> > > locks being held either globally or by a single process.
> >
> > RLIMIT_LOCKS
>
> Which is not actually used anywhere.

Right. Um. I took it out back in March 2003 after enough people
convinced me it wasn't worth trying to account for all the memory
processes use, and the userbeans project would take care of it anyway.
Haha.

It's hard to fix the accounting. You have to deal with one thread
allocating the lock, and then a different thread freeing it. We never
actually accounted for posix locks (which are the ones we really needed
to!) and on occasion had current->locks go negative, with all kinds of
associated badness.

So you're welcome to try and fix it, but you may well go mad doing so.
Fortunately, I'm no longer maintaining locks.c, but I'd be happy to
answer questions.