summaryrefslogtreecommitdiffstats
path: root/lib/libkvm
Commit message (Collapse)AuthorAgeFilesLines
* MFC r315698:ngie2017-05-281-1/+1
| | | | | | libkvm: bump WARNS to 6 after recent commits done to resolve warnings issues Tested with: make tinderbox; clang 4.0.0 (amd64), gcc 4.2.1/6.3.0 (amd64)
* MFC r319010:ngie2017-05-271-2/+2
| | | | | | | | Fix #if conditional added in r319008 I committed an earlier version of the file by accident This is a no-op on ^/head and ^/stable/11.
* MFC r319008:ngie2017-05-271-0/+5
| | | | | | | | | kvm_geterr_test: Compile out the portions that require kvm_open2(3) on systems that lack the libcall, based on __FreeBSD_version. kvm_open2(3) wasn't made available until r291406, which is in ^/stable/11, but not ^/stable/10. This makes some of kvm_geterr_test available for testing on ^/stable/10.
* MFC r316099:ngie2017-05-278-0/+533
| | | | | | | | | | | | | | | | | | | | | lib/libkvm: start adding basic tests for kvm(3) - kvm_close: add a testcase to verify support for errno = EINVAL / -1 (see D10065) when kd == NULL is provided to the libcall. - kvm_geterr: -- Add a negative testcase for kd == NULL returning "" (see D10022). -- Add two positive testcases: --- test the error case using kvm_write on a O_RDONLY descriptor. --- test the "no error" case using kvm_read(3) and kvm_nlist(3) as helper routines and by injecting a bogus error message via _kvm_err (an internal API) _kvm_err was used as there isn't a formalized way to clear the error output, and because kvm_nlist always returns ENOENT with the NULL terminator today. - kvm_open, kvm_open2: -- Add some basic negative tests for kvm_open(3) and kvm_open2(3). Testing positive cases with a specific `corefile`/`execfile`/`resolver` requires more work and would require user intervention today in order to reliably test this out.
* MFC r315697:ngie2017-03-2911-17/+25
| | | | | | | | | | | | libkvm: fix warning issues post-r291406 - Fix -Wunused warnings with *_native detection handlers by marking `kd` __unused, except with arm/mips, where a slightly more complicated scheme is required to handle the native case vs the non-native case. - Fix -Wmissing-variable-declarations warnings by marking struct kvm_arch objects static. Tested with: WIP test code (D10024) // kgdb7121 (i386 crash/kernel on amd64)
* MFC r315686,r315688:ngie2017-03-282-2/+16
| | | | | | | | | | | | | | | | | | | | | | r315686: kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner Return a NUL string instead of just working by accident with kvm_geterr(3) when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION being enabled path). Document the new explicit return behavior for kvm_geterr(3), as well as the previous implicit behavior, i.e., the buffer attached to returned via kvm_geterr(3) would be empty if a previous error hadn't been stored in `kd`. r315688: kvm_write: fix -Wcast-qual warning in pointer arithmetic argument Cast buf to `const char *` when doing arithmetic operation to match `cp`'s type [1].
* MFC r315595,r315601,r315603,r315647:ngie2017-03-273-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r315595: Remove a commented out line before kvm_getprocs(3) The commented out return value for kvm_getprocs(3) was misleading -- the uncommented line is correct. No content change r315601: kvm_open2(3): remove '*' when describing addr argument for `resolver` As noted by vangyzen, with a similar issue in D10022, the pointer portion of the .Fa macro call is unnecessary, so remove the '*'. r315603: kvm_close(3): return `error` instead of blindly returning `0` `error` is the accumulated error from previous close(2) calls. This bug has been present since the libcall's import from 4.4BSD Lite (r1573). Noticed by: vangyzen (D10022) Relnotes: yes r315647: Handle kd == NULL gracefully with kvm_close(3) Don't segfault in kvm_close(3) if provided a NULL pointer. Instead, return -1 and set errno to EINVAL. Document this new behavior explicitly.
* MFC r315360:ngie2017-03-231-4/+4
| | | | | | | | | Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files} This is being done for the following reasons: - kvm_open(3), etc says they will return NULL. - NULL by definition is (void*)0 per POSIX, but can be redefined, depending on the compiler, etc.
* MFC r315362,r315363,r315365:ngie2017-03-232-5/+5
| | | | | | | | | | | | | | | | | | | | | | | r315362: Capitalize .Dt macro argument By convention, per mdoc(7), the document title should be all caps. r315363: Fix manlint errors - Add missing comma after kvm_dpcpu_setcpu .Nm macro use (multiple .Nm entries should be separated by commas) - Add missing section for kvm_dpcpu_setcpu Xr. r315365: Tweak r315363 slightly I noticed after commit that kvm_dpcpu_setcpu was defined in the manpage. Thus, the correct macro for the function reference is .Fn, not .Xr.
* MFC r310630: libkvm: support access to vmm guest memory, allow writes toavg2017-01-182-7/+48
| | | | | | fwmem and vmm Sponsored by: Panzura
* MFC r311101:pfg2017-01-163-9/+11
| | | | | | | | | libkvm - extend a bit the swap statistics field. Change ksw_used and ksw_total to unsigned, which increases the maximum total swap that can be displayed properly from ~8TB to ~16TB. Obtained from: DragonflyBSD (ecc2e461)
* MFC r309676vangyzen2016-12-151-2/+0
| | | | | | | | | | | | | Export the whole thread name in kinfo_proc kinfo_proc::ki_tdname is three characters shorter than thread::td_name. Add a ki_moretdname field for these three extra characters. Add the new field to kinfo_proc32, as well. Update all in-tree consumers to read the new field and assemble the full name, except for lldb's HostThreadFreeBSD.cpp, which I will handle separately. Bump __FreeBSD_version. Sponsored by: Dell EMC
* lib: minor spelling fixes in comments.pfg2016-05-013-5/+5
| | | | No functional change.
* Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) failsngie2016-04-301-0/+1
| | | | | | | MFC after: 1 week Reported by: Coverity CID: 1341474 Sponsored by: EMC / Isilon Storage Division
* Remove a -Wunused-but-set-variable variable -- `pa`ngie2016-04-301-2/+0
| | | | | Reported by: gcc 5.x Sponsored by: EMC / Isilon Storage Division
* Remove kvm_getfiles(3)ngie2016-04-305-319/+4
| | | | | | | | | | | This libcall has been broken since (at least) r174989/8.0-RELEASE. Bump SHLIB_MAJOR for the change Differential Revision: https://reviews.freebsd.org/D6052 Relnotes: yes Reviewed by: jhb, markj Sponsored by: EMC / Isilon Storage Division
* Fix memory allocation edgecases in kvm_argv(..)ngie2016-04-301-3/+12
| | | | | | | | | | | | | - Don't leak nbufp on realloc failure in kvm_argv - Catch malloc errors with bufp - Set buflen last in the "buflen == 0" case to ensure that bufp/nbufp is properly reallocated on the next go around Differential Revision: https://reviews.freebsd.org/D6051 MFC after: 1 week Reviewed by: jhb, markj Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division
* Fix up pointer issues with lib/libkvmngie2016-04-2210-35/+52
| | | | | | | | | | | | | | | | In particular, - avoid dereferencing NULL pointers - test pointers against NULL, not 0 - test for errout == NULL in the top-level functions (kvm_open, kvm_openfiles, kvm_open2, etc) - Replace a realloc and free on failure with reallocf Found with: devel/cocchinelle Differential Revision: https://reviews.freebsd.org/D5954 MFC after: 1 week Reviewed by: jhb Sponsored by: EMC / Isilon Storage Division
* MFHgjb2016-04-041-1/+1
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * Fix parsing of a 1GB page table entry.jhb2016-03-281-1/+1
| | | | | | | | | | | | | | | | Use 'pdpe' to extract the PA of the 1GB page instead of 'pde' (which was a copy and paste bug from the 2MB page case further down). CID: 1341467 Reported by: pfg
* | MFHgjb2016-02-222-8/+7
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Rename pte.h to pte-v4.h and start including directly either pte-v4.hskra2016-02-191-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | or pte-v6.h in files which needs it. There are quite internal definitions in pte-v4.h and pte-v6.h headers specific for corresponding pmap implementation. These headers should be included only in very few files and an intention is to not hide for which implementation such files are. Further, sys/arm/arm/elf_trampoline.c is an example of file which uses armv4 like pmap implementation for both armv4 and armv6 platforms. This is another reason why pte.h which includes specific header according to __ARM_ARCH is not created.
| * Remove redundant ARM_L2_ADDR_BITS and L2_ADDR_BITS definitions andskra2016-02-182-4/+1
| | | | | | | | replace them by primary ones where needed.
* | First pass through library packaging.gjb2016-02-041-0/+1
|/ | | | Sponsored by: The FreeBSD Foundation
* Add mmu format info into ARM vmcore.skra2016-01-152-9/+28
| | | | | | | | Fix kvatop translation for 64K pages. Reviewed by: jhb Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D4942
* Fix building with GCC since PAGE_MASK is signed on i386.jhb2016-01-141-1/+1
| | | | | | Reviewed by: ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D4772
* Add support to libkvm for reading vmcores from other architectures.jhb2015-11-2735-1560/+2352
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a kvaddr_type to represent kernel virtual addresses instead of unsigned long. - Add a struct kvm_nlist which is a stripped down version of struct nlist that uses kvaddr_t for n_value. - Add a kvm_native() routine that returns true if an open kvm descriptor is for a native kernel and memory image. - Add a kvm_open2() function similar to kvm_openfiles(). It drops the unused 'swapfile' argument and adds a new function pointer argument for a symbol resolving function. Native kernels still use _fdnlist() from libc to resolve symbols if a resolver function is not supplied, but cross kernels require a resolver. - Add a kvm_nlist2() function similar to kvm_nlist() except that it uses struct kvm_nlist instead of struct nlist. - Add a kvm_read2() function similar to kvm_read() except that it uses kvaddr_t instead of unsigned long for the kernel virtual address. - Add a new kvm_arch switch of routines needed by a vmcore backend. Each backend is responsible for implementing kvm_read2() for a given vmcore format. - Use libelf to read headers from ELF kernels and cores (except for powerpc cores). - Add internal helper routines for the common page offset hash table used by the minidump backends. - Port all of the existing kvm backends to implement a kvm_arch switch and to be cross-friendly by using private constants instead of ones that vary by platform (e.g. PAGE_SIZE). Static assertions are present when a given backend is compiled natively to ensure the private constants match the real ones. - Enable all of the existing vmcore backends on all platforms. This means that libkvm on any platform should be able to perform KVA translation and read data from a vmcore of any platform. Tested on: amd64, i386, sparc64 (marius) Differential Revision: https://reviews.freebsd.org/D3341
* Remove trailing whitespace.jhb2015-11-2610-17/+17
|
* Remove kvm_sparc.c. This is for 32-bit sparc support and was importedjhb2015-11-261-236/+0
| | | | from 4.4BSD. It has never been used by FreeBSD.
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.bdrewery2015-11-251-1/+0
| | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division
* Add support to libkvm for reading minidumps on arm64. The kernel side isandrew2015-08-203-10/+320
| | | | | | | | | missing until it can be cleaned up. Reviewed by: jhb Approved by: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3319
* The si_status field of the siginfo_t, provided by the waitid(2) andkib2015-07-181-1/+3
| | | | | | | | | | | | | | | | SIGCHLD signal, should keep full 32 bits of the status passed to the _exit(2). Split the combined p_xstat of the struct proc into the separate exit status p_xexit for normal process exit, and signalled termination information p_xsig. Kernel-visible macro KW_EXITCODE() reconstructs old p_xstat from p_xexit and p_xsig. p_xexit contains complete status and copied out into si_status. Requested by: Joerg Schilling Reviewed by: jilles (previous version), pho Tested by: pho Sponsored by: The FreeBSD Foundation
* Revert r284417 it is not necessary anymorebapt2015-06-151-1/+1
|
* Enforce overwritting SHLIBDIRbapt2015-06-151-1/+1
| | | | | | | | | Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere. This makes /lib being populated again. Reported by: many
* Add META_MODE support.sjg2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-271-0/+64
| |\ | |/ |/|
| * Merge from head@274682sjg2014-11-192-12/+46
| |\
| * \ Merge head from 7/28sjg2014-08-193-379/+2
| |\ \
| * | | Updated dependenciessjg2014-05-161-1/+1
| | | |
| * | | Updated dependenciessjg2014-05-101-0/+2
| | | |
| * | | Merge headsjg2014-04-279-88/+252
| |\ \ \
| * \ \ \ Merge from headsjg2013-09-054-33/+17
| |\ \ \ \
| * \ \ \ \ sync from headsjg2013-04-124-8/+90
| |\ \ \ \ \
| * | | | | | Updated dependenciessjg2013-03-111-0/+1
| | | | | | |
| * | | | | | Updated dependenciessjg2013-02-161-2/+0
| | | | | | |
| | | | | | |
| | \ \ \ \ \
| *-. \ \ \ \ \ Sync from headsjg2012-11-042-3/+10
| |\ \ \ \ \ \ \
| * | | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+19
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | | | | Add stub functions to build libkvm. There will be added, but we need themandrew2015-04-021-0/+64
| |_|_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | now get the toolchain target building. Differential Revision: https://reviews.freebsd.org/D2185 Sponsored by: The FreeBSD Foundation
* | | | | | | Allow libkvm to get the kernel va to pa delta without the need forandrew2014-10-191-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | physaddr. This should allow for a kernel where PHYSADDR and KERNPHYSADDR are both undefined. For now libkvm will use the old method of reading physaddr and kernaddr to allow it to work with old kernels. This could be removed in the future when enough time has passed. Differential Revision: https://reviews.freebsd.org/D939 MFC after: 1 week
OpenPOWER on IntegriCloud