Home | History | Annotate | Download | only in procfs
History log of /src/sys/miscfs/procfs/procfs_linux.c
RevisionDateAuthorComments
 1.90  14-Sep-2024  pgoyette Define dependencies based on build options.
 1.89  01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.88  12-May-2024  christos PR/58227: Ricardo Branco: Add support for proc/sysvipc in Linux emulator
 1.87  05-Sep-2020  riastradh Round of uvm.h cleanup.

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@
 1.86  11-Jun-2020  ad Counter tweaks:

- 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.
 1.85  11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
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.
 1.84  31-May-2020  rin struct statvfs is too large for stack. Use malloc(9) instead.

XXX
Switch to kmem(9) for entire this file.

Frame size, e.g. for m68k, becomes:
3292 --> 12
 1.83  23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.82  20-Apr-2020  martin Add missing include of <sys/atomic.h> to fix the build
 1.81  19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
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.
 1.80  02-Jan-2020  thorpej branches: 1.80.6;
- Eliminate the global "boottime" variable, which was being accessed
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.
 1.79  31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.78  21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.77  16-Dec-2019  ad - Extend the per-CPU counters matt@ did to include all of the hot counters
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).
 1.76  07-Sep-2019  chs have procfs_do_pid_stat() pass the proc's map to get_proc_size_info(),
rather than having the latter look up the map again and not check
for an error.
 1.75  23-Aug-2019  maxv Fix info leaks.
 1.74  05-Dec-2018  christos branches: 1.74.4;
As discussed in tech-kern:

- 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
 1.73  13-Apr-2017  hannken branches: 1.73.4; 1.73.10; 1.73.12;
Switch procfs_domounts() to mountlist iterator.
 1.72  28-Mar-2016  mlelstv branches: 1.72.2; 1.72.4;
Align /proc/<pid>/statm data with /proc/<pid>/stat and
provide RSS information. There is no data about shared
pages.

Helps PR 50801.
 1.71  24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.70  10-Aug-2014  matt branches: 1.70.2; 1.70.4; 1.70.10;
#include <sys/cpu.h>
 1.69  12-Jul-2014  njoly Use kproc2 to provide sensible informations for /proc/<pid>/stat.
 1.68  30-Jun-2014  njoly Use NZERO instead of hard-coded "20" value.
 1.67  05-Apr-2014  christos branches: 1.67.2;
On my 24 proc box I got ENOSPC, so make the routine return the size it wants
and try again.
 1.66  27-Nov-2013  christos Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
 1.65  23-Nov-2013  christos change the mountlist CIRCLEQ into a TAILQ
 1.64  19-Dec-2011  christos branches: 1.64.6; 1.64.10;
don't produce different output if we are super user.
 1.63  16-Dec-2011  christos provide a root entry if one was not found.
 1.62  15-Dec-2011  christos PR/45700: use dostatvfs instead of grabbing the latest cached copy of
struct statvfs from the mount point, so that chroot is handled properly.
 1.61  04-Sep-2011  jmcneill branches: 1.61.2; 1.61.6;
PR# kern/45021: Please support /emul/linux/proc/version

Add /proc/version for procfs with -o linux. The version reported depends
on the emulation type of the calling process:

$ cat /proc/version
NetBSD version 5.99.55 (netbsd@localhost) (gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) NetBSD 5.99.55 (GENERIC) #39: Sun Sep 4 09:10:05 EDT 2011

$ /emul/linux/bin/cat /proc/version
Linux version 2.6.18 (linux@localhost) (gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) #0 Wed Mar 3 03:03:03 PST 2010

$ /emul/linux32/bin/cat /proc/version
Linux version 2.6.18 (linux32@localhost) (gcc version 4.1.3 20080704 prerelease (NetBSD nb2 20081120)) #0 Wed Mar 3 03:03:03 PST 2010
 1.60  28-Aug-2011  jmcneill both LINUX_USRSTACK32 and USRSTACK32 need to be defined for linux32
 1.59  20-Dec-2010  matt Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.58  19-Oct-2009  dholland branches: 1.58.4;
Avoid leaking pages. Fixes PR 42053 from SHIMIZU Ryo.
 1.57  11-Jan-2009  christos this change was somehow missed.
 1.56  11-Jan-2009  christos merge christos-time_t
 1.55  29-Dec-2008  pooka Rename specfs_lock as device_lock and move it from specfs to devsw.
Relaxes kernel dependency on vfs.
 1.54  31-May-2008  ad branches: 1.54.6; 1.54.8; 1.54.14;
Kill devsw_lock and just use specfs_lock. The two would need merging
in order to prevent unload of modules when a device that they provide
is still open.
 1.53  06-May-2008  ad branches: 1.53.2;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.52  30-Apr-2008  ad PR kern/38135 vfs_busy/vfs_trybusy confusion

The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
 1.51  29-Apr-2008  ad kern/38135 vfs_busy/vfs_trybusy confusion

The symptom was that sometimes file systems would occasionally not appear
in output from 'df' or 'mount' if the system was busy. Resolution:

- Make mount locks work somewhat like vm_map locks.
- vfs_trybusy() now only fails if the mount is gone, or if someone is
unmounting the file system. Simple contention on mnt_lock doesn't
cause it to fail.
- vfs_busy() will wait even if the file system is being unmounted.
 1.50  24-Apr-2008  ad branches: 1.50.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.49  24-Apr-2008  ad Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.48  30-Jan-2008  ad branches: 1.48.6; 1.48.8; 1.48.10;
PR kern/37706 (forced unmount of file systems is unsafe):

- Do reference counting for 'struct mount'. Each vnode associated with a
mount takes a reference, and in turn the mount takes a reference to the
vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
locking inherited from 4.4BSD with a recursable rwlock.
 1.47  22-Dec-2007  yamt procfs_douptime: simply use microuptime() instead of a mysterious calculation.
 1.46  22-Dec-2007  yamt procfs_docpustat: g/c a write-only variable.
 1.45  12-Nov-2007  ad branches: 1.45.2; 1.45.6;
Revision 1.42 was lost. Pointed out by Nicolas Joly:

This was using mutex_exit where mutex_enter was required.
 1.44  11-Nov-2007  christos report the proper stack size on 32 bit emulations.
 1.43  07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.42  11-Oct-2007  ad branches: 1.42.2; 1.42.4;
This was using mutex_exit where mutex_enter was required.
 1.41  10-Oct-2007  ad Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.40  08-Oct-2007  ad Merge run time accounting changes from the vmlocking branch. These make
the LWP "start time" per-thread instead of per-CPU.
 1.39  26-May-2007  agc branches: 1.39.6; 1.39.8; 1.39.10;
In /proc/<pid>/statm, avoid leaking buffer space if the attempt to get
vmspace information fails.

Return the nice value properly to userland via the /proc/<pid>/stat entry.

Use vm sizes from vmspace, rather than rusage structs, for the same
reasons as mentioned previously - see the comment in
kvm_proc.c::kvm_getproc2() about rusage values and zombie processes.
 1.38  25-May-2007  agc Use a bit more common code for the MULTIPROCESSOR and !MULTIPROCESSOR
cases.

Use the lwp's priority when returning the priority value, rather than
returning the nice value.
 1.37  25-May-2007  agc Various changes for better Linux emulation:

+ in /proc/<pid>/statm emulation, use the memory values from vmspace,
rather than struct rusage, since the rusage values appear to be 0 for
all processes except zombies. cf dsl's comment in
kvm_proc.c::kvm_getproc2()

+ in /proc/<pid>/stat, instead of returning the tv_sec value, return the
number of ticks we've had (roughly equivalent to the Linux jiffies).
Calculate these values from the tv_usec values.

Also:

+ enclose CPU_INFO_ITERATOR and CPU_INFO_FOREACH usage in #ifdef
MULTIPROCESSOR, at the request of Nick Hudson

Together, these changes allow htop to work on NetBSD.
 1.36  24-May-2007  dogcow use PRIu64, not llu, to unbork on 64-bit platforms.
 1.35  24-May-2007  agc Extend the Linux emulation of /proc to include

/proc/stat
/proc/loadavg and
/proc/<pid>/statm.

These are only present when -o linux is specified as a mount option
to procfs.

Factor out some common code so that it can be used by a number of
functions.

XXX The values returned in the statm emulation need to be verified.
 1.34  01-Apr-2007  christos return a page less than the actual top of stack so that linux-java works.
 1.33  09-Mar-2007  ad branches: 1.33.2; 1.33.4;
- Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
 1.32  09-Feb-2007  ad branches: 1.32.2;
Merge newlock2 to head.
 1.31  24-Dec-2006  elad Add two comments. No functional change.
 1.30  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.29  27-Oct-2006  christos don't allocate large buffers on the stack.
 1.28  23-Oct-2006  elad PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat

Patch applied, thanks for the report!
 1.27  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.26  20-Sep-2006  manu Emulate Linux's /proc/devices
 1.25  24-Jun-2006  christos branches: 1.25.4; 1.25.6;
PR/33815: Nicolas Joly: /emul/linux/proc/#/stat always report current
process status
 1.24  11-Dec-2005  christos branches: 1.24.4; 1.24.8; 1.24.16;
merge ktrace-lwp.
 1.23  29-May-2005  christos branches: 1.23.2;
- sprinkle const
- avoid shadowed variables.
 1.22  01-Mar-2005  christos branches: 1.22.2; 1.22.4;
Remove bogus len setting noted by J. Chapman Flack.
 1.21  27-Feb-2005  christos Give more space for cpu info and allocate it dynamically.
 1.20  26-Feb-2005  perry nuke trailing whitespace
 1.19  20-Sep-2004  jdolecek branches: 1.19.4; 1.19.6;
add 'mounts' file for -o linux, which lists all currently mounted
filesystems; Linux glibc statvfs() uses this to get some of mount flags,
and this file is also useful as /emul/linux/etc/mtab (via symlink)
 1.18  27-Aug-2004  skrll Do previous slightly differently - just pass a struct lwp * and derive the
struct proc *.

OK'd by Jaromir.
 1.17  21-Aug-2004  jdolecek fix process used for /proc/<pid>/stat contents - it should be process
<pid>, not the current process looking at the information
 1.16  22-Apr-2004  itojun sprintf -> snprintf
 1.15  30-Oct-2003  christos branches: 1.15.2;
t_pgrp can be null.
 1.14  21-Aug-2003  he Add casts of LINUX_USRSTACK and USRSTACK to handle the cases
where these are not constants.
 1.13  09-Aug-2003  christos LINUX_USRSTACK is only defined on i386. Thanks Izumi!
 1.12  09-Aug-2003  christos Only choose the linux usrstack if the netbsd usrstack was higher.
 1.11  09-Aug-2003  christos Change the way we compute the top of the stack. This makes java-1.4.2 work.
 1.10  29-Jun-2003  fvdl branches: 1.10.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.8  29-May-2003  hannken Change "%qu" to "PRIu64" to make it compile on sparc64.
 1.7  28-May-2003  christos Add /proc/<pid>/stat for linux compat. j2sdk1.4.2 depends on it.
 1.6  27-Feb-2003  hannken Change "%llu" to "PRIu64" to make it compile on sparc64.
 1.5  25-Feb-2003  jrf This addresses PR kerm/19989. Thanks to hamajima@nagoya.ydc.co.jp for submitting this patch which enables /proc/uptime for linux emul. Patch reviewed by atatat@netbsd.org and tron@netbsd.org, approved by tron@netbsd.org.
 1.4  09-Dec-2001  chs replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.3  10-Nov-2001  lukem add RCSIDs
 1.2  18-Jan-2001  tv branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10;
No-op revision to force update of this file to a non-"-kk" version.
 1.1  17-Jan-2001  fvdl branches: 1.1.2;
Add a few linux-style files, only enabled when -o linux is specified
for the mount. Currently these are /proc/cpuinfo and /proc/meminfo.
The former only does something on i386 right now.
 1.1.2.2  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1  17-Jan-2001  bouyer file procfs_linux.c was added on branch thorpej_scsipi on 2001-01-18 09:23:48 +0000
 1.2.10.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.6.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2  30-Mar-2001  he Pull up revisions 1.1-1.2 (new, via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.2.4.1  18-Jan-2001  he file procfs_linux.c was added on branch netbsd-1-5 on 2001-03-30 21:48:11 +0000
 1.2.2.2  08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1  14-Nov-2001  nathanw Catch up to -current.
 1.10.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.5  24-Sep-2004  skrll Sync with HEAD.
 1.10.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.10.2.2  03-Aug-2004  skrll Sync with HEAD
 1.10.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.15.2.3  29-Oct-2006  tron Pull up following revision(s) (requested by adrianp in ticket #10739):
sys/miscfs/procfs/procfs_linux.c: revision 1.28
PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat
Patch applied, thanks for the report!
 1.15.2.2  30-Aug-2004  tron branches: 1.15.2.2.2; 1.15.2.2.4;
Pull up revision 1.18 via patch (requested by jdolecek in ticket #799):
Do previous slightly differently - just pass a struct lwp * and derive the
struct proc *.
OK'd by Jaromir.
 1.15.2.1  30-Aug-2004  tron Pull up revision 1.17 (requested by jdolecek in ticket #799):
fix process used for /proc/<pid>/stat contents - it should be process
<pid>, not the current process looking at the information
 1.15.2.2.4.1  29-Oct-2006  tron Pull up following revision(s) (requested by adrianp in ticket #10739):
sys/miscfs/procfs/procfs_linux.c: revision 1.28
PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat
Patch applied, thanks for the report!
 1.15.2.2.2.1  29-Oct-2006  tron Pull up following revision(s) (requested by adrianp in ticket #10739):
sys/miscfs/procfs/procfs_linux.c: revision 1.28
PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat
Patch applied, thanks for the report!
 1.19.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1  29-Apr-2005  kent sync with -current
 1.22.4.1  24-Oct-2006  ghen Pull up following revision(s) (requested by elad in ticket #1567):
sys/miscfs/procfs/procfs_linux.c: revision 1.28
PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat
Patch applied, thanks for the report!
 1.22.2.1  24-Oct-2006  ghen Pull up following revision(s) (requested by elad in ticket #1567):
sys/miscfs/procfs/procfs_linux.c: revision 1.28
PR/34888: Nicolas Joly: kernel panic while trying to access
/emul/linux/proc/0/stat
Patch applied, thanks for the report!
 1.23.2.8  04-Feb-2008  yamt sync with head.
 1.23.2.7  21-Jan-2008  yamt sync with head
 1.23.2.6  15-Nov-2007  yamt sync with head.
 1.23.2.5  27-Oct-2007  yamt sync with head.
 1.23.2.4  03-Sep-2007  yamt sync with head.
 1.23.2.3  26-Feb-2007  yamt sync with head.
 1.23.2.2  30-Dec-2006  yamt sync with head.
 1.23.2.1  21-Jun-2006  yamt sync with head.
 1.24.16.1  13-Jul-2006  gdamore Merge from HEAD.
 1.24.8.1  26-Jun-2006  yamt sync with head.
 1.24.4.1  09-Sep-2006  rpaulo sync with head
 1.25.6.2  10-Dec-2006  yamt sync with head.
 1.25.6.1  22-Oct-2006  yamt sync with head
 1.25.4.4  12-Jan-2007  ad Sync with head.
 1.25.4.3  18-Nov-2006  ad Sync with head.
 1.25.4.2  17-Nov-2006  ad Checkpoint work in progress.
 1.25.4.1  21-Oct-2006  ad - Make this compile. XXX Needs more work on locking.
- Do FILE_UNUSE() as the current LWP, otherwise we will wipe out the
target's advisory locks. XXX Double check.
 1.32.2.2  15-Apr-2007  yamt sync with head.
 1.32.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.33.4.1  11-Jul-2007  mjf Sync with head.
 1.33.2.5  25-Oct-2007  ad - Simplify debugger/procfs reference counting of processes. Use a per-proc
rwlock: rw_tryenter(RW_READER) to gain a reference, and rw_enter(RW_WRITER)
by the process itself to drain out reference holders before major changes
like exiting.
- Fix numerous bugs and locking issues in procfs.
- Mark procfs MPSAFE.
 1.33.2.4  14-Jul-2007  ad Make it possible to track time spent by soft interrupts as is done for
normal LWPs, and provide a sysctl to switch it on/off. Not enabled by
default because microtime() is not free. XXX Not happy with this but
I want it get it out of my local tree for the time being.
 1.33.2.3  08-Jun-2007  ad Sync with head.
 1.33.2.2  10-Apr-2007  ad Sync with head.
 1.33.2.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.39.10.1  14-Oct-2007  yamt sync with head.
 1.39.8.4  23-Mar-2008  matt sync with HEAD
 1.39.8.3  09-Jan-2008  matt sync with HEAD
 1.39.8.2  08-Nov-2007  matt sync with -HEAD
 1.39.8.1  06-Nov-2007  matt sync with HEAD
 1.39.6.3  14-Nov-2007  joerg Sync with HEAD.
 1.39.6.2  11-Nov-2007  joerg Sync with HEAD.
 1.39.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.42.4.3  18-Feb-2008  mjf Sync with HEAD.
 1.42.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.42.4.1  19-Nov-2007  mjf Sync with HEAD.
 1.42.2.1  13-Nov-2007  bouyer Sync with HEAD
 1.45.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.45.2.1  26-Dec-2007  ad Sync with head.
 1.48.10.2  04-Jun-2008  yamt sync with head
 1.48.10.1  18-May-2008  yamt sync with head.
 1.48.8.3  30-Dec-2008  christos sync with head.
 1.48.8.2  01-Nov-2008  christos Sync with head.
 1.48.8.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.48.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.48.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.50.2.3  11-Mar-2010  yamt sync with head
 1.50.2.2  04-May-2009  yamt sync with head.
 1.50.2.1  16-May-2008  yamt sync with head.
 1.53.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.54.14.3  29-Apr-2011  matt Use _KERNEL_OPT
 1.54.14.2  05-Feb-2011  cliff - include opt_multiprocessor.h for explicit MULTIPROCESSOR dependency
 1.54.14.1  21-Apr-2010  matt sync to netbsd-5
 1.54.8.1  27-Oct-2009  bouyer Pull up following revision(s) (requested by markd in ticket #1113):
sys/miscfs/procfs/procfs_linux.c: revision 1.58
Avoid leaking pages. Fixes PR 42053 from SHIMIZU Ryo.
 1.54.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.58.4.1  05-Mar-2011  rmind sync with head
 1.61.6.1  18-Feb-2012  mrg merge to -current.
 1.61.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.61.2.1  17-Apr-2012  yamt sync with head
 1.64.10.1  18-May-2014  rmind sync with head
 1.64.6.2  03-Dec-2017  jdolecek update from HEAD
 1.64.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.2.1  10-Aug-2014  tls Rebase.
 1.70.10.1  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.70.4.3  28-Aug-2017  skrll Sync with HEAD
 1.70.4.2  22-Apr-2016  skrll Sync with HEAD
 1.70.4.1  22-Sep-2015  skrll Sync with HEAD
 1.70.2.1  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.72.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.72.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.73.12.4  21-Apr-2020  martin Sync with HEAD
 1.73.12.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.73.12.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.73.12.1  10-Jun-2019  christos Sync with HEAD
 1.73.10.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.73.4.2  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.73.4.1  10-Sep-2019  martin Pull up following revision(s) (requested by chs in ticket #1370):

sys/miscfs/procfs/procfs_linux.c: revision 1.76

have procfs_do_pid_stat() pass the proc's map to get_proc_size_info(),
rather than having the latter look up the map again and not check
for an error.
 1.74.4.2  13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.74.4.1  10-Sep-2019  martin Pull up following revision(s) (requested by chs in ticket #190):

sys/miscfs/procfs/procfs_linux.c: revision 1.76

have procfs_do_pid_stat() pass the proc's map to get_proc_size_info(),
rather than having the latter look up the map again and not check
for an error.
 1.80.6.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.80.6.1  20-Apr-2020  bouyer Sync with HEAD

RSS XML Feed