summaryrefslogtreecommitdiff
path: root/usr.sbin/pstat
AgeCommit message (Collapse)Author
2018-08-03unveil _PATH_DEVDB for devname(). All other filenames are openedTheo de Raadt
before unveil/pledge.
2018-06-18Put file descriptors on shared data structures when they are completelyMartin Pieuchot
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@
2018-06-05Revert introduction of fdinsert(), a sanitify check triggers whenMartin Pieuchot
closing a LARVAL file. Found the hardway by sthen@.
2018-06-02LARVAL fds are now invisble from userland.Martin Pieuchot
From tb@
2018-01-02Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.Philip Guenther
ok millert@ sthen@
2017-02-09Teach pstat -d to also print untyped kernel symbols.Jeremie Courreges-Anglas
Storage defined in assembly code often doesn't define its type and size, thus the nlist interface can't present it as N_DATA. Instead of fixing all the assembly by adding .type pseudo ops, work around the problem in pstat. Let's hope that allowing N_COMM is sufficient. This makes ''pstat -d u cpuid_level'' useful. Reported by mikeb@, "looks sane" mikeb@ guenther@
2016-11-26Remove leftovers of line disciplines that are no more.Martin Pieuchot
ok mikeb@
2016-10-23For -d, if there is no modifier, don't go down the "longformat" path.Mark Kettenis
Fixes cases like "pstat -d x ticks" on armv7. ok jca@, deraadt@
2016-09-25Make a move towards ending 4 decades of kernel snooping.Theo de Raadt
Add sysctl kern.allowkmem (default 0) which controls the ability to open /dev/mem or /dev/kmem at securelevel > 0. Over 15 years we converted 99% of utilities in the tree to operate on sysctl-nodes (either by themselves or via code hiding in the guts of -lkvm). pstat -d and -v & procmap are affected and continued use of them will require kern.allowkmem=1 in /etc/sysctl.conf. acpidump (and it's buddy sendbug) are affected, but we'll work out a solution soon. There will be some impact in ports. ok kettenis guenther
2016-09-19Add pledge support to pstatTheo Buehler
The filemode(), ttymode() and vnodemode() functions can be split into two pieces. The *_prep() piece must be hoisted to before pledge and the rest can run under pledge "stdio rpath vminfo". The magic block that decides which ones of the *_prep() pieces must be run with which combination of command line switches is quite impressive. Patch from Rob Pierce, thanks! ok deraadt
2016-09-19Fix pstat -ft. In presence of the -f flag, a logic error in ttymode()Theo Buehler
leads to entering codepaths that try to work with only partially initialized kvm structures -- with unsurprising outcomes. Problem found by Rob Pierce, ok deraadt
2016-08-14Convert %q to %ll and cast opaque system values to long long.Philip Guenther
Use uint64_t for the KERN_INTRCNT_CNT sysctl() ok krw@
2016-07-18Fix VFLAG formattingPhilip Guenther
ok bluhm@
2016-06-03correct synopsis to make -d usage clearer.Theo de Raadt
The shed fell over because 15 layers of paint exceeded engineering margins.
2016-05-27W^X violations are no longer permitted by default. A kernel log messageTheo de Raadt
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
2016-05-25remove code to display MNT_EXKERB bitTheo de Raadt
2016-04-25remove systraceTed Unangst
2016-04-12The -T flag consumes the same data as the -f flag so it requiresTodd C. Miller
nlist too. Fixes a crash when the -T flag is specified due to calling kvm_read() with a NULL kvm_t. From Rob Pierce
2015-12-11dformat is pointer, don't compare with 0Ted Unangst
2015-08-28Rework the UNIX domain socket garbage collector, including ideas fromPhilip Guenther
{Free,Net}BSD - when a socket is closed with fds in its input, defer closing them to a task to avoid recursing. This eliminates the complicated extra reference taking which had a 37 line(!) comment explanation - move flags, counts, and links only needed for this from struct file to struct unpcb - document the flow of the mark/sweep collector much help from claudio@ who made me explain the GC to him until we trusted it ok claudio@ mpi@ deraadt@
2015-03-11Remove setgid kmem support. As a result, -d and -v will require you toTheo de Raadt
run this as root. ok millert, also discussed with guenther
2015-02-10Fix -d output of smaller than 64 bit values on big-endian systems.Miod Vallat
ok mpi@ tedu@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-19don't print vnodes if we didn't read themTed Unangst
2014-12-191. -T (totalflag) requires nlist too.Ted Unangst
2. If we can't read a vnode, there's no way LIST_NEXT is going to be meaningful. 3. set numvnodes before looping in case we return early. getting better, but still not all fixed
2014-11-23<sys/buf.h> isn't actually needed herePhilip Guenther
ok tedu@
2014-11-19delete the KERN_VNODE sysctl. it fails to provide any isolation from theTed Unangst
kernel struct vnode defintion, and the only consumer (pstat) still needs kvm to read much of the required information. no great loss to always use kvm until there's a better replacement interface. ok deraadt millert uebayasi
2014-10-08use reallocarray(NULL, a, b) instead of malloc(a*b)Theo de Raadt
ok doug
2014-10-01Do not mention sliplogin(8) and sl(4).Martin Pieuchot
2014-08-20Remove userland bits related to the crypto(4) interface; ok deraadtMike Belopuhov
2014-07-16zap trailing newlines; "go for it" deraadtOkan Demirmen
2014-03-19Pull in FreeBSD r37363 and r37887:Philip Guenther
-- Sync timestamp changes for inodes of special files to disk as late as possible (when the inode is reclaimed). Temporarily only do this if option UFS_LAZYMOD configured and softupdates aren't enabled. UFS_LAZYMOD is intentionally left out of /sys/conf/options. This is mainly to avoid almost useless disk i/o on battery powered machines. It's silly to write to disk (on the next sync or when the inode becomes inactive) just because someone hit a key or something wrote to the screen or /dev/null. -- Made lazy syncing of timestamps for special files non-optional. -- Also, include support in 'pstat -v' to display the IN_LAZYMOD flag. ok tedu@ millert@
2014-02-16fix bibliographical references; from Jan Stary <hans at stare dot cz>Ingo Schwarze
feedback and ok jmc@
2013-12-01Change 'mountlist' from CIRCLEQ to TAILQ. Be paranoid andKenneth R Westerback
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@
2013-11-12ensure there are prototypesTheo de Raadt
2013-10-22- add UNIX-domain socket info to struct kinfo_file2Philip Guenther
- convert netstat from kvm_getfiles() to kvm_getfile2() using that - delete kvm_getfiles() and KERN_FILE as no longer used (bump libkvm's major) - rename kvm_getfile2() to kvm_getfiles(), kinfo_file2 to kinfo_file and KERN_FILE2 to KERN_FILE. ok deraadt@, millert@ ports scan sthen@
2013-08-22Correct format string mismatches turned up by -Wformat=2Philip Guenther
suggestions and ok millert@
2013-06-05Move FHASLOCK from f_flag to f_iflags, freeing up a bit for passingPhilip Guenther
O_* flags and eliminating an XXX comment. ok matthew@ deraadt@
2013-04-21Tweak #include order to work during the big time_t transitionPhilip Guenther
noted by matthieu@
2013-03-24Do not leak kernel pointers, unless operating as root. Some other displayTheo de Raadt
functionality is lost, but one can argue that privacy was being violated there... ok various, including bluhm and guenther
2013-01-17some simple macro fixes;Jason McIntyre
2012-12-18We no longer use struct eproc for kinfo_proc in sysctl.h so thereTodd C. Miller
is no direct need for sys/proc.h or sys/resource.h. Some consumers of kinfo_proc need these for the proc flags and rlimit defines like RLIM_INF so add the appropriate includes to them. OK deraadt@ sthen@
2012-07-11Don't skip pipe, kqueue, crypto, or systrace files in pstat -f outputPhilip Guenthe
Also, cast to long to make printf formatting portable with help from matthew; ok deraadt@
2012-07-09According to miod, KERNBASE used as a userland symbol should dieTheo de Raadt
in a fire. Start by removing the definitions, before we clean the headers later.
2012-05-17show the f_iflags; ok guentherTheo de Raadt
2011-06-28Use kvm_getfile2() instead of sysctl(KERN_FILE) for the -f optionPhilip Guenthe
Make -T behave as documented: only report totals Only open the kvm files when necessary prompted by a comment from matthew@ ok and corrections millert@, ok tedu@
2010-09-19more wacky macro fixing;Jason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-10-23argument to -M is "core", not "corefile" (this typo was introducedIgor Sobrado
in 4.4BSD at least). ok jmc@
2009-05-31Don't define NFS before including kernel header files,Thordur I. Bjornsson
besides it being gnarly its useless since no magic is done if it is define. pointed out by deraadt@