minix/servers/vfs
Thomas Veerman 7c8b3ddfed VFS: fix locking bugs
.sync and fsync used unnecessarily restrictive locking type
.fsync violated locking order by obtaining a vmnt lock after a filp lock
.fsync contained a TOCTOU bug
.new_node violated locking rules (didn't upgrade lock upon file creation)
.do_pipe used unnecessarily restrictive locking type
.always lock pipes exclusively; even a read operation might require to do
 a write on a vnode object (update pipe size)
.when opening a file with O_TRUNC, upgrade vnode lock when truncating
.utime used unnecessarily restrictive locking type
.path parsing:
  .always acquire VMNT_WRITE or VMNT_EXCL on vmnt and downgrade to
   VMNT_READ if that was what was actually requested. This prevents the
   following deadlock scenario:
   thread A:
     lock_vmnt(vmp, TLL_READSER);
     lock_vnode(vp, TLL_READSER);
     upgrade_vmnt_lock(vmp, TLL_WRITE);

   thread B:
     lock_vmnt(vmp, TLL_READ);
     lock_vnode(vp, TLL_READSER);

   thread A will be stuck in upgrade_vmnt_lock and thread B is stuck in
   lock_vnode. This happens when, for example, thread A tries create a
   new node (open.c:new_node) and thread B tries to do eat_path to
   change dir (stadir.c:do_chdir). When the path is being resolved, a
   vnode is always locked with VNODE_OPCL (TLL_READSER) and then
   downgraded to VNODE_READ if read-only is actually requested. Thread
   A locks the vmnt with VMNT_WRITE (TLL_READSER) which still allows
   VMNT_READ locks. Thread B can't acquire a lock on the vnode because
   thread A has it; Thread A can't upgrade its vmnt lock to VMNT_WRITE
   (TLL_WRITE) because thread B has a VMNT_READ lock on it.

   By serializing vmnt locks during path parsing, thread B can only
   acquire a lock on vmp when thread A has completely finished its
   operation.
2013-01-11 09:18:35 +00:00
..
comm.c VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
comm.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
const.h VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
coredump.c various warning/errorwarning fixes for gcc47 2012-08-27 16:19:18 +02:00
device.c VFS: resolve unused parameter if NOASSERTS="yes" 2012-09-28 14:57:32 +02:00
dmap.c VFS: fix deadlock when out of worker threads 2012-11-14 13:12:37 +00:00
dmap.h VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
exec.c libexec: add load_offset feature, used for ld.so 2012-08-12 23:22:54 +02:00
file.h VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
filedes.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
fproc.h VFS: fix deadlock when out of worker threads 2012-11-14 13:12:37 +00:00
fs.h VFS: make m_in job local 2012-04-13 12:50:38 +00:00
gcov.c VFS: make m_in job local 2012-04-13 12:50:38 +00:00
glo.h various coverity-inspired fixes 2012-07-16 14:00:56 +02:00
job.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
link.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
lock.c VFS: use S_IS* macros 2012-04-27 08:49:38 +00:00
lock.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
main.c Implement dynamic mtab support 2012-11-26 15:20:18 +00:00
Makefile VFS: remove support for sync FS communication 2012-07-17 10:12:53 +00:00
misc.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
mount.c vfs:fix for variable 'rfp' set but not used. 2013-01-07 09:12:27 +01:00
open.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
param.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
path.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
path.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
pipe.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
protect.c VFS: use S_IS* macros 2012-04-27 08:49:38 +00:00
proto.h VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
read.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
request.c VFS: do not save device node for new regular files 2012-11-15 14:29:59 +00:00
request.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
scratchpad.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
select.c VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
stadir.c VFS: simplify stat for pipes 2012-04-27 08:50:49 +00:00
table.c No more intel/minix segments. 2012-07-15 22:30:15 +02:00
threads.h VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
time.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
tll.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
tll.h VFS: replace VFS with AVFS 2012-02-13 16:53:21 +00:00
utility.c various warning/errorwarning fixes for gcc47 2012-08-27 16:19:18 +02:00
vmnt.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
vmnt.h Implement dynamic mtab support 2012-11-26 15:20:18 +00:00
vnode.c VFS: fix locking bugs 2013-01-11 09:18:35 +00:00
vnode.h VFS: I_PIPE is redundant 2012-04-27 08:49:38 +00:00
worker.c VFS: make all IPC asynchronous 2012-09-17 11:01:45 +00:00
write.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00