summaryrefslogtreecommitdiffstats
path: root/lib/libkvm
Commit message (Collapse)AuthorAgeFilesLines
* kvm(3): Mention that some of the functions use sysctl(3) instead of kmem.jilles2010-04-251-2/+6
| | | | | | | | Additionally, because of sysctl(3) use (which is generally good), behaviour for crash dumps differs slightly from behaviour for live kernels and this will probably never be fixed entirely, so weaken that claim. MFC after: 1 week
* Fix several typos in macros or macro misusage.uqs2010-03-121-1/+1
| | | | | | Found by: make manlint Reviewed by: ru Approved by: philip (mentor)
* Not all programs including kvm.h include the necessary headers to userwatson2010-03-011-1/+1
| | | | | | | u_int, so prefer unsigned int. MFC after: 6 days Pointed out by: bz, kib, Mr Tinderbox
* A first cut at teaching libkvm how to deal with dynamic per-CPU storagerwatson2010-03-016-7/+210
| | | | | | | | | | | | | | | | | (DPCPU): A new API, kvm_dpcpu_setcpu(3), selects the active CPU for the purposes of DPCPU. Calls to kvm_nlist(3) will automatically translate DPCPU symbols and return a pointer to the current CPU's version of the data. Consumers needing to read the same symbol on several CPUs will invoke a series of setcpu/nlist calls, one per CPU of interest. This addition makes it possible for tools like netstat(1) to query the values of DPCPU variables during crashdump analysis, and is based on similar code handling virtualized global variables. MFC after: 1 week Sponsored by: Juniper Networks, Inc.
* Fix typo in comment.rwatson2010-02-271-2/+2
| | | | MFC after: 3 days
* Build lib/ with WARNS=6 by default.ed2010-01-021-0/+2
| | | | | | | | | Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and lower it when needed. I'm setting WARNS?=0 for secure/. It seems secure/ includes the Makefile.inc provided by lib/. I'm not going to touch that directory. Most of the code there is contributed anyway.
* Add a missing else that negated the truncation of ki_ngroups tobrooks2009-12-101-1/+1
| | | | | | NGROUPS. Submitted by: Dmitry Pryanishnikov <lynx dot ripe at gmail dot com>
* Fix a copy-paste bug when reading data from the last 3 (7 for PAE) bytes ofjhb2009-11-061-6/+6
| | | | | | | a page mapped by a large page in the kernel. Submitted by: Dorr H. Clark dclark of engr.scu.edu MFC after: 1 week
* cr_groups is no longer embedded in struct ucred and is instead storedbrooks2009-09-081-1/+1
| | | | | | | | | | | in a seperate array. As such we need to use kvm_read rather than bcopy to populate the ki_groups field. This fixes a crash when running ps -ax on a coredump. Reported by: brucec Tested by: brucec MFC after: 3 days
* Rather than replicating the maths from the kernel, use thebz2009-08-131-1/+1
| | | | | | | | | value the kernel calculated directly as we already read it with struct vnet. This will make kvm_vnet.c more resilent in case of possible kernel changes. Reviewed by: rwatson Approved by: re (kib)
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andrwatson2009-08-011-1/+0
| | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket)
* Revert the changes to struct kinfo_proc in r194498. Instead, fillbrooks2009-07-241-2/+8
| | | | | | | | | | in up to 16 (KI_NGROUPS) values and steal a bit from ki_cr_flags (all bits currently unused) to indicate overflow with the new flag KI_CRF_GRP_OVERFLOW. This fixes procstat -s. Approved by: re (kib)
* Make libkvm work on live systems and crashdumps with andbz2009-07-234-9/+412
| | | | | | | | | | | | | | | | | | without VIMAGE virtualization in the kernel. If we cannot resolve a symbol try to see if we can find it with prefix of the virtualized subsystem, currently only "vnet_entry" by identifying either the vnet of the current process for a live system or the vnet of proc0 (or of dumptid if compiled in a non-default way). The way this is done currently allows us to only touch libkvm but no single application. Once we are going to virtualize more subsystems we will have to review this decision for better scaling. Submitted by: rwatson (initial version of kvm_vnet.c, lots of ideas) Reviewed by: rwatson Approved by: re (kib)
* Rework the credential code to support larger values of NGROUPS andbrooks2009-06-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.) The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc. Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search. Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error. Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity. Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
* Fix missing includes of <string.h>, to silence some compiler warnings.ed2009-06-147-2/+7
| | | | Submitted by: Pawel Worach
* Add support for PowerPC kernel core files. This commit only addsmarcel2009-04-061-55/+170
| | | | | | | | | | | | | | support for virtual core files (aka minidumps). physical core files are not supported. The implementation is cross-tool ready and can be used in a non- powerpc hosted debugger to analyze PowerPC core files. It also accepts core files that still have the dump header, as can be the case within Juniper where TFTP-based kernel core files are supported and savecore is not used to "extract" the core file from some dump device. Obtained from: Juniper Networks, Inc.
* MFp4:bz2008-11-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bring in updated jail support from bz_jail branch. This enhances the current jail implementation to permit multiple addresses per jail. In addtion to IPv4, IPv6 is supported as well. Due to updated checks it is even possible to have jails without an IP address at all, which basically gives one a chroot with restricted process view, no networking,.. SCTP support was updated and supports IPv6 in jails as well. Cpuset support permits jails to be bound to specific processor sets after creation. Jails can have an unrestricted (no duplicate protection, etc.) name in addition to the hostname. The jail name cannot be changed from within a jail and is considered to be used for management purposes or as audit-token in the future. DDB 'show jails' command was added to aid debugging. Proper compat support permits 32bit jail binaries to be used on 64bit systems to manage jails. Also backward compatibility was preserved where possible: for jail v1 syscalls, as well as with user space management utilities. Both jail as well as prison version were updated for the new features. A gap was intentionally left as the intermediate versions had been used by various patches floating around the last years. Bump __FreeBSD_version for the afore mentioned and in kernel changes. Special thanks to: - Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches and Olivier Houchard (cognet) for initial single-IPv6 patches. - Jeff Roberson (jeff) and Randall Stewart (rrs) for their help, ideas and review on cpuset and SCTP support. - Robert Watson (rwatson) for lots and lots of help, discussions, suggestions and review of most of the patch at various stages. - John Baldwin (jhb) for his help. - Simon L. Nielsen (simon) as early adopter testing changes on cluster machines as well as all the testers and people who provided feedback the last months on freebsd-jail and other channels. - My employer, CK Software GmbH, for the support so I could work on this. Reviewed by: (see above) MFC after: 3 months (this is just so that I get the mail) X-MFC Before: 7.2-RELEASE if possible
* Support kernel crash mini dumps on ARM architecture.raj2008-11-064-4/+286
| | | | Obtained from: Juniper Networks, Semihalf
* Reduce code duplication: use calloc() intead of malloc()delphij2008-10-171-4/+2
| | | | and memset afterward.
* _kvm_malloc allocates memory through calloc() whichdelphij2008-10-172-2/+0
| | | | returns zeroed memory, so don't redo the initialization.
* Add a "CACHING" section regarding the internal caching of kernel variablesjhb2008-08-211-0/+8
| | | | and the ability to clear that cache.
* Add a new routine kvm_getcptime(3) for fetching the equivalent ofjhb2008-08-194-3/+214
| | | | | | | | | | 'kern.cp_time'. For a live kernel it uses the sysctl. For a crashdump, it first checks to see if the kernel has a 'cp_time' global symbol. If it does, it uses that. If that doesn't work, when it uses the recently added kvm_getmaxcpu(3) and kvm_getpcpu(3) routines to walk all the CPUs and sum up their counters. MFC after: 1 week
* Add two new routines to libkvm for working with per-CPU data:jhb2008-08-194-3/+251
| | | | | | kvm_getmaxcpu() and kvm_getpcpu(). MFC after: 1 week
* First cut at doing the kvm file needed for mips.imp2008-07-231-0/+90
| | | | Obtained from: gonzo@
* Use _WANT_FILE to make struct file visible from userland. This ispjd2008-05-261-2/+1
| | | | | | similar to _WANT_UCRED and _WANT_PRISON and seems to be much nicer than defining _KERNEL. It is also needed for my sys/refcount.h change going in soon.
* - Don't inspect the P_SA flag. It's being removed.jeff2008-03-121-7/+2
|
* Plug memory leaks that is observed when argbuf or argspc is used in thedelphij2008-01-121-0/+4
| | | | | | | | context. Submitted by: Michal Vranek <michal.vranek seznam cz> PR: bin/118380 MFC after: 1 month
* - Update kvm_deadfiles to be compatible with the new system which has nojeff2007-12-301-44/+87
| | | | | | | | global list of all files. - Mark kvm_getfiles() as broken since the live version exports struct xfile with no filelist at the head and does so incorrectly and the deadfiles version exports struct file with a filelist at the head. It is not known if either version works or complies to the manpage.
* Aparrently MACXOCOMLEN exisrts only on my machinejulian2007-10-261-1/+1
|
* Introduce a way to make pure kernal threads.julian2007-10-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | kthread_add() takes the same parameters as the old kthread_create() plus a pointer to a process structure, and adds a kernel thread to that process. kproc_kthread_add() takes the parameters for kthread_add, plus a process name and a pointer to a pointer to a process instead of just a pointer, and if the proc * is NULL, it creates the process to the specifications required, before adding the thread to it. All other old kthread_xxx() calls return, but act on (struct thread *) instead of (struct proc *). One reason to change the name is so that any old kernel modules that are lying around and expect kthread_create() to make a process will not just accidentally link. fix top to show kernel threads by their thread name in -SH mode add a tdnam formatting option to ps to show thread names. make all idle threads actual kthreads and put them into their own idled process. make all interrupt threads kthreads and put them in an interd process (mainly for aesthetic and accounting reasons) rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper' man page fixes to follow.
* - When using kvm use the new conversion method to derive swtime.jeff2007-09-211-3/+16
| | | | Approved by: re
* - Move all of the PS_ flags into either p_flag or td_flags.jeff2007-09-171-2/+2
| | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
* Re-enable raw dump format support on i386 and amd64 for /dev/fwmem.simokawa2007-06-154-18/+39
|
* - Work-around the already partially broken rusage support in kvm byjeff2007-06-011-0/+2
| | | | | | completely disabling it until a full solution is agreed upon. Pointy hat to: me
* Add a level of indirection to the kernel PTE table. The oldmarcel2007-05-191-8/+16
| | | | | | | | | scheme allowed for 1024 PTE pages, each containing 256 PTEs. This yielded 2GB of KVA. This is not enough to boot a kernel on a 16GB box and in general too low for a 64-bit machine. By adding a level of indirection we now have 1024 2nd-level directory pages, each capable of supporting 2GB of KVA. This brings the grand total to 2TB of KVA.
* - Move 'struct swdevt' back into swap_pager.h and expose it to userland.jhb2007-02-071-5/+94
| | | | | | | | - Restore support for fetching swap information from crash dumps via kvm_get_swapinfo(3) to fix pstat -T/-s on crash dumps. Reviewed by: arch@, phk MFC after: 1 week
* Per Olivier Houchard, use the proper license for this file. Heimp2007-01-081-10/+10
| | | | | | | bogusly used the kvm_powerpc.c file as a template for the license, but then either wrote the code himself, or cribbed it from the kvm_i386 file. The only thing from the kvm_powerpc.c file was the license. Correct this mistake with his blessing.
* Remove the advertising clause. UCB did this some time ago, but theseimp2007-01-0818-72/+0
| | | | | | files were never updated to reflect that. MFC After: 2 days
* remove already commented out codejulian2006-12-061-33/+0
|
* Make KSE a kernel option, turned on by default in all GENERICjb2006-10-261-4/+4
| | | | | | | kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@
* unbreak build for sparc64 etc.kmacy2006-10-091-1/+2
| | | | | | | TARGET won't be defined on non subarches Approved by: rwatson (mentor) Reviewed by: jmg
* buildworld fixes for sun4vkmacy2006-10-092-0/+8
| | | | | | | not sure why pmap.c is included as it is unchanged Approved by: rwatson (mentor) Reviewed by: jmg
* Don't forget to set internal error message in kvm_nlist().wkoszek2006-09-201-2/+7
| | | | Approved by: cognet (mentor)
* Remove alpha-specific stuff.ru2006-08-231-213/+0
|
* Rev. 1.44 of this file didn't introduce a right solution,yar2006-07-251-0/+7
| | | | | | | but we don't seem to have one yet, so just add an XXX comment on passing rux_runtime to bintime2timeval() wrongly. Spotted by: gcc(1) (warning)
* Include strings.h for bzero()delphij2006-06-052-0/+2
|
* Teach libkvm how to read minidumps. It turns out that minidumps arepeter2006-04-216-0/+580
| | | | | | | | | | | | | | far more convenient for libkvm to work with because of the page table block at the beginning. As a result, the MD code is smaller. libkvm will automatically detect old vs mini dumps on i386 and amd64. libkvm will handle i386 PAE and non-PAE modes. There is a PAE flag in the i386 minidump header to signal the width of the entries in the page table block. Other convenient values are also present, such as kernbase and the direct map addresses on amd64.
* Validate that the supplied file is not empty before trying mmap(2) itcsjp2006-01-151-0/+5
| | | | | | | | and access the pages associated with it. Submitted by: Wojciech A. Koszek PR: bin/91411 MFC after: 1 week
* Fix a well duplicated fencepost error that stopped crashdumps beingpeter2005-10-202-7/+7
| | | | | | | | readable on certain random memory configurations. If the libkvm consumer tried to read something that was in the very last pdpe, pde or pte slot, it would bogusly fail. This is broken in RELENG_6 too.
* libkvm bits for arm.cognet2005-10-031-18/+162
|
OpenPOWER on IntegriCloud