Commit Graph

96 Commits

Author SHA1 Message Date
mlelstv d4e64f4071 At least fetch mount data pointer before using it.
Coverity CID 274767
2013-12-25 11:15:49 +00:00
hannken 7e0115bce6 It is not the task of sysvbfs_open() to check for unlinked nodes. 2013-12-24 09:56:18 +00:00
pooka b2d1226abe Don't change a read-only file system. 2013-05-15 16:44:03 +00:00
plunky 5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
agc 4775edcbb6 calculate inode capacities using the correct values 2012-06-14 01:08:22 +00:00
joerg 15a60c04b8 Ensure that error is initialized in all code paths. 2012-06-13 22:56:50 +00:00
agc 6b981736db cosmetic change: fix two casts to be of the appropriate type 2012-06-11 21:11:40 +00:00
tsutsui 8eac82d05c Move bfs_file_setsize() from bfs.c to sysvbfs_vnops.c
(and rename it to sysvbfs_file_setsize()) because it's actually
part of vnode ops and bfs.c is also pulled by standalone bootloaders
which don't want vnode header mess.
2012-05-08 14:28:55 +00:00
chs 8306a9eddf change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
2012-04-29 22:53:59 +00:00
njoly 6b7e4e42d8 sysvbfs do not support file flags; fail with EOPNOTSUPP. 2012-03-30 18:27:55 +00:00
christos 65f52d6225 handle file resizing. 2012-03-18 02:40:55 +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
njoly af1deb8b05 Check credentials when setting uid, gid or mode attributes. 2012-01-27 21:46:42 +00:00
njoly 973e485533 Start making fs read(2) fail with EISDIR if the implementation does
not allow read on directories (kernfs, rumpfs, ptyfs and sysvbfs).
Adjust man page accordingly, and add a small corresponding vfs
testcase.
2011-12-12 19:11:21 +00:00
christos 3cc8e640ed remove unused call to DIOCGPART that was only used for debugging.
malloc M_WAITOK, does not fail.
2011-11-13 23:07:11 +00:00
njoly 8b2b6e057f Add function name to a few debug messages. 2011-07-13 19:51:29 +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
rmind 4a4e52516e Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
2011-05-19 03:11:55 +00:00
hannken 87522af425 Change vflushbuf() to return an error if a synchronous write fails.
Welcome to 5.99.51.
2011-04-26 11:32:38 +00:00
njoly 7ca6722553 In sysvbfs_lookup(), deny last component write operation on a
read-only mount.
Fix PR/44302: sysvbfs allows unlink on fs mounted MNT_RDONLY.

Reviewed by pooka.
2011-01-31 18:48:50 +00:00
dholland 14402d0ff1 Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
2010-11-30 10:43:01 +00:00
dholland d4eb05390d Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
2010-11-30 10:29:57 +00:00
njoly 9cd958c424 Make sysvbfs rename work for filenames longer than {NAME_MAX}. 2010-07-26 13:43:26 +00:00
hannken 99afd136d0 It makes no sense to call vget() with LK_RETRY. 2010-07-25 09:54:37 +00:00
hannken fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
njoly a1bce59b7f Fix build with SYSVBFS_VNOPS_DEBUG. 2010-07-17 00:13:42 +00:00
njoly c6aea3ff65 Small typo in comment. 2010-07-16 23:41:01 +00:00
njoly a28e233447 Do set f_namemax at mount, to provide sensible value for statvfs(2)
calls.
2010-07-07 16:19:55 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
pooka 704f8889fa Mark files removed in the in-memory structure. This allows us
to do two things:

 1) properly set "recycle?" in inactive
 2) easily check if we are renaming a removed vnode.  without the
    check, it was possible to enter a dirent in the file system for
    a removed (and hence scheduled to be vcleaned) vnode.  this would
    lead to the succesful vget() of a clean vnode.  the use of the
    cleaned vnode was, however, less succesful, except for purposes
    of crashing.
2010-05-27 23:40:12 +00:00
pooka 32de8f7733 Release pathname buffers after use. 2010-05-27 13:22:02 +00:00
pooka c9f42ce961 fix refcounting 2010-05-26 21:27:00 +00:00
pooka 19264c8c5c Initialize *vpp to NULL: relookup() requires it without initializing
the value before the call (yea, changing relookup would probably
be smart, but other file systems already initialize vpp, so I'm
letting someone else experiment with tylenol od).
2010-05-26 17:52:35 +00:00
pooka c3183f3251 The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change
2010-01-08 11:35:07 +00:00
mbalmer 982581e04d Remove extra semicolons. 2010-01-05 13:30:10 +00:00
pooka 3f331fa147 Call VOP_CLOSE() in mount error branch with the device locked to
prevent crash when specfs attempts to unlock the vnode.
2009-12-01 09:28:02 +00:00
pgoyette c2a56cbb37 Define error before using it.
(Hello again, elad!)
2009-07-03 22:38:08 +00:00
elad 009f5d2f88 Where possible, extract the file-system's access() routine to two internal
functions: the first checking if the operation is possible (regardless of
permissions), the second checking file-system permissions, ACLs, etc.

Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005311.html
2009-07-03 21:17:40 +00:00
dholland effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
elad 870920260d Move the implementation of vaccess() to genfs_can_access(), in line with
the other routines of the same spirit.

Adjust file-system code to use it.

Keep vaccess() for KPI compatibility and to keep element of least
surprise. A "diagnostic" message warning that vaccess() is deprecated will
be printed when it's used (obviously, only in DIAGNOSTIC kernels).

No objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/06/21/msg005310.html
2009-06-23 19:36:38 +00:00
uch c519d37fde added error check. 2009-04-26 12:41:59 +00:00
elad 9670d2e41d Add genfs_can_mount() and use it to prevent some more code duplication of
the security checks when mounting a device (VOP_ACCESS() + kauth(9) call)).

Proposed with no objections on tech-kern@:

	http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004859.html

The vnode is always expected to be locked, so no locking is done outside
the file-system code.
2009-04-25 18:53:43 +00:00
pooka 6d35065877 * create only one vnode per inode
* add locking
2009-04-09 09:56:30 +00:00
pooka 42ca2fba4f VOP_CLOSE in error branches 2009-04-09 07:55:55 +00:00
pooka b4099c3e1d Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
2008-11-26 20:17:33 +00:00
pooka 010ce4930e more <sys/buf.h> police 2008-11-16 19:34:29 +00:00
pooka 811ee024bf Actually, use FWRITE for device open only if we aren't doing MNT_RDONLY.
This still allows to mount read-only images with -o ro.
2008-09-04 12:28:14 +00:00
pooka 9e37085d2e Install sysvbfs argument structure header into userlandia. 2008-09-04 12:07:29 +00:00
pooka 4e73c87bfa Open devvp for both reading and writing. 2008-09-04 12:02:10 +00:00
hannken 5d2bff060a Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write.  Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn().  If set the caller
  intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
  may clear the buffer and runs copy-on-write.  Process possible errors
  from getblk() or fscow_run().  Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2008-05-16 09:21:59 +00:00