Commit Graph

462 Commits

Author SHA1 Message Date
njoly 6be7ae0a4a Apply fix from hannken to ensure that VOP_ACCESS() is called on a
locked vnode for fd_nameiat(), fd_nameiat_simple() and do_sys_openat().
Fix both PR/47226 and PR/47255.
2012-11-30 13:26:37 +00:00
martin daab85cca7 Use copyout to copy data from kernel out to userland!
Fixes PR kern/47217.
2012-11-19 15:01:17 +00:00
manu a76c1cc17f Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
2012-11-18 17:41:51 +00:00
riastradh 8db30059ca No, we can't elide the fs-wide rename lock for same-directory rename.
rename("a/b", "a/c") and rename("a/c/x", "a/b/y") will deadlock.

Darn.
2012-10-19 02:07:22 +00:00
riastradh a807072402 Disentangle do_sys_rename.
Elide the fs-wide rename lock for single-directory renames.  This
required changing the order of lookups, so that we know what the
directories are before we lock the nodes.

Clean up error branches, explain why various nonsense happens and
what it does and doesn't do, and note some of what needs to change.
2012-10-12 02:37:20 +00:00
cheusov b6b59f4935 Add new action KAUTH_CRED_CHROOT for kauth(9)'s credential scope.
Reviewed and approved by elad@.
2012-06-27 12:28:28 +00:00
gson 425e23f1fe Move VFS_EXTATTRCTL to mount_domount(). This makes the
fs/puffs/t_fuzz:mountfuzz7, fs/puffs/t_fuzz:mountfuzz8,
and fs/zfs/t_zpool:create tests pass again.  Patch from
manu, discussed on tech-kern and committed at his request.
2012-05-08 08:44:49 +00:00
rmind d9290bb010 do_open: move pathbuf destruction to the callers, thus simplify and fix a
memory leak on error path.
2012-05-02 20:48:29 +00:00
manu 8658637414 Fix the extattr start fix. Looking up the filesystemroot vnode again
does not seems to be reliable. Instead save it before mount_domount()
sets it to NULL.
2012-04-30 10:05:12 +00:00
manu 74a73d8b5c Fix mount -o extattr : previous patch fixed a panic but caused operation
to happen on the mount point instead of the mounted filesystem.
2012-04-30 03:51:10 +00:00
manu 57f4d08bde Do not use vp after mount_domount() call as it sets it to NULL on success.
This fixes a panic when starting extended attributes.
2012-04-28 17:30:19 +00:00
christos ec252a38db it is not an error if the kernel needs to clear the setuid/
setgid bit on write/chown/chgrp
2012-04-17 19:15:15 +00:00
elad 0c9d8d15c9 Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

    http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
    http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
    http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
2012-03-13 18:40:26 +00:00
martin 0b454a86a3 fd_open(): fix confusion between userland and kernel encoding of open flags 2012-02-12 13:12:45 +00:00
martin f8c7c04bbe Add a posix_spawn syscall, as discussed on tech-kern.
Based on the summer of code project by Charles Zhang, heavily reworked
later by me - all bugs are likely mine.
Ok: core, releng.
2012-02-11 23:16:15 +00:00
dholland 832d4ca72b Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)
2012-02-01 05:46:45 +00:00
dholland d2d6fa0ae1 Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.
2012-02-01 05:43:53 +00:00
dholland a90e43f7de Split out a do_sys_quotactl for compat_netbsd32. 2012-02-01 05:39:28 +00:00
dholland 59b296daa7 Change the syscall API for quotas over to the new non-proplib one.
- struct vfs_quotactl_args -> struct quotactl_args
   - add sys/stdint.h to sys/quotactl.h for clean userland build
   - install sys/quotactl.h in /usr/include
   - update set lists for same
   - add new marshalling code in libquota
   - add new unmarshalling code in vfs_syscalls.c
   - discard proplib interpreter code in vfs_quotactl.c
   - add dispatching code for the 14 quotactl ops in vfs_quotactl.c
   - mark the proplib quotactl syscall obsolete
   - add a new syscall number for the new quotactl syscall
   - change the name of the syscall to __quotactl()
   - remove the decl of the old quotactl from quota/quotaprop.h
   - add a decl of the new quotactl to sys/quotactl.h
   - update the libc build
   - update ktruss
   - remove proplib marshalling code from libquota
   - update copy of syscall table in gdb ppc sources
   - hack rumphijack to accomodate new quotactl name (as I recall,
     pooka wanted such a name change to simplify something, but I
     don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
2012-02-01 05:34:38 +00:00
dholland b0d7bab70f Add vfs_quotactl() in between the syscall and VFS_QUOTACTL. Call it
from the COMPAT_50 code as well as the current sys_quotactl instead
of going directly to VFS_QUOTACTL. Doesn't actually do anything yet.
2012-01-29 06:29:04 +00:00
yamt 32dbfff8e1 fix an indent an unwarp a short line. 2011-12-02 12:30:14 +00:00
christos 953ea7db3e - collect the long (and sometimes incomplete) lists of basic flags into
the header file and use that.
- sort the list of basic flags
- add MNT_RELATIME, ST_RELATIME
- mask all the op flags, for symmetry.

The real bit difference is (which is harmless):
    - mount was missing MNT_EXTATTR
    - update sets MNT_RDONLY twice
    - ops also could or in MNT_GETARGS, but this is impossible because the
      code would have chosen to do getargs then.
2011-11-18 21:17:45 +00:00
hannken 2cc7a01f10 Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock.  Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
2011-10-14 09:23:28 +00:00
enami 39dd5517da Remove return statement which can't be reached. 2011-08-22 22:12:34 +00:00
enami 9d6dd8515a When both nanoseconds fields of futimens/utimensat call are set
to UTIMES_NOW, act as if NULL is passed to second argument, i.e.,
do same permission check and set exactly same value to both access
and modification time.
2011-08-22 22:09:07 +00:00
manu bf2e0cc4e9 Fix utimes/futimes after utimensat/futimens addition 2011-08-18 19:34:47 +00:00
manu 91009c117a Missing bit in previous commit: do_sys_utimens prototype in the right
place.
2011-08-17 09:29:59 +00:00
martin e9d191bffa add missing prototype 2011-08-17 08:31:27 +00:00
manu 5b61306f9b Add futimens(2) and part of utimnsat(2) 2011-08-17 07:22:33 +00:00
manu 9db30be448 First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.

Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
2011-08-08 12:08:52 +00:00
martin d43085eb02 Make sure to not overwrite error if it already is EEXISTS - hopefully
will fix > 100 failing fs tests in my last test run.
2011-07-24 09:40:10 +00:00
hannken 3e2f3eaf50 Return EINVAL when trying to create a device node with "rdev == VNOVAL".
Fixes PR #45111 "tmpfs panic with mknod(2)".
2011-07-03 15:25:09 +00:00
manu 448e1c49b2 Add mount -o extattr option to enable extended attributs (corrently only
for UFS1).
Remove kernel option for EA backing store autocreation and do it by
default. Add a sysctl so that autocreated attriutr size can be modified.
2011-06-17 14:23:50 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
uebayasi 064389cedb Fix build; p was not used, but l was passed to kauth. Use curlwp directly. 2011-06-11 03:00:19 +00:00
matt 1f1f4e99e8 l isn't used. nuke it. 2011-06-10 21:02:46 +00:00
uebayasi 282c08f330 do_sys_rename: Kill an unused variable. 2011-06-10 13:07:14 +00:00
dsl ce8178264d Don't directly call sys_sync() from random bits of code, instead
add do_sys_sync() that takes an 'lwp' (for l_cred) as an argument.
Explicitly pass &lwp0 rather than NULL and expecting sys_sync to
  substitute some random lwp.
2011-06-05 09:04:22 +00:00
dsl 2ab3977571 Fix type in comment
(before I replace the 'l' with 'curlwp')
2011-06-02 18:54:43 +00:00
rmind 800683e30d sys_link: prevent hard links on directories (cross-mount operations are
already prevented).  File systems are no longer responsible to check this.
Clean up and add asserts (note that dvp == vp cannot happen in vop_link).

OK dholland@
2011-04-24 21:35:29 +00:00
christos a73f7b01d5 - Add O_CLOEXEC to open(2)
- Add fd_set_exclose() to encapsulate uses of FIO{,N}CLEX, O_CLOEXEC, F{G,S}ETFD
- Add a pipe1() function to allow passing flags to the fd's that pipe(2)
  opens to ease implementation of linux pipe2(2)
- Factor out fp handling code from open(2) and fhopen(2)
2011-04-10 15:45:33 +00:00
rmind 756122ce22 Remove unused M_MOUNT. 2011-04-02 04:57:35 +00:00
rmind fbc8beae75 Split off parts of vfs_subr.c into vfs_vnode.c and vfs_mount.c modules.
No functional change.  Discussed on tech-kern@.
2011-04-02 04:28:56 +00:00
yamt 448a616abd prevent cross-mount operations. 2011-03-12 07:16:50 +00:00
bouyer 063f96f3c2 merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
2011-03-06 17:08:10 +00:00
dholland 15e33f3bf4 Revert previous, which doesn't cover all the cases if F_OK isn't 0,
and just CTASSERT that it is, as that's not remotely likely to change.
Per source-changes-d; ok by Christos.
2011-02-28 03:23:44 +00:00
christos 6f2f866802 don't depend on F_OK being 0. 2011-02-28 00:12:15 +00:00
dholland 45b74603dd Check for bogus flags to access() up front. Otherwise we end up
calling VOP_ACCESS with flags 0 and something asserts deep in the
bowels of kauth. PR 44648 from Taylor Campbell. (I moved the check
earlier relative to the suggested patch.)

Pullup candidate.
2011-02-27 23:06:40 +00:00
pooka 4a92140584 allow file system to decide if it can be downgraded from r/w to r/o 2011-01-13 07:25:50 +00:00
dholland 6d2ff39e83 Remove remaining references to SAVESTART. 2011-01-02 05:12:33 +00:00