[BUG] 2.4.22-pre7: unshare-files fix breaks file locks

From: Andreas Gruenbacher (agruen@suse.de)
Date: Wed Jul 23 2003 - 12:17:34 EST

Hello Marcelo,

as already mentioned in private mail, the unshare-files patch in 2.4.22-pre7
breaks POSIX file lock semantics after an execve(2): unshare_files() gives
the process a new task_struct->files struct. Existing POSIX file locks
continue to refer to the old files struct. POSIX requires that the locks
migrate to the exec'ed process. (The LSB checks that.)

The fix is to steal the locks from the old file struct after unshare_files(),
when it is known that the new, unshared files struct will be used.

The fixes introduce changes in behavior for processes that share a common
files struct, a case which can be constructed using clone(2). This use of
clone is pathological. Before the unshare-files fix, the clones would still
share the same files struct. With unshare files, the exec'ed process would
lose the locks. We should ensure that the exec'ed process finally holds the


 Andreas Gruenbacher SuSE Labs, SuSE Linux AG
 mailto:agruen@suse.de Deutschherrnstr. 15-19
 http://www.suse.de/ D-90429 Nuernberg, Germany

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

This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:49 EST