OpenBSD CVS

CVS log for src/sys/kern/vfs_syscalls.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.365 / (download) - annotate - [select for diffs], Sat May 18 05:20:22 2024 UTC (3 weeks, 2 days ago) by guenther
Branch: MAIN
CVS Tags: HEAD
Changes since 1.364: +32 -5 lines
Diff to previous 1.364 (colored)

Add pathconfat(2): pathconf(2) but with at-fd and flags arguments,
the latter supporting the ability to get timestamp resolution of
symlinks.

ok deraadt@ millert@

Revision 1.364 / (download) - annotate - [select for diffs], Mon Mar 25 17:57:07 2024 UTC (2 months, 2 weeks ago) by guenther
Branch: MAIN
Changes since 1.363: +13 -5 lines
Diff to previous 1.363 (colored)

Move the "no (hard) linking directories" and "no cross-mount links"
checks from all the filesystems that support hardlinks at all into
the VFS layer.  Simplify, EPERM description in link(2).

ok miod@ mpi@

Revision 1.363 / (download) - annotate - [select for diffs], Sat Feb 3 18:51:58 2024 UTC (4 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.362: +1 -5 lines
Diff to previous 1.362 (colored)

Remove Softdep.

Softdep has been a no-op for some time now, this removes it to get
it out of the way.

Flensing mostly done in Talinn, with some help from krw@

ok deraadt@

Revision 1.362 / (download) - annotate - [select for diffs], Wed Jul 5 15:13:28 2023 UTC (11 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.361: +4 -5 lines
Diff to previous 1.361 (colored)

Make softdep mounts a no-op

Softdep is a significant impediment to progressing in the vfs layer
so we plan to get it out of the way. It is too clever for us to
continue maintaining as it is.

ok kettenis@ kn@ tobhe@ and most of the g2k23 room except bluhm@

Revision 1.361 / (download) - annotate - [select for diffs], Sat Feb 11 23:22:17 2023 UTC (15 months, 4 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.360: +1 -93 lines
Diff to previous 1.360 (colored)

non-padded 64-bit system calls arrived 2021/12/23, over a year ago.
time to delete the backwards compat padded functions in the kernel.

Revision 1.360 / (download) - annotate - [select for diffs], Sun Aug 14 01:58:28 2022 UTC (21 months, 4 weeks ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.359: +1 -5 lines
Diff to previous 1.359 (colored)

remove unneeded includes in sys/kern
ok mpi@ miod@

Revision 1.359 / (download) - annotate - [select for diffs], Mon Aug 1 14:56:59 2022 UTC (22 months, 1 week ago) by deraadt
Branch: MAIN
Changes since 1.358: +92 -0 lines
Diff to previous 1.358 (colored)

some ports bootstraps, and go internals, need a bit more time to adapt
to the padded syscalls going away.

Revision 1.358 / (download) - annotate - [select for diffs], Wed Jul 20 05:56:36 2022 UTC (22 months, 3 weeks ago) by deraadt
Branch: MAIN
Changes since 1.357: +1 -93 lines
Diff to previous 1.357 (colored)

the _pad_ system calls from 2021/12/23 can go away
ok guenther

Revision 1.357 / (download) - annotate - [select for diffs], Mon May 23 15:17:11 2022 UTC (2 years ago) by millert
Branch: MAIN
Changes since 1.356: +36 -21 lines
Diff to previous 1.356 (colored)

Respect RLIMIT_FSIZE when extending a file via truncat(2)/ftruncate(2).
This refactors the commin parts of sys_truncate() and sys_ftruncate()
into dotruncate().  If the new size of the file is larger than the
RLIMIT_FSIZE limit _and_ the file is being extended, not truncated,
return EFBIG.  Adapted from a diff by Piotr Durlej.
With help from and OK by deraadt@ guenther@.

Revision 1.356 / (download) - annotate - [select for diffs], Thu Feb 17 03:12:34 2022 UTC (2 years, 3 months ago) by rob
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.355: +2 -2 lines
Diff to previous 1.355 (colored)

Writes to the ps_flags field of struct process should be atomic.
Ok deraadt@ guenther@

Revision 1.355 / (download) - annotate - [select for diffs], Tue Feb 15 23:16:00 2022 UTC (2 years, 3 months ago) by rob
Branch: MAIN
Changes since 1.354: +2 -1 lines
Diff to previous 1.354 (colored)

Reintroduce ps state flag 'c' indicating chrooted process (via PS_BITS).
Ok deraat@

Revision 1.354 / (download) - annotate - [select for diffs], Thu Dec 23 18:50:31 2021 UTC (2 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.353: +93 -8 lines
Diff to previous 1.353 (colored)

Roll the syscalls that have an off_t argument to remove the explicit padding.
Switch libc and ld.so to the generic stubs for these calls.
WARNING: reboot to updated kernel before installing libc or ld.so!

Time for a story...

When gcc (back in 1.x days) first implemented long long, it didn't (always)
pass 64bit arguments in 'aligned' registers/stack slots, with the result that
argument offsets didn't match structure offsets.  This affected the nine system
calls that pass off_t arguments:
   ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate

To avoid having to do custom ASM wrappers for those, BSD put an explicit pad
argument in so that the off_t argument would always start on a even slot and
thus be naturally aligned.  Thus those odd wrappers in lib/libc/sys/ that use
__syscall() and pass an extra '0' argument.

The ABIs for different CPUs eventually settled how things should be passed on
each and gcc 2.x followed them.  The only arch now where it helps is landisk,
which needs to skip the last argument register if it would be the first half of
a 64bit argument.  So: add new syscalls without the pad argument and on landisk
do that skipping directly in the syscall handler in the kernel.  Keep compat
support for the existing syscalls long enough for the transition.

ok deraadt@

Revision 1.353 / (download) - annotate - [select for diffs], Sat Oct 2 14:05:10 2021 UTC (2 years, 8 months ago) by semarie
Branch: MAIN
Changes since 1.352: +2 -7 lines
Diff to previous 1.352 (colored)

remove dead variable from sys___realpath()

it is a leftover from LOCKPARENT removal in NDINIT() (in rev 1.337)

ok mpi@

Revision 1.352 / (download) - annotate - [select for diffs], Fri Jul 16 07:59:38 2021 UTC (2 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.351: +1 -3 lines
Diff to previous 1.351 (colored)

Remove the unveil current directory pointer from struct process. Instead
pass in the vnode to unveil_start_relative() like it is done for *at()
syscalls. This fixes an issue with fchdir() that actually did not correctly
reset this pointer when changing the working directory.
OK beck@

Revision 1.351 / (download) - annotate - [select for diffs], Thu Jul 8 13:33:05 2021 UTC (2 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.350: +2 -4 lines
Diff to previous 1.350 (colored)

Remove the code to store intermediary vnodes in the unveil list.
These traversed vnodes are a leftover from early times where realpath(3)
was still all done in userland.
OK semarie@

Revision 1.350 / (download) - annotate - [select for diffs], Sat Jul 3 17:51:59 2021 UTC (2 years, 11 months ago) by semarie
Branch: MAIN
Changes since 1.349: +6 -7 lines
Diff to previous 1.349 (colored)

__realpath: removes LOCKLEAF from NDINIT.

The code doesn't doesn't need it: the returned vnode is released
immediately. The string path is built from the namei() call using
REALPATH, during directories traversal.

Without LOCKLEAF, calling vrele() only is enough if namei() found a
file, instead of calling VOP_UNLOCK() + vrele().

ok claudio@ mpi@

Revision 1.349 / (download) - annotate - [select for diffs], Thu Feb 11 12:08:21 2021 UTC (3 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.348: +27 -16 lines
Diff to previous 1.348 (colored)

In the various open functions reduce the fdplock() to only span over the
function which need the lock (falloc, fdinsert, fdremove). In most cases
it is not correct to hold the lock while calling VFS functions or e.g.
closef since those aquire or release long lived VFS locks.
OK visa@ mvs@

Revision 1.348 / (download) - annotate - [select for diffs], Fri Oct 2 15:45:22 2020 UTC (3 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.347: +19 -1 lines
Diff to previous 1.347 (colored)

expose timeval/timespec from system calls into ktrace, before determining
if they are out of range, making it easier to isolate reason for EINVAL
ok cheloha

Revision 1.347 / (download) - annotate - [select for diffs], Sun Aug 23 09:35:32 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.346: +1 -6 lines
Diff to previous 1.346 (colored)

Remove unused debug_syncprt, improve debug sysctl handling

"syncprt" is unused since kern/vfs_syscalls.c r1.147 from 2008.

Adding new debug sysctls is a bit opaque and looking at kern/kern_sysctl.c
the only visible difference between used and stub ctldebug structs in the
debugvars[] array is their extern keyword, indicating that it is defined
elsewhere.

sys/sysctl.h declares all debugN members as extern upfront, but these
declarations are not needed.

Remove the unused debug sysctl, rename the only remaining one to something
meaningful and remove forward declarations from /sys/sysctl.h;  this way,
adding new debug sysctls is a matter of adding extern and coming up with a
name, which is nicer to read on its own and better to grep for.

OK mpi

Revision 1.346 / (download) - annotate - [select for diffs], Sat Aug 22 11:47:23 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
Changes since 1.345: +2 -2 lines
Diff to previous 1.345 (colored)

Move sysctl(2) CTL_DEBUG from DEBUG to new DEBUG_SYSCTL

Adding "debug.my-knob" sysctls is really helpful to select different
code paths and/or log on demand during runtime without recompile,
but as this code is under DEBUG, lots of other noise comes with it
which is often undesired, at least when looking at specific subsystems
only.

Adding globals to the kernel and breaking into DDB to change them helps,
but that does not work over SSH, hence the need for debug sysctls.

Introduces DEBUG_SYSCTL to make use of the "debug" MIB without the rest of
DEBUG; it's DEBUG_SYSCTL and not SYSCTL_DEBUG because it's not a general
option for all of sysctl(2).

OK gnezdo

Revision 1.345 / (download) - annotate - [select for diffs], Wed Jun 24 22:03:42 2020 UTC (3 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.344: +2 -2 lines
Diff to previous 1.344 (colored)

kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)

time_second(9) and time_uptime(9) are widely used in the kernel to
quickly get the system UTC or system uptime as a time_t.  However,
time_t is 64-bit everywhere, so it is not generally safe to use them
on 32-bit platforms: you have a split-read problem if your hardware
cannot perform atomic 64-bit reads.

This patch replaces time_second(9) with gettime(9), a safer successor
interface, throughout the kernel.  Similarly, time_uptime(9) is replaced
with getuptime(9).

There is a performance cost on 32-bit platforms in exchange for
eliminating the split-read problem: instead of two register reads you
now have a lockless read loop to pull the values from the timehands.
This is really not *too* bad in the grand scheme of things, but
compared to what we were doing before it is several times slower.

There is no performance cost on 64-bit (__LP64__) platforms.

With input from visa@, dlg@, and tedu@.

Several bugs squashed by visa@.

ok kettenis@

Revision 1.344 / (download) - annotate - [select for diffs], Thu Mar 19 13:55:20 2020 UTC (4 years, 2 months ago) by anton
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.343: +2 -9 lines
Diff to previous 1.343 (colored)

Move unveil data structures away from the proc.h header into the
implementation file. Pushing the assignment of ps_uvpcwd down to
unveil_add() is required but it doesn't introduce any functional change.

ok mpi@ semarie@

Revision 1.343 / (download) - annotate - [select for diffs], Fri Mar 13 10:07:01 2020 UTC (4 years, 2 months ago) by anton
Branch: MAIN
Changes since 1.342: +3 -3 lines
Diff to previous 1.342 (colored)

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@

Revision 1.342 / (download) - annotate - [select for diffs], Thu Jan 30 15:36:11 2020 UTC (4 years, 4 months ago) by visa
Branch: MAIN
Changes since 1.341: +4 -3 lines
Diff to previous 1.341 (colored)

Acquire fdplock when updating fd_cmask. This moves the code
toward MP-safety.

OK mpi@, anton@

Revision 1.341 / (download) - annotate - [select for diffs], Sun Jan 26 04:28:18 2020 UTC (4 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.340: +85 -1 lines
Diff to previous 1.340 (colored)

add a new __tmpfd system call that creates a new unnamed file in /tmp.
intended for shm/fd passing, but for programs that may otherwise like
filesystem access.
ok beck deraadt kettenis

Revision 1.340 / (download) - annotate - [select for diffs], Sat Jan 18 08:40:19 2020 UTC (4 years, 4 months ago) by visa
Branch: MAIN
Changes since 1.339: +3 -3 lines
Diff to previous 1.339 (colored)

Clear mount operation argument flags from mnt_flag after mount.

OK bluhm@

Revision 1.339 / (download) - annotate - [select for diffs], Fri Jan 10 10:33:35 2020 UTC (4 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.338: +3 -3 lines
Diff to previous 1.338 (colored)

Convert the vnode list at the mount point into a tailq.  During
unmount this list is traversed and the dirty vnodes are flushed to
disk.  Forced unmount expects that the list is empty after flushing,
otherwise the kernel panics with "dangling vnode".  As the write
to disk can sleep, new vnodes may be inserted.  If softdep is
enabled, resolving the dependencies creates new dirty vnodes and
inserts them to the list.  To fix the panic, let insmntque() insert
new vnodes at the tail of the list.  Then vflush() will still catch
them while traversing the list in forward direction.
OK tedu@ millert@ visa@

Revision 1.338 / (download) - annotate - [select for diffs], Fri Nov 29 20:58:17 2019 UTC (4 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.337: +7 -6 lines
Diff to previous 1.337 (colored)

Eliminate the sketchy use of ps_mainproc here by making unveil_add_vnode()
take a struct proc* instead of a struct process*, and vice versa making
unveil_lookup() take a process* instead of a proc*.

ok beck@

Revision 1.337 / (download) - annotate - [select for diffs], Tue Nov 26 00:26:36 2019 UTC (4 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.336: +3 -13 lines
Diff to previous 1.336 (colored)

Don't use LOCKPARENT on namei calls for realpath(). We don't
require this anymore since we now behave like posix.

Fixes a problem where a symlink to / would return ENOTDIR because
the parent could not be locked - noticed by Raimo Niskanen <raimo@erlang.org>

ok guenther@ deraadt@

Revision 1.336 / (download) - annotate - [select for diffs], Sun Oct 6 16:24:14 2019 UTC (4 years, 8 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.335: +2 -2 lines
Diff to previous 1.335 (colored)

Fix vn_open to require an op of 0, and 0 or KERNELPATH only as flags.

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@

Revision 1.335 / (download) - annotate - [select for diffs], Sat Aug 31 17:59:33 2019 UTC (4 years, 9 months ago) by beck
Branch: MAIN
Changes since 1.334: +2 -2 lines
Diff to previous 1.334 (colored)

Make readlink require UNVEIL_READ instead of UNVEIL_INSPECT only
since realpath() is now a system call
ok deraadt@

Revision 1.334 / (download) - annotate - [select for diffs], Wed Aug 7 20:30:30 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.333: +14 -9 lines
Diff to previous 1.333 (colored)

The pathname in unveil(2) allocated 1024 bytes on the stack during
the system call.  Better use namei pool like sys___realpath() does.
OK semarie@ deraadt@

Revision 1.333 / (download) - annotate - [select for diffs], Tue Aug 6 22:45:02 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.332: +6 -6 lines
Diff to previous 1.332 (colored)

Fix white spaces.

Revision 1.332 / (download) - annotate - [select for diffs], Mon Aug 5 23:28:55 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.331: +17 -5 lines
Diff to previous 1.331 (colored)

Kernel realpath(3) and unveil(2) did not work correctly if the root
directory was written as "//".  If there is no non-slash character
in the path name, use the spacial case for root.
found by gmake regression tests; OK naddy@ benno@

Revision 1.331 / (download) - annotate - [select for diffs], Mon Aug 5 15:13:43 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.330: +3 -3 lines
Diff to previous 1.330 (colored)

Kernel realpath(3) had the same vnode leakage bug like unveil(2).
If parent and lookup vnode are equal, namei(9) locks them once but
reference counts twice.
from Moritz Buhl

Revision 1.330 / (download) - annotate - [select for diffs], Mon Aug 5 08:35:59 2019 UTC (4 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.329: +3 -1 lines
Diff to previous 1.329 (colored)

Allow concurrent reads of the f_offset field of struct file by
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@

Revision 1.329 / (download) - annotate - [select for diffs], Sun Aug 4 08:42:29 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.328: +2 -2 lines
Diff to previous 1.328 (colored)

Calling unveil(2) with the current directory leaked a vnode.  Even
if the parent and the lookup vnode are equal, namei(9) reference
counts both.  So release the parent vnode uncoditionally.
OK visa@

Revision 1.328 / (download) - annotate - [select for diffs], Fri Aug 2 08:12:35 2019 UTC (4 years, 10 months ago) by bluhm
Branch: MAIN
Changes since 1.327: +1 -6 lines
Diff to previous 1.327 (colored)

Move prototypes of unveil(2) functions which are used in separate C
files into the common namei.h header.
OK deraadt@

Revision 1.327 / (download) - annotate - [select for diffs], Thu Jul 25 01:43:21 2019 UTC (4 years, 10 months ago) by cheloha
Branch: MAIN
Changes since 1.326: +2 -2 lines
Diff to previous 1.326 (colored)

vinvalbuf(9): tlseep -> tsleep_nsec(9); ok millert@

Revision 1.326 / (download) - annotate - [select for diffs], Tue Jul 23 11:01:32 2019 UTC (4 years, 10 months ago) by stsp
Branch: MAIN
Changes since 1.325: +5 -1 lines
Diff to previous 1.325 (colored)

Fix realpath(3) errno code for an empty input path string.
It should return ENOENT in this case, but was returning EINVAL.
ok bluhm@ deraadt@

Revision 1.325 / (download) - annotate - [select for diffs], Mon Jul 22 16:43:10 2019 UTC (4 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.324: +2 -2 lines
Diff to previous 1.324 (colored)

Correct minor style nit in sys_getdents() for consistency, missing parens around
return expression.

Revision 1.324 / (download) - annotate - [select for diffs], Mon Jul 22 16:39:29 2019 UTC (4 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.323: +9 -5 lines
Diff to previous 1.323 (colored)

Grab the vnode lock earlier in sys_getdents() since it could end up
sleeping, 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@

Revision 1.323 / (download) - annotate - [select for diffs], Mon Jul 15 15:05:21 2019 UTC (4 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.322: +2 -2 lines
Diff to previous 1.322 (colored)

revert unintended change that snuck in last commit

Revision 1.322 / (download) - annotate - [select for diffs], Mon Jul 15 14:56:45 2019 UTC (4 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.321: +3 -3 lines
Diff to previous 1.321 (colored)

Make realpath posixly correct by changing the kernel implementation
to not succeed on final path components that do not exist.
The original implmentation succeeded in these cases.

ok bluhm@

Revision 1.321 / (download) - annotate - [select for diffs], Fri Jul 12 13:56:27 2019 UTC (4 years, 11 months ago) by solene
Branch: MAIN
Changes since 1.320: +3 -8 lines
Diff to previous 1.320 (colored)

Revert anton@ changes about read/write unlocking
https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2

ok anton@

Revision 1.320 / (download) - annotate - [select for diffs], Wed Jul 10 16:43:19 2019 UTC (4 years, 11 months ago) by anton
Branch: MAIN
Changes since 1.319: +9 -4 lines
Diff to previous 1.319 (colored)

Make read/write of the f_offset field belonging to struct file MP-safe;
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@

Revision 1.319 / (download) - annotate - [select for diffs], Wed Jun 19 16:55:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.318: +1 -11 lines
Diff to previous 1.318 (colored)

the pledge STATLIE code is no longer needed, as discussed with beck.
it actually isn't reached...

Revision 1.318 / (download) - annotate - [select for diffs], Sat Jun 15 15:28:55 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.317: +4 -1 lines
Diff to previous 1.317 (colored)

Have __realpath() do the pathname==NULL -> EINVAL check itself, eliminating
the need to do this in libc.
btw, it is unfortunate posix went this way, because converting a clearly
illegal condition to not be fatal but instead return an error which is
potentially not checked in the caller, is sadly a large component of the
runaway-train model that makes exploitation of software easy.. illegal
software should crash hard.
ok beck

Revision 1.317 / (download) - annotate - [select for diffs], Thu May 30 13:11:53 2019 UTC (5 years ago) by deraadt
Branch: MAIN
Changes since 1.316: +4 -0 lines
Diff to previous 1.316 (colored)

namei() generate KTR_NAMEI record input filenames, but getcwd(2) and
realpath(2) have output filenames.  Generate additional KTR_NAMEI
records upon success.
ok millert beck

Revision 1.316 / (download) - annotate - [select for diffs], Thu May 30 12:58:20 2019 UTC (5 years ago) by beck
Branch: MAIN
Changes since 1.315: +15 -15 lines
Diff to previous 1.315 (colored)

Correct call to vfs_getcwd_common from within __realpath

I borrowed an example usage from __getcwd poorly to begin with
and then there was some other strangeness in there.
diagnosed with deraadt.

ok deraadt@

Revision 1.315 / (download) - annotate - [select for diffs], Mon May 13 22:55:27 2019 UTC (5 years ago) by beck
Branch: MAIN
Changes since 1.314: +90 -1 lines
Diff to previous 1.314 (colored)

Add a kernel implementation of realpath() as __realpath().

We want this so that we can stop allowing readlink() on traversed
vnodes in unveil().

This includes all the kernel side and the system call.
This is not yet used in libc for realpath, so nothing calls this yet.
The libc wrapper will be committed later.

Testing by many, and ports build by naddy@

ok deraadt@

Revision 1.314 / (download) - annotate - [select for diffs], Sun Mar 24 18:14:20 2019 UTC (5 years, 2 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.313: +3 -3 lines
Diff to previous 1.313 (colored)

Make stat(2) and access(2) need UNVEIL_READ instead of UNVEIL_INSPECT

UNVEIL_INSPECT is a hack we added to get chrome/glib working. It silently
adds permission for stat(2), access(2), and readlink(2) to be used on
all path components of any unveil'ed path. robert@ has sucessfully now
fixed chrome/glib to not require exessive TOC vs TOU stat(2) and access(2)
calls on the paths it uses,  so that this no longer needed there.

 readlink(2) is the sole call that is now permitted by UNVEIL_INSPECT,
and this is only needed so that realpath(3) can work. Going forward we will
likely make a realpath(2), after which we can completely deprecate
UNVEIL_INSPECT.

ok deraadt@

Revision 1.307.2.1 / (download) - annotate - [select for diffs], Sun Jan 27 22:16:27 2019 UTC (5 years, 4 months ago) by bluhm
Branch: OPENBSD_6_4
Changes since 1.307: +10 -4 lines
Diff to previous 1.307 (colored) next main 1.308 (colored)

sometimes we don't call unveil_add, which means memory allocated by namei
doesn't get freed. move the free calls into the same function as namei.
fixed bug report from Dariusz Sendkowski
from tedu@; OK beck@

namei can return a null dvp on success. check this before access.
from tedu@; OK beck@
Reported-by: syzbot+cc59412ed8429450a1ae@syzkaller.appspotmail.com

OpenBSD 6.4 errata 013

Revision 1.313 / (download) - annotate - [select for diffs], Wed Jan 23 00:37:51 2019 UTC (5 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.312: +25 -15 lines
Diff to previous 1.312 (colored)

futimens(2), futimes(2), utimensat(2), utimes(2): Validate input at copyin

Currently we validate time input for all four of these syscalls in the
workhorse function dovutimens().  This is bad because both futimes(2)
and utimes(2) have input as timevals that need to be converted to
timespecs.  This multiplication can overflow to create a "valid"
input, e.g. if tv_usec is equal to 2^61 (invalid value) on a platform
with 64-bit longs, the resulting tv_nsec is equal to zero (valid value).

This is also a bit wasteful.  We aquire a vnode and do other work
under KERNEL_LOCK only to release the vnode when the time input is
invalid.

So, duplicate a bit of code to validate the time inputs before we do
any conversions or real VFS work.

probably still ok tedu@ deraadt@

Revision 1.312 / (download) - annotate - [select for diffs], Tue Jan 22 20:39:51 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.311: +4 -3 lines
Diff to previous 1.311 (colored)

namei can return a null dvp on success. check this before access.
ok beck

Reported-by: syzbot+cc59412ed8429450a1ae@syzkaller.appspotmail.com

Revision 1.311 / (download) - annotate - [select for diffs], Mon Jan 21 20:46:52 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.310: +7 -2 lines
Diff to previous 1.310 (colored)

sometimes we don't call unveil_add, which means memory allocated by namei
doesn't get freed. move the free calls into the same function as namei.
fixed bug report from Dariusz Sendkowski
ok beck

Revision 1.310 / (download) - annotate - [select for diffs], Thu Jan 3 21:52:31 2019 UTC (5 years, 5 months ago) by beck
Branch: MAIN
Changes since 1.309: +11 -5 lines
Diff to previous 1.309 (colored)

Fix a collection of covering unveil bugs that prevent unveil's of upper
level directories from working when you don't traverse into them starting
from /.  Most found by brynet@ and a few others.
ok brynet@ deraadt@

Revision 1.309 / (download) - annotate - [select for diffs], Sun Dec 23 10:46:51 2018 UTC (5 years, 5 months ago) by natano
Branch: MAIN
Changes since 1.308: +5 -7 lines
Diff to previous 1.308 (colored)

Rectify some issues with the noperm mount flag; the root vnode was not
protected properly and files without any x bit set were accidentaly considered
executable when checked with access(2).

Issues found and reported by deraadt, halex, reyk, tb
ok deraadt

Revision 1.308 / (download) - annotate - [select for diffs], Sun Oct 28 22:42:33 2018 UTC (5 years, 7 months ago) by beck
Branch: MAIN
Changes since 1.307: +16 -7 lines
Diff to previous 1.307 (colored)

Correctly deal with upper level unveil's by keeping track of the covering
unveil for each unveil in the process at unveil() time, and refactoring the
handling of current directory and ISDOTDOT to be much more sensible.
Worked out at ns2k18 with guenther@.
ok deraadt@

Revision 1.307 / (download) - annotate - [select for diffs], Wed Sep 26 14:51:44 2018 UTC (5 years, 8 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE
Branch point for: OPENBSD_6_4
Changes since 1.306: +5 -14 lines
Diff to previous 1.306 (colored)

Move the allocating and freeing of mount points into
dedicated functions.

OK deraadt@ mpi@

Revision 1.306 / (download) - annotate - [select for diffs], Sun Sep 16 11:41:44 2018 UTC (5 years, 8 months ago) by visa
Branch: MAIN
Changes since 1.305: +2 -6 lines
Diff to previous 1.305 (colored)

Move vfsconf lookup code into dedicated functions.

OK bluhm@

Revision 1.305 / (download) - annotate - [select for diffs], Sat Sep 1 17:02:12 2018 UTC (5 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.304: +2 -2 lines
Diff to previous 1.304 (colored)

Fix errno for post-lock unveil calls
from Jan Klemkow

Revision 1.304 / (download) - annotate - [select for diffs], Mon Aug 20 16:00:22 2018 UTC (5 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.303: +49 -91 lines
Diff to previous 1.303 (colored)

Reorder checks in the read/write(2) family of syscalls to prepare making
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@

Revision 1.303 / (download) - annotate - [select for diffs], Mon Aug 13 20:36:35 2018 UTC (5 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.302: +3 -3 lines
Diff to previous 1.302 (colored)

in sys_statfs(), BYPASSUNVEIL can be passed to NDINIT in the "flags"
argument, rather than manually |= afterwards.  Observed by semarie

Revision 1.302 / (download) - annotate - [select for diffs], Sat Aug 11 16:16:07 2018 UTC (5 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.301: +7 -7 lines
Diff to previous 1.301 (colored)


Get rid of PLEDGE_STAT, which was a hack used for unveil.
We use UNVEIL_INSPECT instead in the unveil flags for the same
purpose, and now add traversed vnodes of a path with UNVEIL_INSPECT
instead of with 0 flags and voodoo in unveil_flagmatch. This
allows us to uncontort the logic of unveil_flagmatch a bunch.
helpful review and ok from semarie@

Revision 1.301 / (download) - annotate - [select for diffs], Sun Aug 5 14:23:57 2018 UTC (5 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.300: +33 -4 lines
Diff to previous 1.300 (colored)

Decouple unveil from the pledge flags, by adding dedicated unveil flags
to the namei args. This fixes a bug where chmod would be allowed when
with only READ. This also allows some further cleanup of some awkward
things like PLEDGE_STAT that will follow
Lots of assistence from semarie@ - thanks!
ok semarie@

Revision 1.300 / (download) - annotate - [select for diffs], Fri Aug 3 02:36:11 2018 UTC (5 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.299: +2 -2 lines
Diff to previous 1.299 (colored)

ni_pledge flags are a uint64_t not an int - don't initialize with an int.

Revision 1.299 / (download) - annotate - [select for diffs], Mon Jul 30 17:21:37 2018 UTC (5 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.298: +2 -2 lines
Diff to previous 1.298 (colored)

Fix a NULL-pointer dereference when calling open() on a cloned device with write
permissions and the flags include O_TRUNC|O_SHLOCK.

ok deraadt@

Revision 1.298 / (download) - annotate - [select for diffs], Mon Jul 30 15:16:27 2018 UTC (5 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.297: +8 -7 lines
Diff to previous 1.297 (colored)

rename 2nd argument of unveil from vague "flags" to "permissions";
man page change will follow

Revision 1.297 / (download) - annotate - [select for diffs], Mon Jul 30 00:11:04 2018 UTC (5 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.296: +1 -4 lines
Diff to previous 1.296 (colored)

activate unveil for testing
ok kibbles and bits

Revision 1.296 / (download) - annotate - [select for diffs], Fri Jul 27 01:44:19 2018 UTC (5 years, 10 months ago) by beck
Branch: MAIN
Changes since 1.295: +2 -2 lines
Diff to previous 1.295 (colored)

Don't double vput and panic after looking up "."

Revision 1.295 / (download) - annotate - [select for diffs], Sun Jul 22 06:31:17 2018 UTC (5 years, 10 months ago) by anton
Branch: MAIN
Changes since 1.294: +4 -3 lines
Diff to previous 1.294 (colored)

Avoid a NULL pointer deref when calling fchown() on a file descriptor belonging
to a cloned device.

ok kettenis@

Revision 1.294 / (download) - annotate - [select for diffs], Fri Jul 13 09:36:00 2018 UTC (5 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.293: +3 -3 lines
Diff to previous 1.293 (colored)

Make the default failure for unveil while disabled return success
so that people don't get screwed when playing with it on their
machines

Revision 1.293 / (download) - annotate - [select for diffs], Fri Jul 13 09:25:23 2018 UTC (5 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.292: +99 -9 lines
Diff to previous 1.292 (colored)

Unveiling unveil(2).
This brings unveil into the tree, disabled by default - Currently
this will return EPERM on all attempts to use it until we are
fully certain it is ready for people to start using, but this
now allows for others to do more tweaking and experimentation.

Still needs to send the unveil's across forks and execs before
fully enabling.

Many thanks to robert@ and deraadt@ for extensive testing.
ok deraadt@

Revision 1.292 / (download) - annotate - [select for diffs], Tue Jul 3 20:40:25 2018 UTC (5 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.291: +9 -36 lines
Diff to previous 1.291 (colored)

Add a new so_seek member to "struct file" such that we can have seekable
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@

Revision 1.291 / (download) - annotate - [select for diffs], Mon Jun 25 16:06:27 2018 UTC (5 years, 11 months ago) by visa
Branch: MAIN
Changes since 1.290: +7 -1 lines
Diff to previous 1.290 (colored)

During open(2), release the fdp lock before calling vn_open(9).
This lets other threads of the process modify the file descriptor
table even if the vn_open(9) call blocks.

The change has an effect on dup2(2) and dup3(2). If the new descriptor
is the same as the one reserved by an unfinished open(2), the system
call will fail with error EBUSY. The accept(2) system call already
behaves like this.

Issue pointed out by art@ via mpi@

Tested in a bulk build by ajacoutot@
OK mpi@

Revision 1.290 / (download) - annotate - [select for diffs], Mon Jun 18 09:15:05 2018 UTC (5 years, 11 months ago) by mpi
Branch: MAIN
Changes since 1.289: +13 -11 lines
Diff to previous 1.289 (colored)

Put file descriptors on shared data structures when they are completely
setup, take 3.

LARVAL fd still exist, but they are no longer marked with a flag and no
longer reachable via `fd_ofiles[]' or the global linked list.  This allows
us to simplifies a lot code grabbing new references to fds.

All of this is now possible because dup2(2) refuses to clone LARVAL fds.

Note that the `fdplock' could now be release in all open(2)-like syscalls,
just like it is done in accept(2).

With inputs from Mathieu Masson, visa@, guenther@ and art@

Previous version ok bluhm@, ok visa@, sthen@

Revision 1.289 / (download) - annotate - [select for diffs], Thu Jun 14 00:23:36 2018 UTC (5 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.288: +8 -9 lines
Diff to previous 1.288 (colored)

In dounlinkat() only perform the check for a mounted directory when
actually removing a directory.  Fixes a problem where removing
device special files could result in EBUSY.  OK guenther@

Revision 1.288 / (download) - annotate - [select for diffs], Wed Jun 13 14:57:24 2018 UTC (5 years, 11 months ago) by visa
Branch: MAIN
Changes since 1.287: +9 -1 lines
Diff to previous 1.287 (colored)

Make the VFS layer responsible for preventing the deletion
of mounted on directories.

OK guenther@, mpi@

Revision 1.287 / (download) - annotate - [select for diffs], Thu Jun 7 13:37:27 2018 UTC (6 years ago) by visa
Branch: MAIN
Changes since 1.286: +2 -1 lines
Diff to previous 1.286 (colored)

Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible for
unlocking the directory vnode.

OK mpi@, helg@

Revision 1.286 / (download) - annotate - [select for diffs], Tue Jun 5 09:29:05 2018 UTC (6 years ago) by mpi
Branch: MAIN
Changes since 1.285: +11 -13 lines
Diff to previous 1.285 (colored)

Revert introduction of fdinsert(), a sanitify check triggers when
closing a LARVAL file.

Found the hardway by sthen@.

Revision 1.285 / (download) - annotate - [select for diffs], Mon Jun 4 04:57:09 2018 UTC (6 years ago) by guenther
Branch: MAIN
Changes since 1.284: +3 -3 lines
Diff to previous 1.284 (colored)

Add VB_DUPOK to suppress witness(4) warning of concurrent mount locks.
Use that in three places:
 - vfs_stall()
 - sys_mount()
 - dounmount()'s MNT_FORCE-does-recursive-unmounts case

ok deraadt@ visa@

Revision 1.284 / (download) - annotate - [select for diffs], Sat Jun 2 10:27:43 2018 UTC (6 years ago) by mpi
Branch: MAIN
Changes since 1.283: +13 -11 lines
Diff to previous 1.283 (colored)

Put file descriptors on shared data structures when they are completely
setup.

LARVAL fd still exist, but they are no longer marked with a flag and no
longer reachable via `fd_ofiles[]'.  This allows us to simplifies a lot
code grabbing new references to fds.

All of this is now possible because dup2(2) refuses to clone LARVAL fds.

Note that the `fdplock' could now be release in all open(2)-like syscalls,
just like it is done in accept(2).

With inputs from Mathieu -, visa@, guenther@ and art@

ok visa@, bluhm@

Revision 1.283 / (download) - annotate - [select for diffs], Tue May 8 08:53:41 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.282: +3 -1 lines
Diff to previous 1.282 (colored)

Protect per-file counters and document which lock is used to protect
the other fields.

Once we no longer have any [k] (kernel lock) protections, we'll be
able to unlock almost all network related syscalls.

Inputs from and ok bluhm@, visa@

Revision 1.282 / (download) - annotate - [select for diffs], Wed May 2 02:24:56 2018 UTC (6 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.281: +15 -15 lines
Diff to previous 1.281 (colored)

Remove proc from the parameters of vn_lock(). The parameter is
unnecessary because curproc always does the locking.

OK mpi@

Revision 1.281 / (download) - annotate - [select for diffs], Sat Apr 28 03:13:05 2018 UTC (6 years, 1 month ago) by visa
Branch: MAIN
Changes since 1.280: +14 -14 lines
Diff to previous 1.280 (colored)

Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is always
curproc that does the locking or unlocking, so the proc parameter
is pointless and can be dropped.

OK mpi@, deraadt@

Revision 1.280 / (download) - annotate - [select for diffs], Fri Apr 27 10:13:37 2018 UTC (6 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.279: +1 -8 lines
Diff to previous 1.279 (colored)

Move FREF() inside fd_getfile().

ok visa@

Revision 1.279 / (download) - annotate - [select for diffs], Tue Apr 3 09:10:02 2018 UTC (6 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.278: +13 -9 lines
Diff to previous 1.278 (colored)

Move FREF()s just after fd_getfile() in sys_kevent(), sys_lseek() and
getvnode().

ok millert@

Revision 1.278 / (download) - annotate - [select for diffs], Tue Apr 3 09:07:54 2018 UTC (6 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.277: +6 -2 lines
Diff to previous 1.277 (colored)

Add proper FREF()/FRELE() dance in sys_fchdir().

The syscall doesn't sleep before a vnode reference is taken, so it
doesn't stickly need the refcounts now.  But they will be soon be
used for parrallelism, so make it ready.

ok bluhm@

Revision 1.277 / (download) - annotate - [select for diffs], Wed Mar 28 09:47:52 2018 UTC (6 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.276: +27 -19 lines
Diff to previous 1.276 (colored)

Call FREF() right after fd_getfile*() in pread(), prwrite() & co.

This ensure that all operations manipulating a 'struct file *' do so
with a properly refcounted element.

ok visa@, tedu@, bluhm@

Revision 1.276 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.275: +16 -16 lines
Diff to previous 1.275 (colored)

Remove almost unused `flags' argument of suser().

The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.

No objection from millert@, ok tedu@, bluhm@

Revision 1.275 / (download) - annotate - [select for diffs], Sat Feb 10 05:24:23 2018 UTC (6 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.274: +3 -3 lines
Diff to previous 1.274 (colored)

Syncronize filesystems to disk when suspending.  Each mountpoint's vnodes
are pushed to disk.  Dangling vnodes (unlinked files still in use) and
vnodes undergoing change by long-running syscalls are identified -- and
such filesystems are marked dirty on-disk while we are suspended (in case
power is lost, a fsck will be required).  Filesystems without dangling or
busy vnodes are marked clean, resulting in faster boots following
"battery died" circumstances.
Tested by numerous developers, thanks for the feedback.

Revision 1.274 / (download) - annotate - [select for diffs], Tue Jan 2 06:38:45 2018 UTC (6 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.273: +2 -1 lines
Diff to previous 1.273 (colored)

Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.

ok millert@ sthen@

Revision 1.273 / (download) - annotate - [select for diffs], Mon Dec 11 05:27:40 2017 UTC (6 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.272: +38 -14 lines
Diff to previous 1.272 (colored)

In uvm Chuck decided backing store would not be allocated proactively
for blocks re-fetchable from the filesystem.  However at reboot time,
filesystems are unmounted, and since processes lack backing store they
are killed. Since the scheduler is still running, in some cases init is
killed... which drops us to ddb [noted by bluhm].  Solution is to convert
filesystems to read-only [proposed by kettenis]. The tale follows:
sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which
completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT()
with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a
copyin() late... so store the sizes in vfsconflist[] and move the copyin()
to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill
legacy struct nfs_args3.  Next we learn ffs_mount()'s MNT_UPDATE code is
sharp and rusty especially wrt softdep, so fix some bugs adn add
~MNT_SOFTDEP to the downgrade.  Some vnodes need a little more help,
so tie them to &dead_vnops.

ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but
this issue is seperate and will be dealt with in time.
couple hundred reboots by bluhm and myself, advice from guenther and
others at the hut

Revision 1.272 / (download) - annotate - [select for diffs], Sat Apr 15 13:56:43 2017 UTC (7 years, 1 month ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.271: +84 -1 lines
Diff to previous 1.271 (colored)

After forced unmount of a file system that has other mount points
in it, dangling mounts could remain.  When unmounting check the
hierarcy and unmount recursively.  Also prevent that a new mount
appears during the scan.
Joint work with natano@; testing and OK krw@

Revision 1.271 / (download) - annotate - [select for diffs], Wed Feb 15 03:36:58 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.270: +5 -5 lines
Diff to previous 1.270 (colored)

Threads share filedesc, so we can walk allprocess instead of allproc

ok mpi@ millert@

Revision 1.270 / (download) - annotate - [select for diffs], Sat Feb 11 19:51:06 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
Changes since 1.269: +5 -8 lines
Diff to previous 1.269 (colored)

Add a flags argument to falloc() that lets it optionally set the
close-on-exec flag on the newly allocated fd.  Make falloc()'s
return arguments non-optional: assert that they're not NULL.

ok mpi@ millert@

Revision 1.269 / (download) - annotate - [select for diffs], Mon Jan 23 22:34:10 2017 UTC (7 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.268: +2 -2 lines
Diff to previous 1.268 (colored)

Avoid curproc dance in dupfdopen(), by passing a struct proc *
ok guenther mpi

Revision 1.268 / (download) - annotate - [select for diffs], Sun Jan 15 23:18:05 2017 UTC (7 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.267: +5 -5 lines
Diff to previous 1.267 (colored)

When traversing the mount list, the current mount point is locked
with vfs_busy().  If the FOREACH_SAFE macro is used, the next pointer
is not locked and could be freed by another process.  Unless
necessary, do not use _SAFE as it is unsafe.  In vfs_unmountall()
the current pointer is actullay freed.  Add a comment that this
race has to be fixed later.
OK krw@

Revision 1.267 / (download) - annotate - [select for diffs], Tue Jan 10 20:13:17 2017 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.266: +15 -16 lines
Diff to previous 1.266 (colored)

Fix white spaces.  No binary change.

Revision 1.266 / (download) - annotate - [select for diffs], Tue Jan 10 19:48:32 2017 UTC (7 years, 5 months ago) by bluhm
Branch: MAIN
Changes since 1.265: +3 -3 lines
Diff to previous 1.265 (colored)

Remove the unused olddp parameter from function dounmount().
OK mpi@ millert@

Revision 1.265 / (download) - annotate - [select for diffs], Sat Sep 10 16:53:30 2016 UTC (7 years, 9 months ago) by natano
Branch: MAIN
Changes since 1.264: +25 -9 lines
Diff to previous 1.264 (colored)

Add a noperm mount flag for FFS to be used for building release sets
without root privileges. This is only the kernel/mount flag; additional
work in the build Makefile's will be necessary such that the files in
$DESTDIR are created with correct permissions.

tedu couldn't find anything wrong with it in a quick review
idea & ok deraadt

Revision 1.264 / (download) - annotate - [select for diffs], Wed Sep 7 17:30:12 2016 UTC (7 years, 9 months ago) by natano
Branch: MAIN
Changes since 1.263: +4 -59 lines
Diff to previous 1.263 (colored)

Remove usermount remnants. ok tedu

Revision 1.263 / (download) - annotate - [select for diffs], Thu Jul 14 15:39:40 2016 UTC (7 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.262: +2 -3 lines
Diff to previous 1.262 (colored)

kern.usermount=1 is unsafe for everyone, since it allows any non-pledged
program to call the mount/umount system calls.  There is no way any user
can be expected to keep their system safe / reliable with this feature.
Ignore setting to =1, and after release we'll delete the sysctl entirely.
ok lots of people

Revision 1.262 / (download) - annotate - [select for diffs], Tue Jul 12 20:53:04 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.261: +2 -2 lines
Diff to previous 1.261 (colored)

The only valid flag for unmount(2) is MNT_FORCE, ignore any others.
Fixes a crash when MNT_DOOMED is passed in the flags to unmount(2)
found by NCC Group.  OK bluhm@

Revision 1.261 / (download) - annotate - [select for diffs], Wed Jul 6 19:26:35 2016 UTC (7 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.260: +3 -1 lines
Diff to previous 1.260 (colored)

Return EINVAL for mknod/mknodat when dev is -1 (aka VNOVAL).
OK beck@ tedu@

Revision 1.260 / (download) - annotate - [select for diffs], Sun Jul 3 04:36:08 2016 UTC (7 years, 11 months ago) by semarie
Branch: MAIN
Changes since 1.259: +3 -3 lines
Diff to previous 1.259 (colored)

introduces new promise "chown" to allow changing owner/group with *chown(2) family

it splits PLEDGE_FATTR in two ("fattr" stills grant the 2 flags, so no functional changes):
  - PLEDGE_CHOWN : to be able to call *chown(2) syscalls
  - PLEDGE_FATTR : the rest

it introduces "chown" which grant:
  - PLEDGE_CHOWN : be able to call *chown(2)
  - PLEDGE_CHOWNUID : be able to modifying owner/group

ok deraadt@ tedu@

Revision 1.259 / (download) - annotate - [select for diffs], Mon Jun 27 04:26:41 2016 UTC (7 years, 11 months ago) by semarie
Branch: MAIN
Changes since 1.258: +7 -3 lines
Diff to previous 1.258 (colored)

dovutimens: call vrele(9) before returning EINVAL

ok guenther@

Revision 1.258 / (download) - annotate - [select for diffs], Mon Jun 27 04:14:38 2016 UTC (7 years, 11 months ago) by semarie
Branch: MAIN
Changes since 1.257: +5 -3 lines
Diff to previous 1.257 (colored)

sys_revoke: call vrele() before returning ENOTTY

ok guenther@

Revision 1.257 / (download) - annotate - [select for diffs], Sun Jun 26 14:27:14 2016 UTC (7 years, 11 months ago) by semarie
Branch: MAIN
Changes since 1.256: +3 -2 lines
Diff to previous 1.256 (colored)

use error code path instead of return early without calling VOP_ABORTOP() and
vrele()/vput().

ok deraadt@

Revision 1.256 / (download) - annotate - [select for diffs], Wed Jun 1 22:54:45 2016 UTC (8 years ago) by millert
Branch: MAIN
Changes since 1.255: +2 -2 lines
Diff to previous 1.255 (colored)

rmdir(2) should return EINVAL not EBUSY when trying to remove ".".
This brings us back in conformance with POSIX rmdir(2) and rmdirat(2).
OK kettenis@

Revision 1.255 / (download) - annotate - [select for diffs], Fri May 27 19:45:04 2016 UTC (8 years ago) by deraadt
Branch: MAIN
Changes since 1.254: +3 -3 lines
Diff to previous 1.254 (colored)

W^X violations are no longer permitted by default.  A kernel log message
is generated, and mprotect/mmap return ENOTSUP.  If the sysctl(8) flag
kern.wxabort is set then a SIGABRT occurs instead, for gdb use or coredump
creation.

W^X violating programs can be permitted on a ffs/nfs filesystem-basis,
using the "wxallowed" mount option.  One day far in the future
upstream software developers will understand that W^X violations are a
tremendously risky practice and that style of programming will be
banished outright.  Until then, we recommend most users need to use the
wxallowed option on their /usr/local filesystem.  At least your other
filesystems don't permit such programs.

ok jca kettenis mlarkin natano

Revision 1.254 / (download) - annotate - [select for diffs], Sun May 15 05:04:28 2016 UTC (8 years ago) by semarie
Branch: MAIN
Changes since 1.253: +1 -2 lines
Diff to previous 1.253 (colored)

remove chroot(2) from allowed syscalls under pledge(2).

please note that chrooted process are still possible with pledge(2), but only
if the chroot(2) is done *before* calling pledge(2). Once pledged, no more
chroot(2) call are permitted.

Revision 1.253 / (download) - annotate - [select for diffs], Sun Mar 27 11:39:37 2016 UTC (8 years, 2 months ago) by bluhm
Branch: MAIN
Changes since 1.252: +2 -2 lines
Diff to previous 1.252 (colored)

When pulling and unmounting an umass USB stick, the file system
could end up in an inconsistent state.  The fstype dependent
mp->mnt_data was NULL, but the general mp was still listed as a
valid mount point.  Next access to the file system would crash with
a NULL pointer dereference.
If closing the device fails, the mount point must go away anyway.
There is nothing we can do about it.  Remove the workaround for the
EIO error in the general unmount code, but do not generate any error
in the file system specific unmount functions.
OK natano@ beck@

Revision 1.252 / (download) - annotate - [select for diffs], Sat Mar 19 12:04:15 2016 UTC (8 years, 2 months ago) by natano
Branch: MAIN
Changes since 1.251: +14 -14 lines
Diff to previous 1.251 (colored)

Remove the unused flags argument from VOP_UNLOCK().

torture tested on amd64, i386 and macppc
ok beck mpi stefan
"the change looks right" deraadt

Revision 1.251 / (download) - annotate - [select for diffs], Wed Jan 6 17:59:30 2016 UTC (8 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.250: +13 -13 lines
Diff to previous 1.250 (colored)

remove unnecessary casts where the incoming type is void *.

Revision 1.250 / (download) - annotate - [select for diffs], Sat Jan 2 00:24:16 2016 UTC (8 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.249: +9 -16 lines
Diff to previous 1.249 (colored)

mmcc noticed that nd.ni_pledge was uninitialized in doopenat() for the
oflags & 3 == 3 case. Therefore this depends on vn_open() blocking the
operation later.  Probably this meant the ni_pledge request would be too
high, causing transient operation failure, rather than transient operation
passage).  Instead of initializing based on the oflags value use the
result of FFLAGS().  I should have done this from the start.
ok semarie
[oflags & 3 == 3 is major dejavu for me]

Revision 1.249 / (download) - annotate - [select for diffs], Wed Dec 16 15:52:51 2015 UTC (8 years, 5 months ago) by semarie
Branch: MAIN
Changes since 1.248: +3 -1 lines
Diff to previous 1.248 (colored)

in pledged process, setuid/setgid/sticky bits should be ignored.

enforce it for open(2) when used with O_CREAT and mode.

ok deraadt@

Revision 1.248 / (download) - annotate - [select for diffs], Wed Dec 16 08:27:32 2015 UTC (8 years, 5 months ago) by semarie
Branch: MAIN
Changes since 1.247: +3 -1 lines
Diff to previous 1.247 (colored)

in pledged process, setuid/setgid/sticky bits should be ignored.

enforce it for mkfifo(2) and mknod(2) (with "dpath" promise).

ok deraadt@

Revision 1.247 / (download) - annotate - [select for diffs], Sat Dec 5 10:11:53 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.246: +1 -35 lines
Diff to previous 1.246 (colored)

remove stale lint annotations

Revision 1.246 / (download) - annotate - [select for diffs], Fri Dec 4 07:33:05 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.245: +2 -1 lines
Diff to previous 1.245 (colored)

Add pledge "dpath", which provides access to mknod(2) and mkfifo(2).
This will be required to keep pax/tar/cpio at otherwise very high levels
of pledge (and we will see where else it is beneficial).
Allocate a bit for pledge "audio", which will be coming soon.
good discussions with semarie

Revision 1.245 / (download) - annotate - [select for diffs], Fri Nov 20 07:11:52 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.244: +6 -5 lines
Diff to previous 1.244 (colored)

VISTTY check in revoke() is not working well for the non-indirected
/dev/console case, so go back to doing the direct D_TTY check.
signed over a few times with guenther

Revision 1.244 / (download) - annotate - [select for diffs], Fri Nov 20 06:29:56 2015 UTC (8 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.243: +9 -9 lines
Diff to previous 1.243 (colored)

Fix whitespace.  No binary change.

Revision 1.243 / (download) - annotate - [select for diffs], Wed Nov 18 06:57:24 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.242: +5 -3 lines
Diff to previous 1.242 (colored)

In sys_revoke, inspect the VISTTY flag on the backside of VOP_GETATTR,
because that shows the /dev/console translated vnode.
You either already know the story, or you don't want to know.

Revision 1.242 / (download) - annotate - [select for diffs], Mon Nov 16 18:29:35 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.241: +1 -0 lines
Diff to previous 1.241 (colored)

Permit revoke(2) for a pledge "rpath tty"
ok millert semarie tedu guenther

Revision 1.241 / (download) - annotate - [select for diffs], Mon Nov 16 18:25:18 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.240: +3 -1 lines
Diff to previous 1.240 (colored)

Only perform revoke(2) on tty cdevs.  Others paths return ENOTTY.
ok millert semarie tedu guenther

Revision 1.240 / (download) - annotate - [select for diffs], Sat Nov 14 22:23:22 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.239: +2 -1 lines
Diff to previous 1.239 (colored)

Add pathconf() to pledge "rpath"; ok guenther

Revision 1.239 / (download) - annotate - [select for diffs], Mon Nov 2 16:31:55 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.238: +27 -26 lines
Diff to previous 1.238 (colored)

move the pledgenote annotation from `struct proc' to `struct nameidata'

pledgenote is used for annotate the policy for a namei context. So make it
tracking the nameidata.

It is expected for the caller to explicitly define the policy. It is a kernel
bug to not do so.

ok deraadt@

Revision 1.238 / (download) - annotate - [select for diffs], Sun Nov 1 19:03:33 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.237: +5 -5 lines
Diff to previous 1.237 (colored)

refactor pledge_*_check and pledge_fail functions

- rename _check function without suffix: a "pledge" function called from
  anywhere is a "check" function.

- makes pledge_fail call the responsability to the _check function. remove it
  from caller.

- make proper use of (potential) returned error of _check() functions.

- adds pledge_kill() and pledge_protexec()

with and OK deraadt@

Revision 1.237 / (download) - annotate - [select for diffs], Wed Oct 28 18:41:16 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.236: +2 -2 lines
Diff to previous 1.236 (colored)

mkdir is PLEDGE_CPATH, not PLEDGE_CPATH | PLEDGE_RPATH...
ok semarie

Revision 1.236 / (download) - annotate - [select for diffs], Wed Oct 28 14:17:52 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.235: +1 -4 lines
Diff to previous 1.235 (colored)

remove duplicate setting of p_pledgenote:

- in sys_access() which call dofaccessat() and where the same note is already setted
- in sys_mkdir() which call domkdirat() and where the same note is already setted
- in sys_rmdir() which call dounlinkat() and where the same note is already setted

it makes the p_pledgenote affectation be near NDINIT/NDINITAT call.

Revision 1.235 / (download) - annotate - [select for diffs], Wed Oct 28 14:07:58 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.234: +2 -2 lines
Diff to previous 1.234 (colored)

make sys_chroot() only allowed to be used when pledged, with "rpath id proc".

the previous check in pledge_namei() was incomplete. For using SYS_chroot we
needed "id", and we could have passed pledge_namei() just with "rpath" (without
using the now removed whitelisted entry).

the check for "rpath id proc" is now done using p_pledgenote: pledge_namei()
will check that the pledgenote is permitted by your pledge.

"go ahead" deraadt@

Revision 1.234 / (download) - annotate - [select for diffs], Wed Oct 28 11:18:58 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.233: +3 -1 lines
Diff to previous 1.233 (colored)

Set pledgenote to PLEDGE_RPATH in chdir & chroot
noticed by semarie

Revision 1.233 / (download) - annotate - [select for diffs], Sun Oct 25 20:39:54 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.232: +27 -27 lines
Diff to previous 1.232 (colored)

Fold "malloc" into "stdio" and -- recognizing that no program so far has
used less than "stdio" -- include all the "self" operations.  Instead of
different defines, use regular PLEDGE_* in the "p_pledgenote" variable
(which indicates the operation subtype a system call is performing).  Many
checks before easier to understand.  p_pledgenote can often be passed
directly to ktrace, so that kdump says:
 15565 test     CALL  pledge(0xa9a3f804c51,0)
 15565 test     STRU  pledge request="stdio"
 15565 test     RET   pledge 0
 15565 test     CALL  open(0xa9a3f804c57,0x2<O_RDWR>)
 15565 test     NAMI  "/tmp/testfile"
 15565 test     PLDG  open, "wpath", errno 1 Operation not permitted
with help from semarie, ok guenther

Revision 1.232 / (download) - annotate - [select for diffs], Tue Oct 20 06:40:00 2015 UTC (8 years, 7 months ago) by semarie
Branch: MAIN
Changes since 1.231: +11 -1 lines
Diff to previous 1.231 (colored)

clear whitelisted-paths view in pledge.

the following diff adds a clear view of whitelisted-paths in pledge.

before, whitelisting "/usr/local/bin" path would make only "/usr/local/bin"
VNODE was present and let "/usr/local", "/usr", and "/" been ENOENT. It was a
somehow odd filesystem hierarchy, and it breaks realpath(3).

with this diff, the directories that are one of the parents of a
whitelisted-directory become visible to stat(2) related syscalls, but only
with restricted permissions: stat(2) will lie a bit, and saying they owned by
root:wheel and mode is --x--x--x. Note that only stat(2) is affected by this
"view", and the owner/mode aren't effectively changed: it is just a "lie".

while here, refactor a bit pledge_namei() in order to avoid multiple for-loop
on whitelisted-path array.

ok deraadt@

Revision 1.231 / (download) - annotate - [select for diffs], Fri Oct 16 13:37:43 2015 UTC (8 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.230: +7 -1 lines
Diff to previous 1.230 (colored)

Implement real "flock" request and add it to userland programs that
use pledge and file locking.  OK deraadt@

Revision 1.230 / (download) - annotate - [select for diffs], Wed Oct 14 14:24:03 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.229: +5 -16 lines
Diff to previous 1.229 (colored)

When pledged with "fattr", allow chown to supplimentary groups.  This
came out of a discussion regarding "sort foo -o foo".
ok semarie

Revision 1.229 / (download) - annotate - [select for diffs], Fri Oct 9 01:10:27 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.228: +31 -31 lines
Diff to previous 1.228 (colored)

Rename tame() to pledge().  This fairly interface has evolved to be more
strict than anticipated.  It allows a programmer to pledge/promise/covenant
that their program will operate within an easily defined subset of the
Unix environment, or it pays the price.

Revision 1.228 / (download) - annotate - [select for diffs], Tue Oct 6 14:39:07 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.227: +2 -2 lines
Diff to previous 1.227 (colored)

rmdir() is just a CPATH operation; remove RPATH marker that snuck in.

Revision 1.227 / (download) - annotate - [select for diffs], Mon Aug 31 16:13:11 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.226: +22 -4 lines
Diff to previous 1.226 (colored)

In tame mode, return EPERM for *chown if uid/gid change is not towards
cr_uid/cr_gid (effective ids).  Thus, chown(, -1,-1) should work OK, so
should chown(, me, -1), etc.  With this commited, more people can test.

Revision 1.226 / (download) - annotate - [select for diffs], Mon Aug 31 16:07:12 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.225: +5 -7 lines
Diff to previous 1.225 (colored)

Rather than killing when *chmod is asked to do setuid/setgid, clear
those bits in the request and continue.  This is a better posix-subset
to give to programs.

Revision 1.225 / (download) - annotate - [select for diffs], Mon Aug 31 00:45:09 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.224: +3 -5 lines
Diff to previous 1.224 (colored)

KNF

Revision 1.224 / (download) - annotate - [select for diffs], Sun Aug 30 05:38:38 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.223: +2 -2 lines
Diff to previous 1.223 (colored)

For *chmod, allow S_ISTXT in tame mode.  I am evaluating what to
do about S_ISUID and SISGID... maybe we should mask them and allow
the operation to happen?

Revision 1.223 / (download) - annotate - [select for diffs], Sat Aug 22 20:18:50 2015 UTC (8 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.222: +42 -23 lines
Diff to previous 1.222 (colored)

Move to tame(int flags, char *paths[]) API/ABI.

The pathlist is a whitelist of dirs and files; anything else returns ENOENT.
Recommendation is to use a narrowly defined list.  Also add TAME_FATTR, which
permits explicit change operations against "struct stat" fields.  Some
other TAME_ flags are refined slightly.

Not cranking libc now, since nothing commited in base uses this and the
timing is uncomfortable for others.  Discussed with many; thanks for a
few bug fixes from semarie, doug, guenther.
ok guenther

Revision 1.222 / (download) - annotate - [select for diffs], Mon Jul 20 21:31:57 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.221: +10 -11 lines
Diff to previous 1.221 (colored)

Move the construction of p_tamenote from sys_open() to doopenat(), so that
it also applies to sys_openat().

Revision 1.221 / (download) - annotate - [select for diffs], Sun Jul 19 02:35:35 2015 UTC (8 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.220: +26 -1 lines
Diff to previous 1.220 (colored)

tame(2) is a subsystem which restricts programs into a "reduced feature
operating model".  This is the kernel component; various changes should
proceed in-tree for a while before userland programs start using it.
ok miod, discussions and help from many

Revision 1.220 / (download) - annotate - [select for diffs], Thu May 7 08:53:33 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.219: +11 -11 lines
Diff to previous 1.219 (colored)

Pass a thread pointer instead of its file descriptor table to getvnode(9).

Input and ok millert@

Revision 1.219 / (download) - annotate - [select for diffs], Thu Apr 30 09:20:51 2015 UTC (9 years, 1 month ago) by mpi
Branch: MAIN
Changes since 1.218: +5 -13 lines
Diff to previous 1.218 (colored)

Indroduce fd_getfile_mode() and use it were fd_getfile() is directly
followed by a mode check.  This will simplify the ref/unref dance as
soon as fd_getfile() will increment fp's reference counter.

Idea from and ok guenther@, ok millert@

Revision 1.218 / (download) - annotate - [select for diffs], Fri Apr 17 04:43:20 2015 UTC (9 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.217: +16 -19 lines
Diff to previous 1.217 (colored)

Tweaks utimensat/futimens handling to always update ctime, even when both
atime and mtime are UTIME_OMIT (at least for ufs, tmpfs, and ext2fs), and
to correctly handle a timestamp of -1.

ok millert@

Revision 1.217 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:51 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.216: +1 -2 lines
Diff to previous 1.216 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.216 / (download) - annotate - [select for diffs], Tue Dec 16 18:30:04 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.215: +2 -1 lines
Diff to previous 1.215 (colored)

primary change: move uvm_vnode out of vnode, keeping only a pointer.
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

Revision 1.215 / (download) - annotate - [select for diffs], Mon Dec 8 20:56:11 2014 UTC (9 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.214: +46 -36 lines
Diff to previous 1.214 (colored)

Add chflagsat(), modeled on fchmodat() with name to match FreeBSD.

Revision 1.214 / (download) - annotate - [select for diffs], Fri Nov 14 23:26:48 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.213: +4 -5 lines
Diff to previous 1.213 (colored)

prefer sizeof(*ptr) to sizeof(struct) for malloc and free

Revision 1.213 / (download) - annotate - [select for diffs], Mon Nov 3 21:28:35 2014 UTC (9 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.212: +2 -1 lines
Diff to previous 1.212 (colored)

include sys/unistd.h where needed instead of indirect reliance. ok jsg

Revision 1.212 / (download) - annotate - [select for diffs], Mon Nov 3 03:08:00 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.211: +3 -3 lines
Diff to previous 1.211 (colored)

pass size argument to free()
ok doug tedu

Revision 1.211 / (download) - annotate - [select for diffs], Wed Oct 22 21:43:16 2014 UTC (9 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.210: +22 -41 lines
Diff to previous 1.210 (colored)

Extend domknodat() to support S_IFIFO directly and remove domkfifoat().
Both sys_mkfifo(2) and sys_mkfifoat(2) could be replace by libc wrappers
using mknodat(2) at a later date if we desire.  OK guenther@

Revision 1.210 / (download) - annotate - [select for diffs], Mon Oct 13 15:23:34 2014 UTC (9 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.209: +3 -1 lines
Diff to previous 1.209 (colored)

POSIX says that mknod(2) should support fifos.  OK guenther@

Revision 1.209 / (download) - annotate - [select for diffs], Thu Sep 18 02:15:04 2014 UTC (9 years, 8 months ago) by uebayasi
Branch: MAIN
Changes since 1.208: +3 -3 lines
Diff to previous 1.208 (colored)

Correct argument name (int flags -> int amode) in sys_access().

OK guenther@

Revision 1.208 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.207: +3 -3 lines
Diff to previous 1.207 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.207 / (download) - annotate - [select for diffs], Tue Jul 8 17:19:25 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.206: +2 -4 lines
Diff to previous 1.206 (colored)

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis

Revision 1.206 / (download) - annotate - [select for diffs], Sun May 25 18:46:44 2014 UTC (10 years ago) by guenther
Branch: MAIN
Changes since 1.205: +25 -15 lines
Diff to previous 1.205 (colored)

In access(), use the real UID/GID for the path search too.

ok matthew@

Revision 1.205 / (download) - annotate - [select for diffs], Sat Apr 12 14:18:11 2014 UTC (10 years, 2 months ago) by espie
Branch: MAIN
Changes since 1.204: +6 -19 lines
Diff to previous 1.204 (colored)

revert falloc change, as it causes all new processes to get stuck after a while
(race condition ?)

problem noticed by me, aja, sthen, brynet, rpe.

vanishing after this revert, okay aja@, sthen@

tedu, you probably want to look into re-checking the fcreate/fpublish addition
first, then if it's stable, see about tweaking doopenat ?

Revision 1.204 / (download) - annotate - [select for diffs], Sun Mar 30 21:54:48 2014 UTC (10 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.203: +3 -3 lines
Diff to previous 1.203 (colored)

Eliminates struct pcred by moving the real and saved ugids into
struct ucred; struct process then directly links to the ucred

Based on a discussion at c2k10 or so before noting that FreeBSD and
NetBSD did this too.

ok matthew@

Revision 1.203 / (download) - annotate - [select for diffs], Sat Mar 8 22:54:30 2014 UTC (10 years, 3 months ago) by tedu
Branch: MAIN
Changes since 1.202: +19 -6 lines
Diff to previous 1.202 (colored)

split falloc into two functions, the allocation and the publication.
the first part is likely to fail, but we can generally prevent the second
part from failing.
use these two functions to drop the fdp lock around vn_open in sys_open,
but still maintain the original semantics of allocate then open.
the goal here is to fix the blocked fifo deadlock in a threaded program.

testing volunteers in short supply, resorting to conscription

Revision 1.202 / (download) - annotate - [select for diffs], Tue Jan 21 01:48:45 2014 UTC (10 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.201: +2 -2 lines
Diff to previous 1.201 (colored)

bzero -> memset

Revision 1.201 / (download) - annotate - [select for diffs], Mon Jan 20 03:33:29 2014 UTC (10 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.200: +2 -2 lines
Diff to previous 1.200 (colored)

Fix comment

Revision 1.200 / (download) - annotate - [select for diffs], Sun Dec 1 16:40:56 2013 UTC (10 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.199: +7 -16 lines
Diff to previous 1.199 (colored)

Change 'mountlist' from CIRCLEQ to TAILQ. Be paranoid and
use TAILQ_*_SAFE more than might be needed.

Bulk ports build by sthen@ showed nobody sticking their fingers
so deep into the kernel.

Feedback and suggestions from millert@. ok jsing@

Revision 1.199 / (download) - annotate - [select for diffs], Fri Oct 25 14:56:52 2013 UTC (10 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.198: +2 -2 lines
Diff to previous 1.198 (colored)

fix comment

Revision 1.198 / (download) - annotate - [select for diffs], Sat Sep 14 01:35:01 2013 UTC (10 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.197: +1 -247 lines
Diff to previous 1.197 (colored)

Snapshots for all archs have been built, so remove the T32 code

Revision 1.197 / (download) - annotate - [select for diffs], Fri Aug 16 08:33:20 2013 UTC (10 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.196: +3 -3 lines
Diff to previous 1.196 (colored)

Tweak the getdents() kernel prototype to use "void *"
Provide a declaration for userspace
Fix the kernel's sanity check on the buflen argument

lack of prototype pointed out by sthen@ and landry@
ok kettenis@ otto@

Revision 1.196 / (download) - annotate - [select for diffs], Wed Aug 14 05:26:14 2013 UTC (10 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.195: +1 -189 lines
Diff to previous 1.195 (colored)

The last user of the old __tfork() was updated to the current one,
so COMPAT_O51 can go.  The complete ABI role means COMPAT_O53 can
be removed as well.

ok jsing@ tedu@

Revision 1.195 / (download) - annotate - [select for diffs], Tue Aug 13 05:52:24 2013 UTC (10 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.194: +266 -34 lines
Diff to previous 1.194 (colored)

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types.  Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments.  Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir.  Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility.  Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@

Revision 1.194 / (download) - annotate - [select for diffs], Thu Aug 8 20:19:13 2013 UTC (10 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.193: +59 -79 lines
Diff to previous 1.193 (colored)

Drop the retval argument from do*at() functions which don't use it.

ok kettenis@ mpi@ deraadt@ millert@ miod@ matthew@ beck@

Revision 1.193 / (download) - annotate - [select for diffs], Wed Jun 5 01:26:00 2013 UTC (11 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored)

Move FHASLOCK from f_flag to f_iflags, freeing up a bit for passing
O_* flags and eliminating an XXX comment.

ok matthew@ deraadt@

Revision 1.192 / (download) - annotate - [select for diffs], Mon Apr 15 15:32:19 2013 UTC (11 years, 1 month ago) by jsing
Branch: MAIN
Changes since 1.191: +189 -1 lines
Diff to previous 1.191 (colored)

Add an f_mntfromspec member to struct statfs, which specifies the name of
the special provided when the mount was requested. This may be the same as
the special that was actually used for the mount (e.g. in the case of a
device node) or it may be different (e.g. in the case of a DUID).

Whilst here, change f_ctime to a 64 bit type and remove the pointless
f_spare members.

Compatibility goo courtesy of guenther@

ok krw@ millert@

Revision 1.191 / (download) - annotate - [select for diffs], Thu Mar 28 02:39:17 2013 UTC (11 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.190: +27 -19 lines
Diff to previous 1.190 (colored)

When updating fd_cdir or fd_rdir, put the new pointer in place
_before_ vrele()'ing the old one, so that you can't catch the process
with a vnode with no references.

Similarly, in checkdirs(), just count the needed releases and do
them all at the end.  (I think I saw this in FreeBSD.)

Original problem encountered by landry@ (yay for backtrace)
ok tedu@ deraadt@

Revision 1.190 / (download) - annotate - [select for diffs], Wed Jan 30 18:21:08 2013 UTC (11 years, 4 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.189: +2 -2 lines
Diff to previous 1.189 (colored)

In doreadlinkat(), only access auio.uio_resid if it's already been
initialized.  (In the case where it wasn't initialized, the computed
*retval ends up getting clobbered by the EINVAL error anyway so it's
not an info leak, but it's still technically undefined behavior.)

pointed out by Maxime Villard on tech
ok guenther

Revision 1.189 / (download) - annotate - [select for diffs], Mon Sep 10 11:10:59 2012 UTC (11 years, 9 months ago) by jsing
Branch: MAIN
Changes since 1.188: +1 -1 lines
Diff to previous 1.188 (colored)

Cleanup VFS mount string handling:

- Avoid using copyinstr() without checking the return value.

- sys_mount() has already copied the path in, so pass this to the
  filesystem mount code so that it does not have to copy it in again.

- Avoid copyinstr()/bzero() dance when we can simply bzero() and strlcpy().

ok krw@

Revision 1.188 / (download) - annotate - [select for diffs], Mon Sep 10 02:21:56 2012 UTC (11 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.187: +1 -24 lines
Diff to previous 1.187 (colored)

delete compat_o48_sys_getdirentries; ok guenther

Revision 1.187 / (download) - annotate - [select for diffs], Wed Jul 11 23:07:19 2012 UTC (11 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.186: +18 -24 lines
Diff to previous 1.186 (colored)

Revert the blocked FIFO open fix, as there's either a race in the
ref-count handling under handling, or blambert@ is messing with my head

Revision 1.186 / (download) - annotate - [select for diffs], Tue Jul 10 17:00:55 2012 UTC (11 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.185: +5 -3 lines
Diff to previous 1.185 (colored)

Don't release a FILE that wan't allocated.  Found by benno@

ok matthew@ benno@

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jul 8 10:55:10 2012 UTC (11 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.184: +20 -16 lines
Diff to previous 1.184 (colored)

Don't hold the fd-table lock across vn_open(), as opening a FIFO may block.
Having done that, dupfdopen() has to handle a possible race.

ok matthew@ krw@

Revision 1.184 / (download) - annotate - [select for diffs], Mon May 21 16:41:03 2012 UTC (12 years ago) by matthew
Branch: MAIN
Changes since 1.183: +10 -4 lines
Diff to previous 1.183 (colored)

Cleanup O_CLOEXEC handling and make sure UF_EXCLOSE is set correctly
when opening /dev/fd/* (i.e., UF_EXCLOSE is now set iff O_CLOEXEC is
set, rather than copying UF_EXCLOSE from the file descriptor being
dup'd).

Also, add support for O_CLOEXEC and O_DIRECTORY to fhopen().

ok krw, guenther; feedback from millert; testing and bug finding by krw

Revision 1.183 / (download) - annotate - [select for diffs], Mon May 14 02:41:13 2012 UTC (12 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.182: +3 -3 lines
Diff to previous 1.182 (colored)

Remove the "vn_open() returning ENXIO means dup+close" hook that
was used by the now defunct portalfs.  Zero out fd_ofileflags[fd]
when allocating an fd instead of when releasing it.

ok krw@ matthew@

Revision 1.182 / (download) - annotate - [select for diffs], Sun Apr 22 05:43:14 2012 UTC (12 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.181: +13 -13 lines
Diff to previous 1.181 (colored)

Add struct proc * argument to FRELE() and FILE_SET_MATURE() in
anticipation of further changes to closef().  No binary change.

ok krw@ miod@ deraadt@

Revision 1.181 / (download) - annotate - [select for diffs], Mon Mar 19 09:05:39 2012 UTC (12 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.180: +10 -1 lines
Diff to previous 1.180 (colored)

Add tracing and dumping of "pointer to struct" syscall arguments for
structs timespec, timeval, sigaction, and rlimit.

ok otto@ jsing@

Revision 1.180 / (download) - annotate - [select for diffs], Sun Nov 6 15:09:02 2011 UTC (12 years, 7 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.179: +15 -7 lines
Diff to previous 1.179 (colored)

Negative offsets to pread/pwrite-family are only legal for character devices.

Pointed out by Alexander Polakov (polachok at gmail.com)
ok deraadt@

Revision 1.179 / (download) - annotate - [select for diffs], Sat Nov 5 15:47:37 2011 UTC (12 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.178: +9 -5 lines
Diff to previous 1.178 (colored)

ttys can't seek, so make pread/pwrite/preadv/pwritev fail with ESPIPE
on them too

ok deraadt@, miod@

Revision 1.178 / (download) - annotate - [select for diffs], Mon Jul 25 19:51:24 2011 UTC (12 years, 10 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.177: +2 -1 lines
Diff to previous 1.177 (colored)

Make sure vfsp is not used uninitialized in the mount -o update case;
ok krw@ matthew@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Jul 18 00:16:54 2011 UTC (12 years, 10 months ago) by matthew
Branch: MAIN
Changes since 1.176: +102 -64 lines
Diff to previous 1.176 (colored)

Add support for UTIME_OMIT and UTIME_NOW to utimensat(2), add the
futimens(2) system call, and refactor futimes(2) to share the same
code.  (As with other openat(2) system call stuff, this is not exposed
to userland yet.)

naddy@ pointed out rsync expects UTIME_* if openat(2) is available
tweaks and ok guenther@; tested by naddy@ in a bulk build

Revision 1.176 / (download) - annotate - [select for diffs], Thu Jul 14 18:03:06 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.175: +30 -48 lines
Diff to previous 1.175 (colored)

Add support for AT_REMOVEDIR to unlinkat(2), and switch sys_rmdir() to
use it.

ok tedu@, guenther@

Revision 1.175 / (download) - annotate - [select for diffs], Tue Jul 12 23:36:40 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.174: +3 -3 lines
Diff to previous 1.174 (colored)

Fix typo that caused fchownat(2) and fchmodat(2) to try to dereference
symbolic links even when the AT_SYMLINK_NOFOLLOW flag is passed.

noticed by naddy@ testing gnulib
ok deraadt@ and presumably tedu@ (who wrote a similar diff)

Revision 1.174 / (download) - annotate - [select for diffs], Sat Jul 9 05:46:26 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.173: +5 -3 lines
Diff to previous 1.173 (colored)

Fix up previous diff: use COMPAT_O48 instead of COMPAT_48, add option
to GENERIC, wrap compat_o48_sys_getdirentries() with an appropriate
#ifdef, and use struct compat_o48_sys_getdirentries_args instead of
struct sys_getdirentries_args.

Revision 1.173 / (download) - annotate - [select for diffs], Sat Jul 9 05:31:26 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.172: +2 -2 lines
Diff to previous 1.172 (colored)

More syscalls.master cleanup:

sys_osigaltstack() is 7 years old and no longer needed; all glory to
the sys_sigaltstack()!

sys_ogetdirentries() is about 9 months old, but still acceptable
within our release cycle; move from STD to COMPAT_48 to make this
clearer for tedu@ next year.

sys_sbrk() and sys_sstk() are completely obsolete: all they do is
return ENOSYS.

ok guenther@

Revision 1.172 / (download) - annotate - [select for diffs], Sat Jul 9 01:28:48 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.171: +3 -1 lines
Diff to previous 1.171 (colored)

Add support for the O_CLOEXEC and O_DIRECTORY flags introduced in
POSIX Issue 7.

Requested by oga@ (and maybe djm@); ok guenther@

Revision 1.171 / (download) - annotate - [select for diffs], Fri Jul 8 19:28:38 2011 UTC (12 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.170: +6 -1 lines
Diff to previous 1.170 (colored)

Support sending struct info to kdump. So far for struct stat and
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@

Revision 1.170 / (download) - annotate - [select for diffs], Fri Jul 8 04:23:24 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.169: +50 -60 lines
Diff to previous 1.169 (colored)

Add support for the AT_EACCESS, AT_SYMLINK_NOFOLLOW, and
AT_SYMLINK_FOLLOW flags.  Refactor sys_lstat to call dofstatat() with
AT_SYMLINK_NOFOLLOW.  Fix sys_link() to use AT_SYMLINK_FOLLOW when
calling dolinkat().

Additionally, fix a bug in VOP_ACCESS() where we might sleep while not
holding a reference count on the ucred object we pass down.

ok tedu@

Revision 1.169 / (download) - annotate - [select for diffs], Thu Jul 7 23:45:00 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.168: +436 -53 lines
Diff to previous 1.168 (colored)

Add new syscall entries to support the openat(2) family of functions
added in POSIX Issue 7: openat(), mknodat(), mkfifoat(), linkat(),
symlinkat(), unlinkat(), faccessat(), fstatat(), readlinkat(),
fchmodat(), fchownat(), utimensat(), renameat(), and mkdirat().

This diff mostly just refactors the existing sys_foo() logic into a
common dofooat() function that can then be called by both sys_foo()
and sys_fooat().  Some of the new system calls support new flags to
control their behavior, and proper support for these will be added in
subsequent diffs.

Incorporating suggestions from thib@, guenther@, and tedu@.

ok tedu@, thib@, deraadt@, guenther@

Revision 1.168 / (download) - annotate - [select for diffs], Wed Jul 6 04:49:13 2011 UTC (12 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.167: +6 -8 lines
Diff to previous 1.167 (colored)

Return the correct error for fchdir(not_file_or_dir)

ok matthew@ tedu@

Revision 1.167 / (download) - annotate - [select for diffs], Wed Jul 6 04:41:16 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.166: +14 -8 lines
Diff to previous 1.166 (colored)

VOP_GETATTR() can sleep when accessing a file over NFS, so use
FREF()/FRELE() in lseek() so our struct file doesn't disappear in the
mean time.

Incorporating suggestions from tedu@ and guenther@; ok guenther@

Revision 1.166 / (download) - annotate - [select for diffs], Tue Jul 5 21:38:58 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
Changes since 1.165: +2 -14 lines
Diff to previous 1.165 (colored)

Don't worry about lseek(2)ing past the end of raw disk devices.  The
disk drivers are now smart enough to handle this correctly, as they
need to also handle pread(2)/pwrite(2).

ok deraadt@, krw@; ok marco@ on an similar, earlier diff

Revision 1.165 / (download) - annotate - [select for diffs], Thu Oct 28 15:02:41 2010 UTC (13 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.164: +57 -18 lines
Diff to previous 1.164 (colored)

Change basep parameter of getdirentries() to be off_t *, not long *
so it works correctly with large offsets (and matches other systems).
This requires adding a new getdirentries syscall, with the old one
renamed to ogetdirentries.  All in-tree consumers of getdirentries()
have been updated.  Bump libc and libpthread major numbers.
OK and with deraadt@

Revision 1.164 / (download) - annotate - [select for diffs], Wed Oct 27 17:11:08 2010 UTC (13 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.163: +1 -5 lines
Diff to previous 1.163 (colored)

The previous two commits cannot be right.  If in fact offsets > 4GB are
causing problems, then it is nonsense to instead fail at the 2GB line.
Much more discussion needed.

Revision 1.163 / (download) - annotate - [select for diffs], Thu Jul 1 22:03:32 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored)

Oops. Lost the < 0 check on file position I had in the circulated
diff. A bit of paranoia suggested by beck@.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Jul 1 17:31:22 2010 UTC (13 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.161: +5 -1 lines
Diff to previous 1.161 (colored)

Return EINVAL if the file position is greater than LONG_MAX, since
otherwise truncation will occur on archs where LONG LONG and LONG
are not the same.

Noticed at n2k10. Error return suggested by deraadt@.

ok beck@ millert@ deraadt@ guenther@

Revision 1.161 / (download) - annotate - [select for diffs], Tue Jun 29 17:13:59 2010 UTC (13 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.160: +1 -24 lines
Diff to previous 1.160 (colored)

Remove the "if the string address faulted, see if it looks like an int"
4.3 compat code in mount.  This is a flag day for those of you still running
4.3 BSD binaries on your vaxen. :)
ok deraadt dlg guenther thib

Revision 1.160 / (download) - annotate - [select for diffs], Tue Jun 29 04:07:39 2010 UTC (13 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.159: +49 -38 lines
Diff to previous 1.159 (colored)

eliminate some very redundant SCARG usage.  ok art

Revision 1.159 / (download) - annotate - [select for diffs], Sat Oct 31 12:00:08 2009 UTC (14 years, 7 months ago) by fgsch
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.158: +3 -3 lines
Diff to previous 1.158 (colored)

Use suser when possible. Suggested by miod@.
miod@ deraadt@ ok.

Revision 1.158 / (download) - annotate - [select for diffs], Tue Sep 8 17:41:20 2009 UTC (14 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.157: +3 -3 lines
Diff to previous 1.157 (colored)

copyout() the correct size in sys_fhstatfs(), broken since 1.138.
ok millert@ blambert@ otto@

Revision 1.157 / (download) - annotate - [select for diffs], Wed Sep 2 19:05:44 2009 UTC (14 years, 9 months ago) by fgsch
Branch: MAIN
Changes since 1.156: +9 -7 lines
Diff to previous 1.156 (colored)

check if we have access to the vnode before checking if we can write to
it. thib@ ok'd the idea and an earlier diff.

Revision 1.156 / (download) - annotate - [select for diffs], Thu Jul 9 22:29:56 2009 UTC (14 years, 11 months ago) by thib
Branch: MAIN
Changes since 1.155: +5 -5 lines
Diff to previous 1.155 (colored)

Remove the VREF() macro and replaces all instances with a call to verf(),
which is exactly what the macro does.

Macro's that are nothing more then:
#define FUNCTION(arg) function(arg)
are almost always pointless and should go away.

OK blambert@
Agreed by many.

Revision 1.155 / (download) - annotate - [select for diffs], Thu Jun 4 00:24:02 2009 UTC (15 years ago) by blambert
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.154: +14 -8 lines
Diff to previous 1.154 (colored)

Put readv/writev changes back in, as they no longer hang ckuethe's ntpd.

Special thanks to ckuethe's ntpd for noticing the problem.

ok deraadt@

Revision 1.154 / (download) - annotate - [select for diffs], Wed Jun 3 03:57:20 2009 UTC (15 years ago) by blambert
Branch: MAIN
Changes since 1.153: +7 -11 lines
Diff to previous 1.153 (colored)

Revert readv/writev changes, as they trigger an apparent file descriptor
deadlock for ckuethe@

"if you have to revert, you have to revert" deraadt@

Revision 1.153 / (download) - annotate - [select for diffs], Tue Jun 2 03:04:09 2009 UTC (15 years ago) by blambert
Branch: MAIN
Changes since 1.152: +11 -7 lines
Diff to previous 1.152 (colored)

dofile{read,write} are essentially identical to their iovec equivalents,
dofile{read,write}v, so remove the former and rework it so that everything
uses the latter

"nice" deraadt@ "reads ok" oga@ spastic 'OMG Ponies!!!!' weingart@

Revision 1.152 / (download) - annotate - [select for diffs], Tue Nov 11 02:11:25 2008 UTC (15 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.151: +6 -7 lines
Diff to previous 1.151 (colored)

make sure that any messing we do with a process's directories happens atomically and not after sleeping.
ok deraadt pedro

Revision 1.151 / (download) - annotate - [select for diffs], Sat Nov 1 20:34:09 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.150: +8 -5 lines
Diff to previous 1.150 (colored)

change vrele() to return an int.  if it returns 0, it can gaurantee that
it did not sleep.  this is used to avoid checkdirs() to avoid having
to restart the allproc walk every time through
idea from tedu, ok thib pedro

Revision 1.150 / (download) - annotate - [select for diffs], Fri Oct 31 16:49:17 2008 UTC (15 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.149: +4 -1 lines
Diff to previous 1.149 (colored)

checkdirs() walks allproc and calls sleeping functions if directories have
to be snapped.  Change it so that everytime it sleeps it restarts from the
top of the list.
ok art

Revision 1.149 / (download) - annotate - [select for diffs], Fri Aug 8 19:49:09 2008 UTC (15 years, 10 months ago) by thib
Branch: MAIN
Changes since 1.148: +2 -5 lines
Diff to previous 1.148 (colored)

remove an if notyet block from sys_fstatfs(), that will never be needed,
softupdates are reported too statfs via other means. missed this block
in in rev1.148 where the same block was removed from sys_statfs().

Revision 1.148 / (download) - annotate - [select for diffs], Mon Jul 28 14:21:17 2008 UTC (15 years, 10 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.147: +2 -5 lines
Diff to previous 1.147 (colored)


remove an #if noyet block that will never be needed.
softupdates are reported too statfs via the mount point flags
or the mount_info part of statfs;

ok pedro@

Revision 1.147 / (download) - annotate - [select for diffs], Fri Jun 13 01:59:45 2008 UTC (16 years ago) by rainer
Branch: MAIN
Changes since 1.146: +1 -5 lines
Diff to previous 1.146 (colored)

Delete vfs_bufstats() leftovers and unbreak compile with -DDEBUG

Ok reyk@, "kill kill kill" thib@

Revision 1.146 / (download) - annotate - [select for diffs], Thu May 22 17:04:59 2008 UTC (16 years ago) by thib
Branch: MAIN
Changes since 1.145: +2 -2 lines
Diff to previous 1.145 (colored)

Use LIST_FOREACH() instead of handrolling.

From: Pierre Riteau pierre.riteau_att_gmail.com
OK miod@

Revision 1.145 / (download) - annotate - [select for diffs], Tue Jan 22 14:33:40 2008 UTC (16 years, 4 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.144: +4 -2 lines
Diff to previous 1.144 (colored)

Fix a double VOP_UNLOCK() that was introduced into the error path
in rev 1.141.  From Christian Ehrhardt and Pedro Martelletto.
OK hshoexer@ miod@

Revision 1.144 / (download) - annotate - [select for diffs], Wed Nov 28 16:56:46 2007 UTC (16 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.143: +3 -3 lines
Diff to previous 1.143 (colored)

a few more places where getmicrotime is good enough. ok miod

Revision 1.143 / (download) - annotate - [select for diffs], Fri Sep 7 15:00:20 2007 UTC (16 years, 9 months ago) by art
Branch: MAIN
Changes since 1.142: +2 -3 lines
Diff to previous 1.142 (colored)

Use M_ZERO in a few more places to shave bytes from the kernel.

eyeballed and ok dlg@

Revision 1.142 / (download) - annotate - [select for diffs], Thu Aug 30 12:35:27 2007 UTC (16 years, 9 months ago) by thib
Branch: MAIN
Changes since 1.141: +2 -3 lines
Diff to previous 1.141 (colored)

Fix lock ordering problems when updating mount points, in some
cases we could end up releasing an unlocked lock.

fixes pr's 5534 and 5564, confirmed by submitters.
thanks!.

ok art@

Revision 1.141 / (download) - annotate - [select for diffs], Mon Aug 6 16:58:26 2007 UTC (16 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.140: +3 -7 lines
Diff to previous 1.140 (colored)

Fix error path in sys_fhopen() if VOP_ADVLOCK fails.  Spotted by aaron@

Revision 1.140 / (download) - annotate - [select for diffs], Thu Jun 14 20:36:34 2007 UTC (17 years ago) by otto
Branch: MAIN
Changes since 1.139: +26 -11 lines
Diff to previous 1.139 (colored)

Forgotten hackton diff: bounds check for seek on special devices
with a disklabel.  Original diff from pedro@; ok pedro@ deraadt@

Revision 1.139 / (download) - annotate - [select for diffs], Tue Jan 16 17:52:18 2007 UTC (17 years, 4 months ago) by thib
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.138: +1 -30 lines
Diff to previous 1.138 (colored)

Retire VOP_LEASE(); It was a bit for NQNFS and has
effectively been a no-op for quite some time now,
without promise for future usage.

ok pedro@
Testing by krw@ (earlier diff)
and Johan Mson Lindman (tybollt@solace.miun.se)

Revision 1.138 / (download) - annotate - [select for diffs], Fri Nov 24 17:04:20 2006 UTC (17 years, 6 months ago) by art
Branch: MAIN
Changes since 1.137: +39 -28 lines
Diff to previous 1.137 (colored)

When copying out struct statfs to userland, we need to zero out the fsid
field unless it's root that's asking. This far, this has been done by
putting a struct statfs on the stack and modifying it.

struct statfs is large. Large things on the stack are bad. Create
copyout_statfs() that copies out a struct statfs to userland, does the
necessary root check and gives userland what it needs withtout wasting
stack space.

pedro@, deraadt@ ok.

Revision 1.137 / (download) - annotate - [select for diffs], Sun Jun 25 15:01:54 2006 UTC (17 years, 11 months ago) by sturm
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.136: +7 -7 lines
Diff to previous 1.136 (colored)

rename vfs_busy() flags VB_UMIGNORE/VB_UMWAIT to VB_NOWAIT/VB_WAIT

requested by and ok pedro

Revision 1.136 / (download) - annotate - [select for diffs], Wed Jun 14 20:01:50 2006 UTC (18 years ago) by sturm
Branch: MAIN
Changes since 1.135: +9 -10 lines
Diff to previous 1.135 (colored)

move vfs_busy() to rwlocks and properly hide the locking api from vfs

ok tedu, pedro

Revision 1.135 / (download) - annotate - [select for diffs], Sat May 27 17:37:42 2006 UTC (18 years ago) by sturm
Branch: MAIN
Changes since 1.134: +2 -4 lines
Diff to previous 1.134 (colored)

remove useless error check and irritating comment

ok pedro

Revision 1.134 / (download) - annotate - [select for diffs], Sun Apr 30 14:20:07 2006 UTC (18 years, 1 month ago) by sturm
Branch: MAIN
Changes since 1.133: +7 -7 lines
Diff to previous 1.133 (colored)

remove the simplelock argument from vfs_busy() which is currently not
used and will never be used this way in VFS

requested by and ok pedro, ok krw, biorn

Revision 1.133 / (download) - annotate - [select for diffs], Wed Apr 19 11:55:55 2006 UTC (18 years, 1 month ago) by pedro
Branch: MAIN
Changes since 1.132: +14 -16 lines
Diff to previous 1.132 (colored)

Remove unused mount list simple_lock() goo

Revision 1.132 / (download) - annotate - [select for diffs], Sun Mar 26 17:47:10 2006 UTC (18 years, 2 months ago) by mickey
Branch: MAIN
Changes since 1.131: +2 -1 lines
Diff to previous 1.131 (colored)

do per file io accounting and show that in fstat as well; pedro@ marco@ ok

Revision 1.131 / (download) - annotate - [select for diffs], Sat Jan 7 07:39:55 2006 UTC (18 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

p_dupfd need only be -1, nothing else.  but this is nothing like what aaron has coming...

Revision 1.130 / (download) - annotate - [select for diffs], Wed Nov 30 10:35:08 2005 UTC (18 years, 6 months ago) by pedro
Branch: MAIN
Changes since 1.129: +15 -15 lines
Diff to previous 1.129 (colored)

No need for vfs_busy() and vfs_unbusy() to take a process pointer
anymore. Testing by jolan@, thanks.

Revision 1.129 / (download) - annotate - [select for diffs], Sun Nov 27 12:37:58 2005 UTC (18 years, 6 months ago) by pedro
Branch: MAIN
Changes since 1.128: +3 -3 lines
Diff to previous 1.128 (colored)

Don't set MNT_UPDATE and MNT_RELOAD before acquiring the mount point
lock. Fixes a race as seen on PR kern/4915. Okay miod@ and joris@,
tested by krw@ and hshoexer@, thanks.

Revision 1.128 / (download) - annotate - [select for diffs], Sat Nov 19 02:18:01 2005 UTC (18 years, 6 months ago) by pedro
Branch: MAIN
Changes since 1.127: +3 -3 lines
Diff to previous 1.127 (colored)

Remove unnecessary lockmgr() archaism that was costing too much in terms
of panics and bugfixes. Access curproc directly, do not expect a process
pointer as an argument. Should fix many "process context required" bugs.
Incentive and okay millert@, okay marc@. Various testing, thanks.

Revision 1.127 / (download) - annotate - [select for diffs], Tue Nov 8 15:43:44 2005 UTC (18 years, 7 months ago) by pedro
Branch: MAIN
Changes since 1.126: +112 -264 lines
Diff to previous 1.126 (colored)

Use ANSI function declarations and deregister, no binary change

Revision 1.126 / (download) - annotate - [select for diffs], Sun Jul 3 20:13:59 2005 UTC (18 years, 11 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.125: +1 -404 lines
Diff to previous 1.125 (colored)

Extended Attributes was a piece to get to ACLs, however ACLs have not
been worked on, so EA is pointless. Also the code is not enabled
in GENERIC so it is not being tested or maintained.

Revision 1.125 / (download) - annotate - [select for diffs], Fri Jun 17 20:39:14 2005 UTC (18 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.124: +1 -14 lines
Diff to previous 1.124 (colored)

remove undelete syscall

Revision 1.124 / (download) - annotate - [select for diffs], Fri May 27 23:44:05 2005 UTC (19 years ago) by marius
Branch: MAIN
Changes since 1.123: +1 -3 lines
Diff to previous 1.123 (colored)

remove some dead code.

ok pedro@

Revision 1.123 / (download) - annotate - [select for diffs], Fri May 27 20:20:23 2005 UTC (19 years ago) by pedro
Branch: MAIN
Changes since 1.122: +2 -15 lines
Diff to previous 1.122 (colored)

remove references of VOP_WHITEOUT from the kernel, okay millert@

Revision 1.122 / (download) - annotate - [select for diffs], Fri May 27 17:31:47 2005 UTC (19 years ago) by pedro
Branch: MAIN
Changes since 1.121: +2 -29 lines
Diff to previous 1.121 (colored)

prepare the removal of sys_undelete(), make it a stub, okay millert@

Revision 1.121 / (download) - annotate - [select for diffs], Thu May 26 00:33:45 2005 UTC (19 years ago) by pedro
Branch: MAIN
Changes since 1.120: +6 -34 lines
Diff to previous 1.120 (colored)

RIP stackable filesystems, ok marius@ tedu@, discussed with deraadt@

Revision 1.120 / (download) - annotate - [select for diffs], Tue May 24 05:34:54 2005 UTC (19 years ago) by pedro
Branch: MAIN
Changes since 1.119: +2 -2 lines
Diff to previous 1.119 (colored)

when a device vnode associated with a mount point disappears, mark the
filesystem as doomed and unmount it

Revision 1.119 / (download) - annotate - [select for diffs], Sun Dec 26 21:22:13 2004 UTC (19 years, 5 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (colored)

Use list and queue macros where applicable to make the code easier to read;
no change in compiler assembly output.

Revision 1.118 / (download) - annotate - [select for diffs], Thu Sep 16 10:37:41 2004 UTC (19 years, 8 months ago) by pedro
Branch: MAIN
Changes since 1.117: +8 -1 lines
Diff to previous 1.117 (colored)

check for VBAD vnodes on getvnode(). ok andreas@, tedu@ and marius@

Revision 1.117 / (download) - annotate - [select for diffs], Thu Aug 5 04:46:26 2004 UTC (19 years, 10 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.116: +1 -25 lines
Diff to previous 1.116 (colored)

don't attempt to put processes back in a directory after unmount.
it could never always work, and worse, may cause other bugs/crashes.

Revision 1.116 / (download) - annotate - [select for diffs], Thu Jul 22 06:13:08 2004 UTC (19 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored)

remove p arg from fdplock

Revision 1.115 / (download) - annotate - [select for diffs], Sun Jul 18 12:05:07 2004 UTC (19 years, 10 months ago) by avsm
Branch: MAIN
Changes since 1.114: +5 -3 lines
Diff to previous 1.114 (colored)

return EINVAL if ftruncate(2) is passed a negative offset
ok millert@, miod@, marius@

Revision 1.114 / (download) - annotate - [select for diffs], Tue Jul 13 21:04:29 2004 UTC (19 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.113: +11 -11 lines
Diff to previous 1.113 (colored)

Change mode_t and nlink_t from 16bit to 32bit.  This allows us to
use mode_t in syscalls.master and to use mode_t in more places in
the kernel.  It also makes lint much more useful on kernel code.

I've also added a placeholder for st_birthtime to make a UFS2 import
easier at some future date.

Requested by and OK deraadt@

Revision 1.113 / (download) - annotate - [select for diffs], Sat Jul 3 18:14:02 2004 UTC (19 years, 11 months ago) by pedro
Branch: MAIN
Changes since 1.112: +4 -2 lines
Diff to previous 1.112 (colored)

if vinvalbuf() fails, unlock the vnode and release it. ok marius@

Revision 1.112 / (download) - annotate - [select for diffs], Mon Jun 21 23:50:36 2004 UTC (19 years, 11 months ago) by tholo
Branch: MAIN
Changes since 1.111: +2 -4 lines
Diff to previous 1.111 (colored)

First step towards more sane time handling in the kernel -- this changes
things such that code that only need a second-resolution uptime or wall
time, and used to get that from time.tv_secs or mono_time.tv_secs now get
this from separate time_t globals time_second and time_uptime.

ok art@ niklas@ nordin@

Revision 1.62.2.13 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:03 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.62.2.12: +36 -29 lines
Diff to previous 1.62.2.12 (colored) to branchpoint 1.62 (colored) next main 1.63 (colored)

Merge with the trunk

Revision 1.111 / (download) - annotate - [select for diffs], Fri May 14 04:00:33 2004 UTC (20 years, 1 month ago) by tedu
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A
Changes since 1.110: +6 -5 lines
Diff to previous 1.110 (colored)

use pool for namei pathbuf.  testing ok millert@ tdeval@

Revision 1.110 / (download) - annotate - [select for diffs], Mon May 10 22:36:21 2004 UTC (20 years, 1 month ago) by pedro
Branch: MAIN
Changes since 1.109: +9 -3 lines
Diff to previous 1.109 (colored)

when doing user mounts, inherit the MNT_NOEXEC flag from the covered
vnode's mount point. this makes it impossible for a user to bypass the
noexec protection of a mount point by null-mounting it on top of itself.

ok tedu@ millert@

Revision 1.109 / (download) - annotate - [select for diffs], Tue Apr 13 00:15:28 2004 UTC (20 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.108: +24 -24 lines
Diff to previous 1.108 (colored)

useless caddr_t cast removal.  same md5s.

Revision 1.62.2.12 / (download) - annotate - [select for diffs], Thu Feb 19 10:56:39 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.62.2.11: +100 -84 lines
Diff to previous 1.62.2.11 (colored) to branchpoint 1.62 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.108 / (download) - annotate - [select for diffs], Tue Jan 6 04:18:18 2004 UTC (20 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.107: +25 -13 lines
Diff to previous 1.107 (colored)

lock filedesc before manipulating.  avoids some rare races.
testing for quite some time by brad + otto

Revision 1.107 / (download) - annotate - [select for diffs], Mon Sep 1 18:06:03 2003 UTC (20 years, 9 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.106: +48 -48 lines
Diff to previous 1.106 (colored)

match syscallargs comments with reality
from Patrick Latifi <patrick.l@hermes.usherb.ca>
ok jason@ tedu@

Revision 1.106 / (download) - annotate - [select for diffs], Fri Aug 15 20:32:18 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.105: +22 -22 lines
Diff to previous 1.105 (colored)

change arguments to suser.  suser now takes the process, and a flags
argument.  old cred only calls user suser_ucred.  this will allow future
work to more flexibly implement the idea of a root process.  looks like
something i saw in freebsd, but a little different.
use of suser_ucred vs suser in file system code should be looked at again,
for the moment semantics remain unchanged.
review and input from art@  testing and further review miod@

Revision 1.105 / (download) - annotate - [select for diffs], Fri Jul 18 16:43:32 2003 UTC (20 years, 10 months ago) by tedu
Branch: MAIN
Changes since 1.104: +8 -4 lines
Diff to previous 1.104 (colored)

check v_mount for NULL before using. ok art@

Revision 1.62.2.11 / (download) - annotate - [select for diffs], Sat Jun 7 11:03:41 2003 UTC (21 years ago) by ho
Branch: SMP
Changes since 1.62.2.10: +2 -6 lines
Diff to previous 1.62.2.10 (colored) to branchpoint 1.62 (colored)

Sync SMP branch to -current

Revision 1.104 / (download) - annotate - [select for diffs], Mon Jun 2 23:28:07 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.103: +2 -6 lines
Diff to previous 1.103 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.83.2.4 / (download) - annotate - [select for diffs], Mon May 19 22:31:57 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.83.2.3: +35 -11 lines
Diff to previous 1.83.2.3 (colored) to branchpoint 1.83 (colored) next main 1.84 (colored)

sync

Revision 1.62.2.10 / (download) - annotate - [select for diffs], Tue May 13 19:21:29 2003 UTC (21 years, 1 month ago) by ho
Branch: SMP
Changes since 1.62.2.9: +35 -11 lines
Diff to previous 1.62.2.9 (colored) to branchpoint 1.62 (colored)

Sync the SMP branch to -current. This includes moving to ELF.

Revision 1.103 / (download) - annotate - [select for diffs], Tue May 6 20:52:14 2003 UTC (21 years, 1 month ago) by tedu
Branch: MAIN
CVS Tags: UBC_SYNC_A
Changes since 1.102: +28 -4 lines
Diff to previous 1.102 (colored)

attempt to put a process's cwd back in place after a forced umount.
won't always work, but it's the best we can do for now.  this covers
at least some of the failure cases the previous commit to vfs_lookup.c
checks for.
ok weingart@

Revision 1.102 / (download) - annotate - [select for diffs], Mon May 5 00:21:52 2003 UTC (21 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.101: +7 -3 lines
Diff to previous 1.101 (colored)

fix test for restoring mnt_syncer in dounmount.
ok and input csapuntz@

Revision 1.101 / (download) - annotate - [select for diffs], Thu May 1 21:13:05 2003 UTC (21 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

several related changes:
vfs_subr.c:
	add a missing simple_lock_init for vnode interlock
	try to avoid reclaiming locked or layered vnodes
	initialize vnlock pointer to NULL
	remove old code to free vnlock, never used
	lockinit the new vnode lock
vfs_syscalls.c:
	support for VLAYER flag
vnode_if.sh:
	support for splitting VDESC flags
vnode_if.src:
	split VDESC flags
	WILLPUT is the combination of WILLRELE and WILLUNLOCK
	most uses for WILLRELE become WILLPUT
vnode.h:
	add v_lock to struct vnode
	add VLAYER flag
	update for new VDESC flags

Revision 1.100 / (download) - annotate - [select for diffs], Fri Apr 11 01:48:41 2003 UTC (21 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.99: +1 -3 lines
Diff to previous 1.99 (colored)

zombies can't live allproc list.  art fixed the real problem a while ago.

Revision 1.99 / (download) - annotate - [select for diffs], Thu Apr 10 02:06:00 2003 UTC (21 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.98: +3 -5 lines
Diff to previous 1.98 (colored)

don't try to update directories on zombies.  pr2030.  ok art

Revision 1.62.2.9 / (download) - annotate - [select for diffs], Fri Mar 28 00:41:27 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.62.2.8: +27 -34 lines
Diff to previous 1.62.2.8 (colored) to branchpoint 1.62 (colored)

Sync the SMP branch with 3.3

Revision 1.83.2.3 / (download) - annotate - [select for diffs], Tue Oct 29 00:36:45 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.83.2.2: +28 -35 lines
Diff to previous 1.83.2.2 (colored) to branchpoint 1.83 (colored)

sync to -current

Revision 1.80.2.1 / (download) - annotate - [select for diffs], Sun Oct 13 20:56:46 2002 UTC (21 years, 8 months ago) by miod
Branch: OPENBSD_3_0
Changes since 1.80: +4 -2 lines
Diff to previous 1.80 (colored) next main 1.81 (colored)

MFC (nordin):
Check for negative values. Inspiration from tedu <grendel@zeitbombe.org>.

Revision 1.95.2.1 / (download) - annotate - [select for diffs], Sun Oct 13 20:54:54 2002 UTC (21 years, 8 months ago) by miod
Branch: OPENBSD_3_1
Changes since 1.95: +4 -2 lines
Diff to previous 1.95 (colored) next main 1.96 (colored)

MFC (nordin):
Check for negative values. Inspiration from tedu <grendel@zeitbombe.org>.

Revision 1.98 / (download) - annotate - [select for diffs], Wed Oct 2 21:56:30 2002 UTC (21 years, 8 months ago) by nordin
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.97: +4 -2 lines
Diff to previous 1.97 (colored)

Check for negative values. Inspiration from tedu <grendel@zeitbombe.org>.
ok deraadt@ and art@

Revision 1.97 / (download) - annotate - [select for diffs], Fri Aug 23 15:39:31 2002 UTC (21 years, 9 months ago) by art
Branch: MAIN
Changes since 1.96: +15 -17 lines
Diff to previous 1.96 (colored)

Cleanup change. Since almost all callers (except one) of getvnode did a FREF
on the returned file, do the FREF inside getvnode so that people can't
get away with avoiding FREF and FRELE.

Eyeballed by various people.

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jul 12 14:02:22 2002 UTC (21 years, 11 months ago) by art
Branch: MAIN
Changes since 1.95: +11 -18 lines
Diff to previous 1.95 (colored)

Change the locking on the mountpoint slightly. Instead of using mnt_lock
to get shared locks for lookup and get the exclusive lock only with
LK_DRAIN on unmount and do the real exclusive locking with flags in
mnt_flags, we now use shared locks for lookup and an exclusive lock for
unmount.

This is accomplished by slightly changing the semantics of vfs_busy.
Old vfs_busy behavior:
 - with LK_NOWAIT set in flags, a shared lock was obtained if the
   mountpoint wasn't being unmounted, otherwise we just returned an error.
 - with no flags, a shared lock was obtained if the mountpoint was being
   unmounted, otherwise we slept until the unmount was done and returned
   an error.
LK_NOWAIT was used for sync(2) and some statistics code where it isn't really
critical that we get the correct results.
0 was used in fchdir and lookup where it's critical that we get the right
directory vnode for the filesystem root.

After this change vfs_busy keeps the same behavior for no flags and LK_NOWAIT.
But if some other flags are passed into it, they are passed directly
into lockmgr (actually LK_SLEEPFAIL is always added to those flags because
if we sleep for the lock, that means someone was holding the exclusive lock
and the exclusive lock is only held when the filesystem is being unmounted.

More changes:
 dounmount must now be called with the exclusive lock held. (before this
 the caller was supposed to hold the vfs_busy lock, but that wasn't always
 true).
 Zap some (now) unused mount flags.
And the highlight of this change:
 Add some vfs_busy calls to match some vfs_unbusy calls, especially in
 sys_mount. (lockmgr doesn't detect the case where we release a lock noone
 holds (it will do that soon)).

If you've seen hangs on reboot with mfs this should solve it (I repeat this
for the fourth time now, but this time I spent two months fixing and
redesigning this and reading the code so this time I must have gotten
this right).

Revision 1.83.2.2 / (download) - annotate - [select for diffs], Tue Jun 11 03:29:40 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.83.2.1: +475 -67 lines
Diff to previous 1.83.2.1 (colored) to branchpoint 1.83 (colored)

Sync UBC branch to -current

Revision 1.62.2.8 / (download) - annotate - [select for diffs], Thu Mar 28 11:43:04 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.62.2.7: +4 -4 lines
Diff to previous 1.62.2.7 (colored) to branchpoint 1.62 (colored)

Merge in -current from about a week ago

Revision 1.95 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:06 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE
Branch point for: OPENBSD_3_1
Changes since 1.94: +5 -5 lines
Diff to previous 1.94 (colored)

First round of __P removal in sys

Revision 1.62.2.7 / (download) - annotate - [select for diffs], Wed Mar 6 02:13:24 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.62.2.6: +488 -71 lines
Diff to previous 1.62.2.6 (colored) to branchpoint 1.62 (colored)

Merge in trunk

Revision 1.94 / (download) - annotate - [select for diffs], Fri Feb 22 20:37:45 2002 UTC (22 years, 3 months ago) by drahn
Branch: MAIN
Changes since 1.93: +407 -1 lines
Diff to previous 1.93 (colored)

Extended Attribute support from FreeBSD/TrustedBSD ok art@, deraadt@

Revision 1.93 / (download) - annotate - [select for diffs], Tue Feb 12 18:41:21 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.92: +38 -17 lines
Diff to previous 1.92 (colored)

More FREF/FRELE protection. This time all users of getvnode.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Feb 8 19:58:03 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.91: +11 -15 lines
Diff to previous 1.91 (colored)

Require a FREFd file in dofilewrite{,v}.

Revision 1.91 / (download) - annotate - [select for diffs], Fri Feb 8 19:47:50 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.90: +7 -9 lines
Diff to previous 1.90 (colored)

require a FREFd fp in dofilereadv. Fix some comments.

Revision 1.90 / (download) - annotate - [select for diffs], Fri Feb 8 18:58:51 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.89: +3 -4 lines
Diff to previous 1.89 (colored)

simplify sys_pread a bit.

Revision 1.89 / (download) - annotate - [select for diffs], Fri Feb 8 13:53:28 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.88: +11 -25 lines
Diff to previous 1.88 (colored)

- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't have
  the same semantics as NetBSD anyway, so it's good to avoid name collissions.
- Always fdremove before freeing the file, not the other way around.
- falloc FREFs the file.
- have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to
  falloc FREFing the file).
- Use closef as much as possible instead of ffree in error paths of
  falloc:ing functions. closef is much more careful with the fd and can
  deal with the fd being forcibly closed by dup2. Also try to avoid
  manually calling *fo_close when closef can do that for us (this makes
  some error paths mroe complicated (sys_socketpair and sys_pipe), but
  others become simpler (sys_open)).

Revision 1.88 / (download) - annotate - [select for diffs], Tue Feb 5 16:02:27 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.87: +11 -10 lines
Diff to previous 1.87 (colored)

Add counting of temporary references to a struct file (as opposed to references
from fd tables and other long-lived objects). This is to avoid races between
using a file descriptor and having another process (with shared fd table)
close it. We use a separate refence count so that error values from close(2)
will be correctly returned to the caller of close(2).

The macros for those reference counts are FILE_USE(fp) and FILE_UNUSE(fp).

Make sure that the cases where closef can be called "incorrectly" (most notably
dup2(2)) are handled.

Right now only callers of closef (and {,p}read) use FILE_{,UN}USE correctly,
more fixes incoming soon.

Revision 1.87 / (download) - annotate - [select for diffs], Mon Feb 4 11:43:16 2002 UTC (22 years, 4 months ago) by art
Branch: MAIN
Changes since 1.86: +3 -2 lines
Diff to previous 1.86 (colored)

Don't ffree the newly allocated file before calling dupfdopen.
In some cases that could cause dupfdopen->fd_getfile to access freed memory
setting fd_ofiles[fd] to NULL is not a solution because that would cause
a race condition.

Free the new file after dupfdopen and use closef (because it will be necessary
in the future.

XXX - consider more cleanup of the code around dupfdopen.

Revision 1.83.2.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:41 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.83: +15 -3 lines
Diff to previous 1.83 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.86 / (download) - annotate - [select for diffs], Mon Jan 21 18:50:45 2002 UTC (22 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.85: +10 -3 lines
Diff to previous 1.85 (colored)

Mount points must fit in MNAMELEN, not MAXPATHLEN so use copyinstr()
to detect whether the path passed in from userland is too long.
Based on a patch from peterw AT ifost.org.au.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jan 18 01:36:29 2002 UTC (22 years, 4 months ago) by mickey
Branch: MAIN
Changes since 1.84: +6 -1 lines
Diff to previous 1.84 (colored)

record ctime for the mountpoint, mount time or last mount update; art@ ok

Revision 1.84 / (download) - annotate - [select for diffs], Wed Dec 19 08:58:06 2001 UTC (22 years, 5 months ago) by art
Branch: MAIN
Changes since 1.83: +4 -7 lines
Diff to previous 1.83 (colored)

UBC was a disaster. It worked very good when it worked, but on some
machines or some configurations or in some phase of the moon (we actually
don't know when or why) files disappeared. Since we've not been able to
track down the problem in two weeks intense debugging and we need -current
to be stable, back out everything to a state it had before UBC.

We apologise for the inconvenience.

Revision 1.62.2.6 / (download) - annotate - [select for diffs], Wed Dec 5 01:02:39 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.62.2.5: +7 -4 lines
Diff to previous 1.62.2.5 (colored) to branchpoint 1.62 (colored)

Merge in -current

Revision 1.83 / (download) - annotate - [select for diffs], Tue Nov 27 05:27:12 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.82: +8 -5 lines
Diff to previous 1.82 (colored)

Merge in the unified buffer cache code as found in NetBSD 2001/03/10. The
code is written mostly by Chuck Silvers <chuq@chuq.com>/<chs@netbsd.org>.

Tested for the past few weeks by many developers, should be in a pretty stable
state, but will require optimizations and additional cleanups.

Revision 1.62.2.5 / (download) - annotate - [select for diffs], Tue Nov 13 23:04:23 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.62.2.4: +2 -4 lines
Diff to previous 1.62.2.4 (colored) to branchpoint 1.62 (colored)

merge in -current

Revision 1.82 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:20 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
Changes since 1.81: +2 -4 lines
Diff to previous 1.81 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.62.2.4 / (download) - annotate - [select for diffs], Wed Oct 31 03:26:29 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.62.2.3: +17 -43 lines
Diff to previous 1.62.2.3 (colored) to branchpoint 1.62 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.81 / (download) - annotate - [select for diffs], Fri Oct 26 12:03:27 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.80: +17 -43 lines
Diff to previous 1.80 (colored)

 - every new fd created by falloc() is marked as larval and should not be used
   any anyone. Every caller of falloc matures the fd when it's usable.
 - Since every lookup in the fd table must now check this flag and all of
   them do the same thing, move all the necessary checks into a function -
   fd_getfile.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Jul 26 20:24:47 2001 UTC (22 years, 10 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE
Branch point for: OPENBSD_3_0
Changes since 1.79: +1 -8 lines
Diff to previous 1.79 (colored)

Back out changes to symlink and mknod that were not well tested.
A simple mknod at causes a kernel panic (uvm_fault).

Revision 1.79 / (download) - annotate - [select for diffs], Thu Jul 26 02:10:41 2001 UTC (22 years, 10 months ago) by assar
Branch: MAIN
Changes since 1.78: +9 -2 lines
Diff to previous 1.78 (colored)

change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations

ok'd by art

Revision 1.62.2.3 / (download) - annotate - [select for diffs], Wed Jul 4 10:48:55 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.62.2.2: +231 -427 lines
Diff to previous 1.62.2.2 (colored) to branchpoint 1.62 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.78 / (download) - annotate - [select for diffs], Wed Jun 27 04:49:48 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.77: +1 -16 lines
Diff to previous 1.77 (colored)

remove old vm

Revision 1.77 / (download) - annotate - [select for diffs], Fri Jun 22 14:14:11 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.76: +218 -220 lines
Diff to previous 1.76 (colored)

KNF

Revision 1.76 / (download) - annotate - [select for diffs], Wed May 23 13:15:07 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.75: +2 -3 lines
Diff to previous 1.75 (colored)

Indentation.

Revision 1.75 / (download) - annotate - [select for diffs], Wed May 16 17:14:36 2001 UTC (23 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.74: +1 -175 lines
Diff to previous 1.74 (colored)

Create COMPAT_25 and move ogetfsstat, ostatfs and ostatfs into it.
Create COMPAT_23 and move __osemctl, omsgctl, oshmctl there.

Revision 1.74 / (download) - annotate - [select for diffs], Wed May 16 05:07:52 2001 UTC (23 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.73: +5 -11 lines
Diff to previous 1.73 (colored)

kill COMPAT_{09,10,11} kernel options.  We still need kern_info_09.c and kern_ipc_10.c for other compat modules.

Revision 1.62.2.2 / (download) - annotate - [select for diffs], Mon May 14 22:32:46 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.62.2.1: +236 -19 lines
Diff to previous 1.62.2.1 (colored) to branchpoint 1.62 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.73 / (download) - annotate - [select for diffs], Mon May 14 15:11:15 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.72: +3 -4 lines
Diff to previous 1.72 (colored)

Isn't copy 'n paste a great invention?

Revision 1.72 / (download) - annotate - [select for diffs], Mon May 14 14:55:48 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.71: +7 -8 lines
Diff to previous 1.71 (colored)

Remove some unnecessary code + some random cleanup.

Revision 1.71 / (download) - annotate - [select for diffs], Sun May 13 02:40:46 2001 UTC (23 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.70: +5 -1 lines
Diff to previous 1.70 (colored)

Add pad argument for p{read,write}v? to the syscall args comment for
consistency with syscallargs.h as well as sys_lseek.

Revision 1.70 / (download) - annotate - [select for diffs], Wed Apr 4 20:19:02 2001 UTC (23 years, 2 months ago) by gluk
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.69: +6 -4 lines
Diff to previous 1.69 (colored)

Add "softdep" option to mount. Update from rw/async to softdep
and otherwise are disabled.

art@ ok.

Revision 1.69 / (download) - annotate - [select for diffs], Fri Mar 16 16:24:57 2001 UTC (23 years, 3 months ago) by art
Branch: MAIN
Changes since 1.68: +15 -12 lines
Diff to previous 1.68 (colored)

Use CIRCLEQ macros for mountlist.

Revision 1.68 / (download) - annotate - [select for diffs], Wed Feb 21 23:24:30 2001 UTC (23 years, 3 months ago) by csapuntz
Branch: MAIN
Changes since 1.67: +5 -4 lines
Diff to previous 1.67 (colored)



Latest soft updates from FreeBSD/Kirk McKusick

Snapshot-related code has been commented out.

Revision 1.67 / (download) - annotate - [select for diffs], Tue Feb 20 01:50:09 2001 UTC (23 years, 3 months ago) by assar
Branch: MAIN
Changes since 1.66: +2 -2 lines
Diff to previous 1.66 (colored)

use void * consistently in vfs_mount and sys_mount.  ok @art

Revision 1.66 / (download) - annotate - [select for diffs], Mon Feb 12 07:03:13 2001 UTC (23 years, 4 months ago) by fgsch
Branch: MAIN
Changes since 1.65: +4 -3 lines
Diff to previous 1.65 (colored)

Check if softdep is enabled for this fs before calling softdep's
fsync; art@ ok.

Revision 1.65 / (download) - annotate - [select for diffs], Thu Apr 20 06:32:00 2000 UTC (24 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.64: +211 -1 lines
Diff to previous 1.64 (colored)

p{read,write}{,v} from csapuntz, partial NetBSD origin I think

Revision 1.64 / (download) - annotate - [select for diffs], Sat Apr 15 19:52:48 2000 UTC (24 years, 2 months ago) by csapuntz
Branch: MAIN
Changes since 1.63: +3 -3 lines
Diff to previous 1.63 (colored)



Fix sys_sync to actually sync all file systems.

Revision 1.62.2.1 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:26 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.62: +6 -2 lines
Diff to previous 1.62 (colored)

Sync with -current

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 3 11:31:43 2000 UTC (24 years, 3 months ago) by art
Branch: MAIN
Changes since 1.62: +6 -2 lines
Diff to previous 1.62 (colored)

Use LIST_ macros instead of internal field names to walk the allproc list.

Revision 1.62 / (download) - annotate - [select for diffs], Mon Feb 7 04:55:19 2000 UTC (24 years, 4 months ago) by assar
Branch: MAIN
CVS Tags: SMP_BASE
Branch point for: SMP
Changes since 1.61: +246 -1 lines
Diff to previous 1.61 (colored)

(sys_getfh): moved here from nfs_syscalls.c
(sys_fhopen, sys_fhstat, sys_fhstatfs): new system calls that use file
handles instead of file names.  largely based on NetBSD

Revision 1.61 / (download) - annotate - [select for diffs], Tue Feb 1 04:03:14 2000 UTC (24 years, 4 months ago) by assar
Branch: MAIN
Changes since 1.60: +1 -2 lines
Diff to previous 1.60 (colored)

remove superflous declaration of vnops, it's now in <sys/file.h>

Revision 1.60 / (download) - annotate - [select for diffs], Mon Dec 6 07:28:06 1999 UTC (24 years, 6 months ago) by art
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.59: +6 -7 lines
Diff to previous 1.59 (colored)

Yet another solution to the mfs unmount/kill race (not ugly this time).
Require that the mount point is vfs_busy on entry to dounmount.

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jul 30 18:27:47 1999 UTC (24 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.58: +20 -1 lines
Diff to previous 1.58 (colored)

do not permit regular users to chflags/fchflags on chr or blk devices --
even if they happen to own them at the moment.

Revision 1.58 / (download) - annotate - [select for diffs], Tue Jul 13 15:17:51 1999 UTC (24 years, 11 months ago) by provos
Branch: MAIN
Changes since 1.57: +4 -4 lines
Diff to previous 1.57 (colored)

introduce fdremove() to mark a file descriptor as unused. fdremove makes
sure that the fd_freefile hints stay in sync, otherwise free file
descriptors might not be overlooked by fdalloc(); ok millert@

Revision 1.57 / (download) - annotate - [select for diffs], Mon May 31 17:34:48 1999 UTC (25 years ago) by millert
Branch: MAIN
Changes since 1.56: +177 -6 lines
Diff to previous 1.56 (colored)

New struct statfs with mount options.  NOTE: this replaces statfs(2),
fstatfs(2), and getfsstat(2) so you will need to build a new kernel
before doing a "make build" or you will get "unimplemented syscall" errors.

The new struct statfs has the following featuires:
o Has a u_int32_t flags field--now softdep can have a real flag.

o Uses u_int32_t instead of longs (nicer on the alpha).  Note: the man
page used to lie about setting invalid/unused fields to -1.  SunOS does
that but our code never has.

o Gets rid of f_type completely.  It hasn't been used since NetBSD 0.9
and having it there but always 0 is confusing.  It is conceivable
that this may cause some old code to not compile but that is better
than silently breaking.

o Adds a mount_info union that contains the FSTYPE_args struct.  This
means that "mount" can now tell you all the options a filesystem was
mounted with.  This is especially nice for NFS.

Other changes:
o The linux statfs emulation didn't convert between BSD fs names
  and linux f_type numbers.  Now it does, since the BSD f_type
  number is useless to linux apps (and has been removed anyway)

o FreeBSD's struct statfs is different from our (both old and new)
and thus needs conversion.  Previously, the OpenBSD syscalls
were used without any real translation.

o mount(8) will now show extra info when invoked with no arguments.
However, to see *everything* you need to use the -v (verbose) flag.

Revision 1.56 / (download) - annotate - [select for diffs], Fri Feb 26 04:51:17 1999 UTC (25 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.55: +21 -2 lines
Diff to previous 1.55 (colored)

adaptation to uvm vnode pager

Revision 1.55 / (download) - annotate - [select for diffs], Mon Feb 15 16:46:57 1999 UTC (25 years, 4 months ago) by art
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored)

reorder some flag handling in unmount for safer locking

Revision 1.54 / (download) - annotate - [select for diffs], Mon Feb 15 16:41:37 1999 UTC (25 years, 4 months ago) by art
Branch: MAIN
Changes since 1.53: +9 -11 lines
Diff to previous 1.53 (colored)

Fail correctly when trying to match a filesystem on the old typenum
and the typenum is out of range

Revision 1.53 / (download) - annotate - [select for diffs], Tue Jan 19 20:52:47 1999 UTC (25 years, 4 months ago) by art
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

Single Unix specification 2 says that rmdir(".") should suceed or give EBUSY

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jan 10 22:47:08 1999 UTC (25 years, 5 months ago) by art
Branch: MAIN
Changes since 1.51: +1 -2 lines
Diff to previous 1.51 (colored)

remove unnecessary declaration of dounmount

Revision 1.51 / (download) - annotate - [select for diffs], Mon Dec 28 19:56:22 1998 UTC (25 years, 5 months ago) by art
Branch: MAIN
Changes since 1.50: +2 -12 lines
Diff to previous 1.50 (colored)

remove old leftovers from lite2 upgrade

Revision 1.50 / (download) - annotate - [select for diffs], Wed Dec 23 10:53:06 1998 UTC (25 years, 5 months ago) by art
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

Opps. the flag that says that we are sleeping is MNT_MWAIT, not MNT_WAIT

Revision 1.49 / (download) - annotate - [select for diffs], Mon Dec 21 13:08:49 1998 UTC (25 years, 5 months ago) by art
Branch: MAIN
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored)

return EOPNOTSUPP when there is no support for this filesystem in the kernel.
This is what most mount_* expect.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Dec 10 23:48:13 1998 UTC (25 years, 6 months ago) by art
Branch: MAIN
Changes since 1.47: +9 -2 lines
Diff to previous 1.47 (colored)

Several fixes to dounmount.
 - Check for MNT_UNMOUNT before doing the actual unmount. It shouldn't
   matter for normal unmounts that go through sys_unmount, because they
   won't be able to do a lookup on the mountpoint when it's being unmounted,
   but mfs calls dounmount directly (and there was still a race).
 - clear the MNT_UNMOUNT flag after reenabling the lock (almost impossible
   race).
 - clear the MNT_MWAIT flag after doing a wakeup on the mountpoint.

Revision 1.47 / (download) - annotate - [select for diffs], Thu Nov 12 04:30:01 1998 UTC (25 years, 7 months ago) by csapuntz
Branch: MAIN
Changes since 1.46: +21 -3 lines
Diff to previous 1.46 (colored)



Integrate latest soft updates patches for McKusick.

Integrate cleaner ffs mount code from FreeBSD. Most notably, this mount
code prevents you from mounting an unclean file system read-write.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Sep 27 03:23:47 1998 UTC (25 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

Only update vfs_refcount when the mount succeeds and MNT_UPDATE not set.

Revision 1.45 / (download) - annotate - [select for diffs], Mon Aug 17 23:26:17 1998 UTC (25 years, 9 months ago) by csapuntz
Branch: MAIN
Changes since 1.44: +4 -2 lines
Diff to previous 1.44 (colored)



Make sure the file system is unbusied on error.

Revision 1.44 / (download) - annotate - [select for diffs], Mon Aug 17 22:19:06 1998 UTC (25 years, 9 months ago) by csapuntz
Branch: MAIN
Changes since 1.43: +6 -8 lines
Diff to previous 1.43 (colored)



Fix turd left over from soft updates patch.

MNT_LAZY is not a bit flag.

Revision 1.43 / (download) - annotate - [select for diffs], Mon Jul 13 05:43:10 1998 UTC (25 years, 11 months ago) by csapuntz
Branch: MAIN
Changes since 1.42: +4 -2 lines
Diff to previous 1.42 (colored)




Part 1) of a fix to the "mount /mnt /mnt" problem.

Don't mount the file system in the kernel name space before calling VFS_MOUNT.

Revision 1.42 / (download) - annotate - [select for diffs], Mon Jul 13 02:11:30 1998 UTC (25 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

ftpd: sleep for an indeterminate amount for non-existant logins
      to simulate a crypt, like login does.
Use SEEK_* not L_* and kill some 0L's used in lseek while we're there.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Apr 25 07:14:47 1998 UTC (26 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

readlink() 3rd param is size_t; XPG

Revision 1.40 / (download) - annotate - [select for diffs], Mon Apr 6 09:00:58 1998 UTC (26 years, 2 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.39: +3 -1 lines
Diff to previous 1.39 (colored)

Missing wakeup in unmount error case, yet another amiga release staller :-)

Revision 1.39 / (download) - annotate - [select for diffs], Wed Mar 25 19:44:50 1998 UTC (26 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +11 -1 lines
Diff to previous 1.38 (colored)

for *utimes(), deal with tv_sec == VNOVAL; problem noted by syssgm@dtir.qld.gov.au

Revision 1.38 / (download) - annotate - [select for diffs], Mon Feb 16 21:56:29 1998 UTC (26 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Make "flags" field in f?chflags(2) consistent--unsigned int

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jan 9 16:21:55 1998 UTC (26 years, 5 months ago) by csapuntz
Branch: MAIN
Changes since 1.36: +23 -5 lines
Diff to previous 1.36 (colored)

A better fix for the mkdir ("path/") bug. This fix strips the trailing slashes
(except in the case where the path is just /////) in the following three
cases:

1) The path in mkdir
2) The destination path in rename if the source was a directory
3) The destination path in link if the source was a directory

Note #3 isn't strictly necessary since most of our file systems don't
support hard links of directories anyway.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jan 2 05:42:49 1998 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.35: +5 -1 lines
Diff to previous 1.35 (colored)

make {f,}chflags(.., -1) return EINVAL because -1 is VNOVAL; problem noted by provos

Revision 1.35 / (download) - annotate - [select for diffs], Thu Dec 11 03:16:34 1997 UTC (26 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +7 -7 lines
Diff to previous 1.34 (colored)

do not clear setuid/setgid for *chmod(-1,-1); pointed out by provos

Revision 1.34 / (download) - annotate - [select for diffs], Tue Dec 9 09:34:36 1997 UTC (26 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +13 -4 lines
Diff to previous 1.33 (colored)

fix O_TRUNC and O_{SH,EX}LOCK properly; problem found by provos

Revision 1.33 / (download) - annotate - [select for diffs], Mon Nov 24 22:42:38 1997 UTC (26 years, 6 months ago) by niklas
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

Fix non-DIAGNOSTIC (and non-COMPAT*) compilation

Revision 1.32 / (download) - annotate - [select for diffs], Thu Nov 20 07:15:38 1997 UTC (26 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.31: +19 -2 lines
Diff to previous 1.31 (colored)

Fix for open(2) when O_TRUNC and O_??LOCK are used together.  I
ran the fix by Kirk, who said it was an OK solution and pointed
out two problems.

Revision 1.31 / (download) - annotate - [select for diffs], Tue Nov 18 06:59:59 1997 UTC (26 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

Use 0177777, not 07777 as the mask to check for EINVAL.  This allows
one to use the st_mode field in struct stat as an argument to f?chmod().

Revision 1.30 / (download) - annotate - [select for diffs], Mon Nov 17 07:46:24 1997 UTC (26 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

only consider 9 bits for the umask

Revision 1.29 / (download) - annotate - [select for diffs], Mon Nov 17 06:00:52 1997 UTC (26 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.28: +7 -1 lines
Diff to previous 1.28 (colored)

make chmod() and fchmod() return EINVAL for bad mode bits

Revision 1.28 / (download) - annotate - [select for diffs], Thu Nov 6 05:58:29 1997 UTC (26 years, 7 months ago) by csapuntz
Branch: MAIN
Changes since 1.27: +226 -184 lines
Diff to previous 1.27 (colored)

Updates for VFS Lite 2 + soft update.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Oct 6 20:20:14 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.26: +183 -225 lines
Diff to previous 1.26 (colored)

back out vfs lite2 till after 2.2

Revision 1.26 / (download) - annotate - [select for diffs], Mon Oct 6 15:12:43 1997 UTC (26 years, 8 months ago) by csapuntz
Branch: MAIN
Changes since 1.25: +226 -184 lines
Diff to previous 1.25 (colored)

VFS Lite2 Changes

Revision 1.25 / (download) - annotate - [select for diffs], Sun Mar 2 09:38:35 1997 UTC (27 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

Add noatime option to not update atime on files in a filesystem (unless
ctime or mtime has changed).  Useful for laptops and news servers.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Feb 26 16:38:20 1997 UTC (27 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.23: +9 -5 lines
Diff to previous 1.23 (colored)

From tholo: Do not do strict POSIX offset checking on character devices.
This fixes the problem of not being able to read kernel virtual memory on
the alpha, thus breaking things like ps etc.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Feb 14 17:20:09 1997 UTC (27 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +7 -1 lines
Diff to previous 1.22 (colored)

hide fsid in getfsstat too, clone of millert fix, problem spotted by bitblt

Revision 1.22 / (download) - annotate - [select for diffs], Thu Feb 13 02:45:43 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.21: +15 -1 lines
Diff to previous 1.21 (colored)

Don't expose f_fsid to non-root.

Revision 1.21 / (download) - annotate - [select for diffs], Sun Feb 2 00:32:02 1997 UTC (27 years, 4 months ago) by tholo
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

Prevent seeking to negative offsets when seeking from the end of a file;
noticed by Tim Newsham <newsham@aloha.net>

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jan 26 05:18:29 1997 UTC (27 years, 4 months ago) by downsj
Branch: MAIN
Changes since 1.19: +53 -1 lines
Diff to previous 1.19 (colored)

Add lchown(2).

Revision 1.19 / (download) - annotate - [select for diffs], Sat Jan 25 00:27:31 1997 UTC (27 years, 4 months ago) by dm
Branch: MAIN
Changes since 1.18: +7 -1 lines
Diff to previous 1.18 (colored)

Only disclose generation number to root.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Jan 2 12:20:40 1997 UTC (27 years, 5 months ago) by mickey
Branch: MAIN
Changes since 1.17: +18 -45 lines
Diff to previous 1.17 (colored)

pulled out the duplicated, conditional code from both kern/vfs_syscalls.c
and compat/common/vfs_syscalls_43.c and placed a single copy of that code
into miscfs/union/union_subr.c (seemed like a good place to put it, since
it's union-fs related).
as a side effect you can build unionfs in lkm.
(netbsd pr#2950, Paul Goyette <paul@pgoyette.bdt.com>)

Revision 1.17 / (download) - annotate - [select for diffs], Sun Oct 27 08:02:32 1996 UTC (27 years, 7 months ago) by tholo
Branch: MAIN
Changes since 1.16: +11 -1 lines
Diff to previous 1.16 (colored)

Better error checking for lseek(2)

Revision 1.16 / (download) - annotate - [select for diffs], Sat Oct 26 07:27:01 1996 UTC (27 years, 7 months ago) by tholo
Branch: MAIN
Changes since 1.15: +3 -7 lines
Diff to previous 1.15 (colored)

rename(from, to) where from and to are the name file (linked) is a no-op

Revision 1.15 / (download) - annotate - [select for diffs], Fri Oct 4 01:26:48 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.14: +5 -1 lines
Diff to previous 1.14 (colored)

usermount sysctl, default to prevent users from using mount syscall

Revision 1.14 / (download) - annotate - [select for diffs], Tue Sep 24 02:40:12 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +3 -1 lines
Diff to previous 1.13 (colored)

no mknod in chroot

Revision 1.13 / (download) - annotate - [select for diffs], Tue Sep 24 02:38:30 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +10 -2 lines
Diff to previous 1.12 (colored)

unescapeable chroot; thanks to nirva and asriel for helping

Revision 1.12 / (download) - annotate - [select for diffs], Thu Aug 8 06:36:47 1996 UTC (27 years, 10 months ago) by tholo
Branch: MAIN
Changes since 1.11: +23 -19 lines
Diff to previous 1.11 (colored)

Make {,f}chown(2) behaviour POSIX.1 compliant with SUID / SGID files
Enable CTL_FS processing by sysctl(3)
Add CTL_FS request to disable clearing SUID / SGID bit when a files owner
or group is changed by root
Make sysctl(8) understand CTL_FS requests

Revision 1.11 / (download) - annotate - [select for diffs], Thu Aug 8 04:23:03 1996 UTC (27 years, 10 months ago) by tholo
Branch: MAIN
Changes since 1.10: +27 -1 lines
Diff to previous 1.10 (colored)

Lose the SUID bit if owner changes in {,f}chown
Lose the SGID bit if group changes in {,f}chown

Revision 1.10 / (download) - annotate - [select for diffs], Fri Aug 2 19:59:01 1996 UTC (27 years, 10 months ago) by tholo
Branch: MAIN
Changes since 1.9: +3 -1 lines
Diff to previous 1.9 (colored)

Return EINVAL for invalid mode flags to access(2)

Revision 1.9 / (download) - annotate - [select for diffs], Sun Jun 2 16:24:42 1996 UTC (28 years ago) by niklas
Branch: MAIN
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored)

explictly state getvnode's  return type

Revision 1.8 / (download) - annotate - [select for diffs], Tue May 14 18:24:21 1996 UTC (28 years, 1 month ago) by mickey
Branch: MAIN
Changes since 1.7: +4 -4 lines
Diff to previous 1.7 (colored)

fix NetBSD PR#1145.

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 2 13:09:53 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +55 -7 lines
Diff to previous 1.6 (colored)

Implement futimes()

Revision 1.6 / (download) - annotate - [select for diffs], Sun Apr 21 22:27:39 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.5: +7 -7 lines
Diff to previous 1.5 (colored)

partial sync with netbsd 960418, more to come

Revision 1.5 / (download) - annotate - [select for diffs], Wed Apr 17 05:09:14 1996 UTC (28 years, 2 months ago) by mickey
Branch: MAIN
Changes since 1.4: +4 -3 lines
Diff to previous 1.4 (colored)

Removed vax ifdefed function from kern_subr.c (from NetBSD).
Do sync in the order of umount (vfs_syscals.c), as it was pointed
by someone in NetBSD's lists.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Feb 29 13:38:58 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.3: +156 -145 lines
Diff to previous 1.3 (colored)

From NetBSD: Merge with NetBSD 960217

Revision 1.3 / (download) - annotate - [select for diffs], Mon Nov 13 04:05:22 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

indenting error thing that is making my diffs look confusing

Revision 1.2 / (download) - annotate - [select for diffs], Thu Nov 9 06:08:38 1995 UTC (28 years, 7 months ago) by chuck
Branch: MAIN
Changes since 1.1: +6 -0 lines
Diff to previous 1.1 (colored)

ufs vs ffs compat stuff from Gordon Ross.    Gordon says:

	This allows the 1.0 version of /sbin/mount to work with the latest
	kernels.  (Being unable to mount disks is a real drag...)

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:52:48 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:52:48 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.