summaryrefslogtreecommitdiff
path: root/sys/miscfs/procfs
AgeCommit message (Collapse)Author
2022-06-17Add missing permission checkshm
2022-03-27dedup the eofs link/symlink methodschristos
2022-01-19Now that an inline function dereferences it, make sure struct procmartin
is declared by including sys/proc.h here.
2022-01-17If the calling process is running under linux emulation, make /proc/xxx/fd/bouyer
return only symlinks pointing to the original file in the filesystem, instead of a hard link. This matches the linux behavior, and some linux programs relies on it (they unconditionally call readlink() on /proc/xxx/fd/yy and don't deal with it returning EINVAL). Proposed on tech-kern@ in http://mail-index.netbsd.org/tech-kern/2022/01/11/msg027877.html
2022-01-14Fix emul and exe DT_ types (from RVP, as was the previous commit)christos
2022-01-14Put the appropriate DT_ constant in the dirent structure depending on thechristos
file type.
2022-01-11remove redundant error initialization and break earlier. (from rvp)christos
2022-01-11Use a single "p" variable.hannken
Should fix PR kern/56614: kernel panic on tmux
2022-01-10use a single nc variable.christos
2022-01-10Fix locking in the error path (from RVP). Centralize unlock code.christos
2021-12-08s/efficent/efficient/ in comments.andvar
2021-10-05PR/53299: RVP: kernfs and procfs are broken when sysctl security.curtainchristos
is enabled
2021-07-18Abolish all the silly indirection macros for initializing vnode ops tables.dholland
These are things of the form #define foofs_op genfs_op, or #define foofs_op genfs_eopnotsupp, or similar. They serve no purpose besides obfuscation, and have gotten cutpasted all over everywhere.
2021-06-29- Add a new vnode op: VOP_PARSEPATH.dholland
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath. - Add a parsepath entry to every vnode ops table. VOP_PARSEPATH takes a directory vnode to be searched and a complete following path and chooses how much of that path to consume. To begin with, all parsepath calls are genfs_parsepath, which locates the first '/' as always. Note that the call doesn't take the whole struct componentname, only the string. The other bits of struct componentname should not be needed and there's no reason to cause potential complications by exposing them.
2021-06-28VOP_BMAP() may be called via ioctl(FIOGETBMAP) on any vnode that applicationschs
can open. change various pseudo-fs *_bmap methods return an error instead of panic. Reported-by: syzbot+8289a3eaf2ba60958c87@syzkaller.appspotmail.com
2020-12-28Fix procfs environ node.riastradh
2020-09-05Round of uvm.h cleanup.riastradh
The poorly named uvm.h is generally supposed to be for uvm-internal users only. - Narrow it to files that actually need it -- mostly files that need to query whether curlwp is the pagedaemon, which should maybe be exposed by an external header. - Use uvm_extern.h where feasible and uvm_*.h for things not exposed by it. We should split up uvm_extern.h but this will serve for now to reduce the uvm.h dependencies. - Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use UVMHIST(ubchist), since ubchist is declared in uvm.h but the reference evaporates if UVMHIST is not defined, so we reduce header file dependencies. - Make uvm_device.h and uvm_swap.h independently includable while here. ok chs@
2020-06-27Introduce genfs_pathconf() and use it for the default case in all filesystems.christos
2020-06-11Counter tweaks:ad
- Don't need to count anonpages+filepages any more; clean+unknown+dirty for each kind of page can be summed to get the totals. - Track the number of free pages with a counter so that it's one less thing for the allocator to do, which opens up further options there. - Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot. For the cheap option, give cpu_count_sync() a boolean parameter indicating that a cached value is okay, and rate limit the updates for cached values to hz.
2020-06-11uvm_availmem(): give it a boolean argument to specify whether a recentad
cached value will do, or if the very latest total must be fetched. It can be called thousands of times a second and fetching the totals impacts not only the calling LWP but other CPUs doing unrelated activity in the VM system.
2020-05-31struct statvfs is too large for stack. Use malloc(9) instead.rin
XXX Switch to kmem(9) for entire this file. Frame size, e.g. for m68k, becomes: 3292 --> 12
2020-05-23Move proc_lock into the data segment. It was dynamically allocated becausead
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2020-05-16Add ACL support for FFS. From FreeBSD.christos
2020-04-29Put forward declaration a little further forward to unbreak build.riastradh
2020-04-29If the procfs mount is marked as linux-compat, then allow proc lookupthorpej
by any LWP ID in the proc, not just the canonical PID.
2020-04-21Revert the changes made in February to make cwdinfo use mostly lockless,ad
which relied on taking extra vnode refs. Having benchmarked various experimental changes over the past few months it seems that it's better to avoid vnode refs as much as possible. cwdi_lock as a RW lock already did that to some extent for getcwd() and will permit the same for namei() too.
2020-04-20Add missing include of <sys/atomic.h> to fix the buildmartin
2020-04-20Sort include files.htodd
2020-04-20Add missing include to fix build.htodd
2020-04-19- Only increment nprocs when we're creating a new process, not justthorpej
when allocating a PID. - Per above, proc_free_pid() no longer decrements nprocs. It's now done in proc_free() right after proc_free_pid(). - Ensure nprocs is accessed using atomics everywhere.
2020-04-04Merge the remaining changes from the ad-namecache branch, affecting namei()ad
and getcwd(): - push vnode locking back as far as possible. - do most lookups directly in the namecache, avoiding vnode locks & refs. - don't block new refs to vnodes across VOP_INACTIVE(). - get shared locks for VOP_LOOKUP() if the file system supports it. - correct lock types for VOP_ACCESS() / VOP_GETATTR() in a few places. Possible future enhancements: - make the lookups lockless. - support dotdot lookups by being lockless and inferring absence of chroot. - maybe make it work for layered file systems. - avoid vnode references at the root & cwd.
2020-03-16Use the module subsystem's ability to process SYSCTL_SETUP() entries topgoyette
automate installation of sysctl nodes. Note that there are still a number of device and pseudo-device modules that create entries tied to individual device units, rather than to the module itself. These are not changed.
2020-02-24v_interlock -> vmobjlockad
2020-02-23Merge from ad-namecache:ad
- Have a stab at clustering the members of vnode_t and vnode_impl_t in a more cache-conscious way. With that done, go back to adjusting v_usecount with atomics and keep vi_lock directly in vnode_impl_t (saves KVA). - Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT(). Make sure LK_UPGRADE always comes with LK_NOWAIT. - Make cwdinfo use mostly lockless.
2020-02-01Load struct filedesc::fd_dt with atomic_load_consume.riastradh
Exceptions: when fd_refcnt <= 1, or when holding fd_lock. While here: - Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused. => This is used only in fd_close and fd_abort, where it holds. - Move bounds check assertion in fd_putfile to where it matters. - Store fd_dt with atomic_store_release. - Move load of fd_dt under lock in knote_fdclose. - Omit membar_consumer in fdesc_readdir. => atomic_load_consume serves the same purpose now. => Was needed only on alpha anyway.
2020-01-17VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, toad
allow us to get shared locks (or no lock) on the returned vnode. Matches FreeBSD.
2020-01-02- Eliminate the global "boottime" variable, which was being accessedthorpej
without any synchronization against changes by e.g. clock_settime(). - Replace with new getbinboottime() / getnanoboottime() / getmicroboottime() functions (naming mirrors that of other time access functions in kern_tc.c). It returns the (maybe-converted) value of timebasebin, which also tracks our estimate of when the system was booted (i.e. the legacy "boottime" was redundant). XXX There needs to be a lockless synchronization mechanism for reading timebasebin, but this is a problem in kern_tc.c that pre-existed these "boottime" changes. At least now the problem is centralized in one location.
2019-12-31Rename uvm_free() -> uvm_availmem().ad
2019-12-21uvmexp.free -> uvm_free()ad
2019-12-16- Extend the per-CPU counters matt@ did to include all of the hot countersad
in UVM, excluding uvmexp.free, which needs special treatment and will be done with a separate commit. Cuts system time for a build by 20-25% on a 48 CPU machine w/DIAGNOSTIC. - Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
2019-09-27Instead of casting to size_t, cast to uintmax_t to prevent truncationchristos
(pointed out by chuq). In all these cases uio_offset can't be negative.
2019-09-26fix sign-compare issues: uio->uio_offset (off_t) is compared with (size_t):christos
cast the offset to size_t.
2019-09-26Rewrite the procfs_fileno as an inline function to make it more clear whatchristos
it does...
2019-09-07have procfs_do_pid_stat() pass the proc's map to get_proc_size_info(),chs
rather than having the latter look up the map again and not check for an error.
2019-08-29Add missing operation VOP_GETPAGES() returning EFAULT.hannken
Without this operation posix_fadvise(..., POSIX_FADV_WILLNEED) would leave the v_interlock held. Observed by maxv@
2019-08-23Fix info leaks.maxv
2019-04-25Restore mapping of file id to pid/type/fd.mlelstv
Use 64bit file id to allow for 32bit fd and 25-26bit pid.
2019-03-30add a node for the process resource limits.christos
2018-12-05As discussed in tech-kern:christos
- make sysctl kern.expose_address tri-state: 0: no access 1: access to processes with open /dev/kmem 2: access to everyone defaults: 0: KASLR kernels 1: non-KASLR kernels - improve efficiency by calling get_expose_address() per sysctl, not per process. - don't expose addresses for linux procfs - welcome to 8.99.27, changes to fill_*proc ABI
2018-10-14remove M_CANFAIL flag for malloc(9) - it was completely ignored, so hadjdolecek
actually no effect