summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2019-08-13 07:09:22 +0000
committeranton <anton@cvs.openbsd.org>2019-08-13 07:09:22 +0000
commitea8251e5297f2660320882222548a26f621b5d6f (patch)
treed601f66aef0014972109ffdcd54b196764da165a /sys
parentff460c59ae446b7982ad2ad0f667a73e283bdef0 (diff)
Revert unlock of lseek(2) since vn_lock() could end up calling tsleep()
which is not allowed without holding the kernel lock. Otherwise, wakeups could be lost. Reported-by: syzbot+57588681ca9e3e9ba926@syzkaller.appspotmail.com
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/syscalls.master4
-rw-r--r--sys/kern/vfs_vnops.c4
2 files changed, 3 insertions, 5 deletions
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 85d0ccb807a..29b12d1e868 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.196 2019/08/12 08:17:05 anton Exp $
+; $OpenBSD: syscalls.master,v 1.197 2019/08/13 07:09:21 anton Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -349,7 +349,7 @@
197 STD { void *sys_mmap(void *addr, size_t len, int prot, \
int flags, int fd, long pad, off_t pos); }
198 INDIR { quad_t sys___syscall(quad_t num, ...); }
-199 STD NOLOCK { off_t sys_lseek(int fd, int pad, off_t offset, \
+199 STD { off_t sys_lseek(int fd, int pad, off_t offset, \
int whence); }
200 STD { int sys_truncate(const char *path, int pad, \
off_t length); }
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index adcf3935c61..a2f481ce6b8 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vnops.c,v 1.105 2019/08/12 08:17:05 anton Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.106 2019/08/13 07:09:21 anton Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
@@ -620,9 +620,7 @@ vn_seek(struct file *fp, off_t *offset, int whence, struct proc *p)
newoff = fp->f_offset + *offset;
break;
case SEEK_END:
- KERNEL_LOCK();
error = VOP_GETATTR(vp, &vattr, cred, p);
- KERNEL_UNLOCK();
if (error)
goto out;
newoff = *offset + (off_t)vattr.va_size;