diff options
author | art <art@openbsd.org> | 2008-09-19 12:24:55 +0000 |
---|---|---|
committer | art <art@openbsd.org> | 2008-09-19 12:24:55 +0000 |
commit | bb08c569828da634b782784149c2d0ffde9e1212 (patch) | |
tree | 94d6ccc8e8cbb21626efb66e63e67645274e1b47 /sys/sys/lockf.h | |
parent | AES with keysize != 128 bit is not supported in hardware, so we need (diff) | |
download | wireguard-openbsd-bb08c569828da634b782784149c2d0ffde9e1212.tar.xz wireguard-openbsd-bb08c569828da634b782784149c2d0ffde9e1212.zip |
Fix a bunch of problems and races with posix file locking.
- file descriptor table becomes the owner of the lock instead of the proc.
- When grabbing the lock, we check if the fd hasn't changed under our
feet, this is more or less impossible to solve without a hack like
this. I've banged my head against the wall, I figured out a solution,
but implementing it correctly would cost me 12 gray hairs. Screw it,
this is ugly, but it works.
- Wait until usecount drains before releasing the posix lock in closef.
- Add missing FREF/FRELE to sys_flock
- keep the pid in the flock struct instead of abusing the fact that we
used to use the proc as the lock owner.
Pointed out by and discussed with Al Viro, big thanks.
miod@ ok
Diffstat (limited to 'sys/sys/lockf.h')
-rw-r--r-- | sys/sys/lockf.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/sys/lockf.h b/sys/sys/lockf.h index 1b17d451522..c6b96256d16 100644 --- a/sys/sys/lockf.h +++ b/sys/sys/lockf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lockf.h,v 1.7 2005/03/10 17:26:10 tedu Exp $ */ +/* $OpenBSD: lockf.h,v 1.8 2008/09/19 12:24:55 art Exp $ */ /* $NetBSD: lockf.h,v 1.5 1994/06/29 06:44:33 cgd Exp $ */ /* @@ -54,6 +54,7 @@ struct lockf { struct locklist lf_blkhd; /* The list of blocked locks */ TAILQ_ENTRY(lockf) lf_block; /* A request waiting for a lock */ uid_t lf_uid; /* User ID responsible */ + pid_t lf_pid; /* POSIX - owner pid */ }; /* Maximum length of sleep chains to traverse to try and detect deadlock. */ |