| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Prevent generating events that do not correspond to how the fifo has been
opened.
ok visa@, millert@
|
|
|
|
| |
ok kettenis@ mpi@ visa@
|
|
|
|
|
|
|
|
| |
it easier to grab the kernel lock once ioctl() is unlocked.
Thanks to semarie@ who came up with an improved diff.
ok mpi@ semarie@ visa@
|
|
|
|
| |
OK anton@, mpi@, bluhm@
|
|
|
|
| |
ok visa@, jca@
|
|
|
|
|
|
| |
initialized incorrectly for vn_open
ok visa@ anton@
|
|
|
|
|
|
|
|
| |
sweep tree to correct NDIINT op and flags ahead of time. document
the requirement. This allows KERNELPATH to be used to bypass
unveil for crash dumps with nosuidcoredump=2 or 3
ok visa@ deraadt@ florian@
|
|
|
|
|
|
|
|
|
|
|
|
| |
ensure that any other thread currently trying to acquire the underlying
vnode lock has observed that the same vnode is about to be exclusively
locked. Such threads must then sleep until the exclusive lock has been
released and then try to acquire the lock again. Otherwise, exclusive
access to the vnode cannot be guaranteed.
Thanks to naddy@ and visa@ for testing; ok visa@
Reported-by: syzbot+374d0e7e2400004957f7@syzkaller.appspotmail.com
|
|
|
|
|
|
|
| |
which is not allowed without holding the kernel lock. Otherwise, wakeups
could be lost.
Reported-by: syzbot+57588681ca9e3e9ba926@syzkaller.appspotmail.com
|
|
|
|
|
|
|
| |
VOP_GETATTR() must still be serialized using the kernel lock since the
underlying file system implementation is not MP-safe.
no objection from deraadt@ and ok mpi@ visa@
|
|
|
|
|
|
|
|
|
| |
serializing both read/write operations using the existing file mutex.
The vnode lock still grants exclusive write access to the offset; the
mutex is only used to make the actual write atomic and prevent any
concurrent reader from observing intermediate values.
ok mpi@ visa@
|
|
|
|
|
|
|
| |
allowing the file offset to change. This is part of the ongoing effort
to protect the file offset using the vnode lock.
ok mpi@ visa@
|
|
|
|
|
|
|
|
| |
existing vnode lock to protect writes to the f_offset field of struct
file. As opposed of introducing a new lock which turned out to be harder
than anticipated.
ok mpi@ visa@
|
|
|
|
|
|
| |
https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2
ok anton@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
as part of the effort to unlock the kernel. Instead of relying on the
vnode lock, introduce a dedicated lock per file. Exclusive write access
is granted using the new foffset_enter and foffset_leave API. A
convenience function foffset_get is also available for threads that only
need to read the current offset.
The lock acquisition order in vn_write has been changed to match the one
in vn_read in order to avoid a potential deadlock. This change also gets
rid of a documented race in vn_read().
Inspired by the FreeBSD implementation.
With help and ok mpi@ visa@
|
|
|
|
|
|
|
|
|
|
|
| |
unlocks read(2) and write(2) syscalls families, and push the KERNEL_LOCK
deeper in the code path. KERNEL_LOCK is managed per file type in fileops
handlers (fo_read, fo_write, and fo_close). read(2) and write(2) on
socket are KERNEL_LOCK-free.
initial work from mpi@ and ians@
ok mpi@ kettenis@ visa@ ians@
|
|
|
|
|
|
|
|
|
|
| |
of resource limit structs has been done between processes. By applying
copy-on-write also between threads, threads can read rlimits in
a nearly lock-free manner.
Inspired by code in DragonFly BSD and FreeBSD.
OK mpi@, agreement from jmatthew@ and anton@
|
|
|
|
|
|
|
|
|
|
|
|
| |
file operations mp-safe.
This change makes it clear that `f_offset' is only accessed in vn_read()
and vn_write(), which will help taking it out of the KERNEL_LOCK().
This refactoring uncovered a race in vn_read() which is now documented
and will be addressed in a later diff.
ok visa@
|
|
|
|
|
|
|
| |
a scenario where MP-unsafe code gets run without the kernel lock
as a consequence of an unlocked system call.
OK mpi@, kettenis@
|
|
|
|
|
|
|
|
|
|
|
| |
files that aren't vnodes. Move the vnode-specific code into its own
function. Add an implementation for the "DMA buffers" that can be used
by DRI3/prime code to find out the size of the graphics buffer.
This implementation is very limited and only supports offset 0 and only
for SEEK_SET and SEEK_END. This doesn't really make sense; implementing
stat(2) would be a more obvious choice. But this is what Linux does.
ok guenther@, visa@
|
|
|
|
|
|
| |
descriptor belonging to a cloned device.
ok kettenis@
|
|
|
|
|
|
| |
unlocking the directory vnode.
OK mpi@, helg@
|
|
|
|
|
|
| |
unnecessary because curproc always does the locking.
OK mpi@
|
|
|
|
|
|
|
| |
curproc that does the locking or unlocking, so the proc parameter
is pointless and can be dropped.
OK mpi@, deraadt@
|
|
|
|
| |
ok millert@, deraadt@, florian@
|
|
|
|
| |
ok millert@ sthen@
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Years ago Theo made read(2) return 0 on directories, instead of dumping
the directory content. Another behavior is allowed as an extension by
POSIX, returning an EISDIR error, as used on a few other systems. This
behavior is deemed more useful as it helps spotting errors. This
implies that it might break some setups.
Ports bulk builds by ajacoutot@ and naddy@, ok millert@ bluhm@ naddy@
deraadt@
|
|
|
|
|
|
|
|
| |
trivial change to use rrw locks instead. All it needs is LK_* defines
for the RW_* flags.
tested by naddy and sthen on package building infrastructure
input and ok jmc mpi tedu
|
|
|
|
|
|
| |
torture tested on amd64, i386 and macppc
ok beck mpi stefan
"the change looks right" deraadt
|
| |
|
|
|
|
|
|
| |
flags to check FREAD/FWRITE if needed. This will be used by fifo_poll
to avoid checking the write end of the fifo when the fd is read-only.
OK guenther@
|
|
|
|
|
|
|
| |
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
|
|
|
|
|
| |
objective: vnode.h doesn't include uvm_extern.h anymore.
followup changes: include uvm_extern.h or lock.h where necessary.
ok and help from deraadt
|
| |
|
| |
|
|
|
|
| |
after discussions with beck deraadt kettenis.
|
|
|
|
|
| |
don't need to be married.
ok guenther miod beck jsing kettenis
|
|
|
|
|
|
|
| |
leaking values in the padding bytes on LP64. Also, vn_stat() was lacking
the zero-fill to clean its padding.
ok kettenis@ deraadt@ phessler@
|
|
|
|
|
|
| |
by using size_t/ssize_t instead of int/u_int to handle I/O lengths in
uiomove(), vn_fsizechk(), and ktrgenio(). Eliminate the always-zero
'error' argument to ktrgenio() at the same time.
|
|
|
|
|
|
| |
O_* flags and eliminating an XXX comment.
ok matthew@ deraadt@
|
|
|
|
|
|
| |
leaving us with a free type function that isn't atomic. deal with this
by erasing any reachable pointers to the vnode first, then free it.
ok deraadt guenther
|
|
|
|
|
|
|
| |
rlimit, then a write that would take it over the limit should be
clamped, making it a partial write.
ok beck@
|
|
|
|
|
|
| |
LLONG_MAX instead of SSIZE_MAX
ok deraadt@
|
|
|
|
|
|
|
| |
Detect attempts to wrap the file offset by reading past the max (except
for character devices).
ok matthew@, deraadt@
|
|
|
|
|
|
| |
POSIX Issue 7.
Requested by oga@ (and maybe djm@); ok guenther@
|
|
|
|
|
|
| |
necessary.
"ok ... wait wait WAIT!! ... oh, yeah, it's fine, ok" guenther@
|
| |
|
|
|
|
|
|
|
|
|
| |
so that the process-level stuff is to/from struct process and not
struct proc. This fixes a bunch of problem cases in rthreads.
Based on earlier work by blambert and myself, but mostly written
at c2k10.
Tested by many: deraadt, sthen, krw, ray, and in snapshots
|