NetBSD/bin/ps
martin 4589d5e782 Pull up following revision(s) (requested by kamil in ticket #713):
sys/modules/procfs/Makefile: revision 1.4
	sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
	bin/ps/ps.1: revision 1.108
	sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
	sys/miscfs/procfs/procfs_vnops.c: revision 1.198
	sys/kern/sys_ptrace_common.c: revision 1.23
	sys/kern/sys_ptrace_common.c: revision 1.24
	sbin/mount_procfs/mount_procfs.8: revision 1.36
	sys/kern/sys_ptrace_common.c: revision 1.25
	sys/kern/sys_ptrace.c: revision 1.5
	sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
	sys/sys/proc.h: revision 1.342
	sys/kern/sys_ptrace_common.c: revision 1.26
	sys/miscfs/procfs/procfs_ctl.c: file removal
	sys/kern/sys_ptrace_common.c: revision 1.27
	sys/miscfs/procfs/procfs_subr.c: revision 1.109
	sys/kern/sys_ptrace_common.c: revision 1.28
	sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
	sys/kern/sys_ptrace_common.c: revision 1.29
	sys/sys/ptrace.h: revision 1.62
	sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
	share/man/man9/kauth.9: revision 1.109
	sys/miscfs/procfs/files.procfs: revision 1.12
	sys/compat/netbsd32/netbsd32.h: revision 1.115
	sys/miscfs/procfs/procfs.h: revision 1.72
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
	sys/kern/kern_sig.c: revision 1.337
	sys/sys/kauth.h: revision 1.75
	sys/sys/sysctl.h: revision 1.224
	sys/kern/sys_ptrace_common.c: revision 1.30
	sys/kern/sys_ptrace_common.c: revision 1.31
	sys/kern/sys_ptrace_common.c: revision 1.32
	sys/kern/sys_ptrace_common.c: revision 1.33
	sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
	sys/kern/sys_ptrace_common.c: revision 1.34
	sys/kern/sys_ptrace_common.c: revision 1.36
	sys/kern/kern_proc.c: revision 1.207
	sys/kern/kern_exit.c: revision 1.269
	doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
 - /proc/#/ctl from mount_procfs(8)
 - P_FSTRACE note from the documentation of ps(1)
 - /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
 - KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
 - source code file miscfs/procfs/procfs_ctl.c
 - PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
 - KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
 - PSL_FSTRACE (0x00010000) from sys/sys/proc.h
 - P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
  .. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
  .. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
2018-04-12 13:42:48 +00:00
..
Makefile
extern.h provide a tree like display with -d, from FreeBSD 2016-12-02 21:59:03 +00:00
fmt.c
keyword.c
nlist.c for donlist{,_sysctl}: 2016-11-28 08:19:23 +00:00
print.c Handle functions that use the offset from either kinfo_proc2/kinfo_lwp properly. 2016-12-12 20:35:36 +00:00
ps.1 Pull up following revision(s) (requested by kamil in ticket #713): 2018-04-12 13:42:48 +00:00
ps.c Pull up following revision(s) (requested by kamil in ticket #515): 2018-02-03 22:11:36 +00:00
ps.h provide a tree like display with -d, from FreeBSD 2016-12-02 21:59:03 +00:00