summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2020-03-13 10:07:01 +0000
committeranton <anton@openbsd.org>2020-03-13 10:07:01 +0000
commit9af56a697ae2af4a65b068bf9b7fc1685644e504 (patch)
tree6513ab14c4cbab14877e621b1bd21a1e70bce8c4 /sys/kern/vfs_syscalls.c
parentAnthony Steinhauser reports that 32-bit arm cpus have the same speculation (diff)
downloadwireguard-openbsd-9af56a697ae2af4a65b068bf9b7fc1685644e504.tar.xz
wireguard-openbsd-9af56a697ae2af4a65b068bf9b7fc1685644e504.zip
In order to unlock flock(2), make writes to the f_iflags field of struct
file atomic. This also gets rid of the last kernel lock protected field in the scope of struct file. ok mpi@ visa@
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 34dc786d60f..3a8c9208f9e 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.342 2020/01/30 15:36:11 visa Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.343 2020/03/13 10:07:01 anton Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1188,7 +1188,7 @@ doopenat(struct proc *p, int fd, const char *path, int oflags, mode_t mode,
goto out;
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- fp->f_iflags |= FIF_HASLOCK;
+ atomic_setbits_int(&fp->f_iflags, FIF_HASLOCK);
}
if (localtrunc) {
if ((fp->f_flag & FWRITE) == 0)
@@ -1457,7 +1457,7 @@ sys_fhopen(struct proc *p, void *v, register_t *retval)
goto bad;
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
- fp->f_iflags |= FIF_HASLOCK;
+ atomic_setbits_int(&fp->f_iflags, FIF_HASLOCK);
}
VOP_UNLOCK(vp);
*retval = indx;