Re: DoS with POSIX file locks?

From: Trond Myklebust
Date: Wed Mar 22 2006 - 15:05:45 EST


On Wed, 2006-03-22 at 17:34 +0100, Miklos Szeredi wrote:

> You mean the "local lockowner being stable" is irrelevant.
>
> Yes that is true, but the patch not only makes the local lockowner
> stable, it makes the "owner" stable. And that is the important part
> for NFS, etc.
>
> The remote lockowner has to be derived from the owner, which used to
> be current->files, but is changed to current->file->owner.
>
> The fact that current->file->owner will remain stable across the exec
> will mean that locking will behave consistently for local _and_ remote
> filesystems.
>
> Now I'm not saying I want to keep this weird semantics of always
> inheriting locks on exec. All I'm saying that it's _possible_.

You'd have to ensure that none of the threads involved are able to grab
new posix locks in the period between the unsharing of current->files to
the moment when current->files->owner is swapped.

If not, one thread could in theory open a new file and grab a lock that
can never be unlocked because its lockowner gets stolen away from it by
another execing thread.

Cheers,
Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/