summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-283-6/+6
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* If we pass `file' via args then we need to unveil(2) it with read permission,mestre2018-10-261-3/+17
| | | | | | | | | | | | | | | | otherwise if omitted we need to unveil(2) both _PATH_UNIX and _PATH_KSYMS with same permissions. Unconditionally we need to also unveil(2) dbdir, which by default is _PATH_VARDB but can be changed via args (-o directory), with read/write/create permissions. There are a couple of temp files that will be created but it's inside dbdir so there's no need to unveil(2) them individually. Since we already call pledge(2) before, twice, we need to add "unveil" promise to both of them, and finally call pledge(2) once again with the needed promises except "unveil". OK millert@
* Use <fcntl.h> instead of <sys/file.h> for open() and friends.guenther2018-04-261-8/+4
| | | | | | | Delete a bunch of unnecessary #includes and sort to match style(9) while doing the above cleanup. ok deraadt@ krw@
* The call to setegid(2) was replaced with setresgid(2) a while ago.tb2017-11-211-2/+2
| | | | Adjust error message accordingly.
* Use <elf.h> instead of <elf_abi.h>mpi2017-10-271-2/+2
| | | | ok jasper@, jca@, deraadt@
* missing fclose() in an error pathjsg2016-09-101-2/+4
|
* use setresgid() rather than setegid, all 3 gids can go the same way.deraadt2016-04-251-2/+2
| | | | discussion with millert
* Remove NULL-checks before free(). ok tb@mmcc2015-12-101-3/+2
|
* missing pledge "getpw" for getgrnam(3)deraadt2015-11-231-2/+2
|
* Set the effective gid to kmem so the fchown of kvm_bsd.db is allowedmillert2015-11-081-16/+28
| | | | | by pledge(2). This requires pledge "id" but that can be dropped immediately after the setegid() call. From Theo Buehler
* there is a retry path in here which contains rename() and fchown().deraadt2015-11-051-5/+4
| | | | | Use a slightly larger pledge, earlier on. from gregor best
* Implement real "flock" request and add it to userland programs thatmillert2015-10-161-2/+2
| | | | use pledge and file locking. OK deraadt@
* semarie points out i am already forgetting the rules are very tight aroundderaadt2015-10-131-6/+2
| | | | | *chown, even "proc fattr" won't let you do such a job. remove early pledge(), only leave call after fchown, before when symbol table work gets done.
* oops, a chown appears late on the code. to satisfy this pledgederaadt2015-10-131-9/+16
| | | | | | | | "stdio rpath wpath cpath getpw fattr proc" early on; "proc fattr" allows doing work with other uids on the file. after opening the db, do the chown (replace with fchown since we know fd) and then pledge "stdio rpath"; "rpath" due to tmpfile rename() at the end. mistake spotted by mpi
* kvm_mkdb & dev_mkdb are quite similar. pledge "stdio rpath wpath cpath"deraadt2015-10-121-1/+4
| | | | except kvm_mkdb also does "getpw".
* stdlib.h is in scope; do not cast malloc/calloc/realloc*deraadt2015-08-201-2/+2
| | | | ok millert krw
* do not require <a.out.h>deraadt2015-01-181-2/+1
|
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-163-8/+7
| | | | | | | | | possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* the kvm database only needs to be readable by kmem group. make it so.tedu2014-12-231-6/+15
|
* Make sure the correct errno is reported by warn* or err* and notguenther2014-07-201-2/+2
| | | | | | the errno of an intervening cleanup operation like close/unlink/etc. Diff from Doug Hogan (doug (at) acyclic.org)
* Use errc/warnc to simplify code.guenther2014-05-201-2/+2
| | | | | | Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
* remove the code that iterates over binary types, since everything is nowderaadt2013-11-121-21/+9
| | | | ELF.
* tedu a.out supportderaadt2013-10-151-375/+1
|
* Correct format string mismatches turned up by -Wformat=2guenther2013-08-221-2/+2
| | | | suggestions and ok millert@
* Allow for a kernel linked at address zero; ok guenther@ millert@miod2013-01-291-3/+4
|
* iterate over e_shnum using Elf32_Word instead of intderaadt2012-04-061-2/+3
|
* patch a whole bunch of memory leaks, parfait only spotted one of themderaadt2009-11-111-22/+41
| | | | ok miod jsg
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-273-33/+3
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-021-3/+3
|
* convert to new .Dd format;jmc2007-05-311-2/+2
|
* do not use section names for locating a string tab; miod@ okmickey2007-03-181-29/+18
|
* fix off-by-ones in path truncation checks. from Han Boetes; ok deraadt@djm2005-04-141-4/+4
|
* Use sysctl to get the running kernel version instead of grottingmillert2004-11-241-44/+22
| | | | | through kmem. Fixes false positives on machines where the memory is not cleared between boots. OK deraadt@, tedu@, jaredy@
* add -o option to generate kvm database in alternate directory;djm2003-11-212-17/+48
| | | | manpage nits jmc@ ok tedu@
* realloc fixes; markus okderaadt2003-09-251-6/+26
|
* ansi and protosderaadt2003-06-263-36/+15
|
* - section reorderjmc2003-06-121-2/+2
| | | | | | - macro fixes - kill whitespace at EOL - new sentence, new line
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-025-33/+13
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* use snamesize and realloc properly. ok tdeval@tedu2003-04-062-12/+16
|
* strlcpy; tedu okderaadt2003-04-041-5/+6
|
* be better about the STT_NOTYPE symbols, not all become N_UNDEF this way; pefo@ okmickey2002-11-301-3/+19
|
* prepend the underscore always for elf, this makes kvm_bsd.db work on elf platforms; drahn@ millert@ okmickey2002-10-251-11/+6
|
* fopen() does not return < 0deraadt2002-09-061-3/+3
|
* minor KNFderaadt2002-05-301-5/+4
|
* bring in prototypesderaadt2002-03-251-3/+3
|
* kill more registers.mpech2002-03-142-12/+12
| | | | millert@ ok
* Fix ELF so it works with /dev/ksyms. Also make 'detection' of ksymspefo2002-02-201-34/+66
| | | | a little more robust by looking at the actual namelist filename.
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-163-11/+11
|
* MAP_COPY -> MAP_SHARED (it's ok in this case (/dev/ksyms))art2001-05-111-3/+3
|
* ELF: fallback to malloc when mmap fails. for /dev/ksyms.art2001-02-031-7/+27
|