Home | History | Annotate | only in /src/sbin/mount_procfs
History log of /src/sbin/mount_procfs
RevisionDateAuthorComments
 1.15 26-Jul-2020  mlelstv Refactor remaining mount_* commands to use the common pathadj()
function for resolving paths.

Make pathadj() no longer warn about symlinks. Symlinks in /dev are
regularly used in several places like LVM . The warning was also
only visible when calling a mount_* command directly as mount(8)
itself would resolve the path witout warning before passing it to
a mount_* command.
 1.14 27-Jun-2005  christos Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
 1.13 05-Feb-2005  xtraeme Kill __P(), use ANSI function declarations; WARNS=3.
 1.12 22-Mar-2003  jdolecek move getmntopts(3) to libutil, build and install also it's manpage
bump libutil minor
adjust individual mount_*/Makefile to use libutil getmntopts(3)
 1.11 21-Sep-2002  christos MNT_GETARGS support
 1.10 19-Aug-2002  lukem Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path
 1.9 10-Oct-1997  christos CFLAGS->CPPFLAGS
 1.8 08-May-1997  gwr Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
 1.7 06-May-1997  gwr Use .PATH.c: ...
 1.6 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5 22-Dec-1994  cgd specify man pages the new way.
 1.4 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.3 12-Jan-1994  cgd update from jsp; no man page yet, so torch the old one (for now)
 1.2 24-Aug-1993  pk Man page added.
 1.1 24-Aug-1993  pk branches: 1.1.1;
mount program for proc filesystem.
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.39 18-Apr-2023  jkoshy mount_procfs(8): Document the format of the region descriptor
lines contained in the 'map' and 'maps' special files.
 1.38 08-Jan-2020  ad branches: 1.38.8;
- options NAMECACHE_ENTER_REVERSE is no more.

- Partially sort the list of per-vnode namecache entries by using a TAILQ.
Put the real name to the head, and put dot and dotdot to the tail so that
cache_lookup_reverse() doesn't have to consider them.
 1.37 28-Aug-2017  wiz branches: 1.37.4;
Bump date for previous.
 1.36 28-Aug-2017  kamil 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>
 1.35 03-Jul-2017  wiz Remove workaround for ancient HTML generation code.
 1.34 24-Feb-2009  pooka branches: 1.34.38;
Note change with linux compat.
 1.33 05-Apr-2007  pooka branches: 1.33.20; 1.33.22;
whooops, bump date also
 1.32 05-Apr-2007  pooka /proc/devices, not /proc/device
 1.31 24-Feb-2007  pooka proc/#/exe is now exposed for all mounts, move it away from linux-only
 1.30 02-Feb-2007  wiz Bump date for previous.
 1.29 02-Feb-2007  alc - sync file list with reality
- add a description for fd/# (with reference to fd(4))
 1.28 03-Oct-2005  wiz branches: 1.28.4;
Bump date for previous.
 1.27 01-Oct-2005  atatat Add "cwd" and "root" symlinks to each process's directory. The cwd
link points to the process's current working directory, and the root
link points to the process's root directory. What else would you
expect?

For directories that are out of reach (caller is in a chroot, target
process is in a different chroot, etc), the links point to "/"
instead.
 1.26 31-Jan-2005  erh Fix PR#3617 and PR#3205: call realpath to convert mount points and paths to
device nodes into absolute paths before using them.
 1.25 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.24 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.23 01-Oct-2002  wiz New sentence, new line. By Robert Elz with minimal fixes.
 1.22 31-May-2002  atatat Add descriptions of the "self" symbolic link and the "maps" pseudo file.
Also note the kernel option that is required in order to get pathnames
with file backed entries in the "maps" pseudo file.
 1.21 08-Feb-2002  ross branches: 1.21.2;
Generate <>& symbolically. I'm avoiding .../dist/... directories for now.
 1.20 16-Nov-2001  wiz Punctuation fixes, sort SEE ALSO, sort sections, use standard headers.
 1.19 05-Jun-2001  wiz Drop arguments of .Os.
 1.18 17-Jan-2001  fvdl Fix spelling.
 1.17 17-Jan-2001  fvdl Document -o linux option.
 1.16 08-Jun-2000  mason Fixed typo - zonbie -> zombie
 1.15 19-Jul-1999  jlam branches: 1.15.6;
Add description of /proc/#/cmdline to mount_procfs.8.
Closes PR misc/8021.
 1.14 24-Mar-1999  mycroft Remove spurious .ne's.
 1.13 07-Mar-1999  mycroft Clean up SYNOPSIS formatting.
 1.12 25-Jan-1999  msaitoh Add /proc/#/map.
 1.11 06-Feb-1998  perry macroize BSD, NetBSD, FreeBSD and misc cleanup
 1.10 16-Sep-1997  lukem resolve conflicts from lite-2 merge
 1.9 15-Sep-1997  lukem * update for WARNS=1
* getopt returns -1 not EOF
* fix .Nm usage
 1.8 13-May-1997  mikel fix typos noted by Masanobu Saitoh <msaitoh@spa.is.uec.ac.jp>.
 1.7 28-Apr-1997  mycroft Fix several errors and remove out of date comments.
 1.6 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.4 25-Aug-1993  cgd df lists filesystem as "proc" -- note this, rather than "procfs"
 1.3 25-Aug-1993  cgd this stuff didn't go in for 0.8a...
 1.2 24-Aug-1993  pk removed trash left over from FTP PUT operation :-(
 1.1 24-Aug-1993  pk branches: 1.1.1;
Man page added.
 1.1.1.2 16-Sep-1997  lukem imported from lite-2
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.15.6.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.2.1 02-Jun-2002  tv Pull up revision 1.22 (requested by atatat in ticket #113):
Add descriptions of the "self" symbolic link and the "maps" pseudo file.
Also note the kernel option that is required in order to get pathnames
with file backed entries in the "maps" pseudo file.
 1.28.4.1 06-Apr-2007  bouyer Pull up following revision(s) (requested by pooka in ticket #535):
sbin/mount_procfs/mount_procfs.8 1.28-1.33
sync file list with reality
add a description for fd/# (with reference to fd(4))
proc/#/exe is now exposed for all mounts, move it away from linux-only
 1.33.22.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.33.20.1 02-Mar-2009  snj Pull up following revision(s) (requested by pooka in ticket #519):
sbin/mount_procfs/mount_procfs.8: revision 1.34
Note change with linux compat.
 1.34.38.1 12-Apr-2018  martin 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>
 1.37.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.8.1 20-Jul-2024  martin Pull up following revision(s) (requested by rin in ticket #760):

sbin/mount_procfs/mount_procfs.8: revision 1.39

mount_procfs(8): Document the format of the region descriptor
lines contained in the 'map' and 'maps' special files.
 1.25 26-Jul-2020  mlelstv Refactor remaining mount_* commands to use the common pathadj()
function for resolving paths.

Make pathadj() no longer warn about symlinks. Symlinks in /dev are
regularly used in several places like LVM . The warning was also
only visible when calling a mount_* command directly as mount(8)
itself would resolve the path witout warning before passing it to
a mount_* command.
 1.24 29-Aug-2011  joerg Use __dead
 1.23 23-Feb-2009  pooka Default to -o linux. This prevents programs from not working just
because the -o linux flag was not supplied, i.e. it is the sensible
default. People who absolutely do not want the extra files in
their /proc for whatever aesthetic reason (it's not like they
consume any resources) can do -o nolinux.
 1.22 20-Jul-2008  lukem branches: 1.22.2; 1.22.4;
Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
 1.21 16-Jul-2007  pooka branches: 1.21.12; 1.21.16;
Make all mount(2) return value error checks against -1. Some file
systems just checked != 0, breaking MNT_GETARGS. Others worked with < 0,
but make them check against -1 too for consistency. And sprinkle some
stylish line wrapping where appropriate.
 1.20 14-Jul-2007  dsl Add additional 'sizeof args' parameter to mount(2).
 1.19 16-Oct-2006  christos use MOPT_NULL
 1.18 21-Mar-2006  christos Always check the results of getmntopts() and free them.
 1.17 05-Feb-2005  xtraeme Kill __P(), use ANSI function declarations; WARNS=3.
 1.16 31-Jan-2005  erh Fix PR#3617 and PR#3205: call realpath to convert mount points and paths to
device nodes into absolute paths before using them.
 1.15 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22308, verified by myself.
 1.14 22-Mar-2003  jdolecek use <> rather than "" for #include mntopts.h
 1.13 21-Sep-2002  christos MNT_GETARGS support
 1.12 17-Jan-2001  fvdl Add handling of -o linux.
 1.11 30-Oct-2000  jdolecek make the code includable into other programs:
* make static all symbols which do not need to be exported
* rename main() to mount_FOO()
* new main() now just calls mount_FOO(), main() is only compiled in if
MOUNT_NOMAIN is not defined
* a_gid(), a_uid() and a_mask() were put into ../mount/fattr.[ch], local
versions removed
 1.10 25-Jun-1999  perseant branches: 1.10.8;
Regularize error reporting of mount_* commands for failure of mount(2)
to the form:

mount_xxx: dev on dir: reason for failure
 1.9 16-Sep-1997  lukem branches: 1.9.4;
resolve conflicts from lite-2 merge
 1.8 15-Sep-1997  lukem * update for WARNS=1
* getopt returns -1 not EOF
* fix .Nm usage
 1.7 13-Apr-1996  jtc Add const qualifier to mopts table
 1.6 18-Mar-1995  cgd convert to new RCS Id conventions; reduce my headache
 1.5 08-Jun-1994  mycroft Update from 4.4-Lite, with local changes.
 1.4 12-Jan-1994  cgd update from jsp; no man page yet, so torch the old one (for now)
 1.3 25-Aug-1993  pk should not default to read-only mount.
 1.2 24-Aug-1993  pk Man page added.
 1.1 24-Aug-1993  pk branches: 1.1.1;
mount program for proc filesystem.
 1.1.1.2 16-Sep-1997  lukem imported from lite-2
 1.1.1.1 13-Jun-1994  mycroft Import 4.4-Lite version.
 1.9.4.1 05-Sep-1999  he Pull up revision 1.10:
Regularize error reporting of mount_* commands for failure of
mount(2) to the form "mount_xxx: dev on dir: reason for failure"
(as opposed to the old "mount_xxx: : reason for failure").
(perseant)
 1.10.8.1 30-Mar-2001  he Pull up revision 1.12 (via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.21.16.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.12.1 28-Sep-2008  mjf Sync with HEAD.
 1.22.4.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.22.2.1 26-Feb-2009  snj Pull up following revision(s) (requested by pooka in ticket #495):
sbin/mount_procfs/mount_procfs.c: revision 1.23
Default to -o linux. This prevents programs from not working just
because the -o linux flag was not supplied, i.e. it is the sensible
default. People who absolutely do not want the extra files in
their /proc for whatever aesthetic reason (it's not like they
consume any resources) can do -o nolinux.

RSS XML Feed