summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb/kvm_mkdb.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-2/+2
| | | | | | 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@
* The call to setegid(2) was replaced with setresgid(2) a while ago.tb2017-11-211-2/+2
| | | | Adjust error message accordingly.
* use setresgid() rather than setegid, all 3 gids can go the same way.deraadt2016-04-251-2/+2
| | | | discussion with millert
* 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".
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-4/+3
| | | | | | | | | 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)
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-15/+1
| | | | | | | 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
* fix off-by-ones in path truncation checks. from Han Boetes; ok deraadt@djm2005-04-141-4/+4
|
* add -o option to generate kvm database in alternate directory;djm2003-11-211-13/+35
| | | | manpage nits jmc@ ok tedu@
* ansi and protosderaadt2003-06-261-11/+5
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* use snamesize and realloc properly. ok tdeval@tedu2003-04-061-3/+3
|
* 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-161-4/+4
|
* Document -vespie1999-04-181-7/+7
| | | | Give more precise error messages in case of failure
* Only print "already up to date" if in verbose modemillert1999-03-291-5/+5
|
* Only exit in nlist.c due to a memory error, otherwise just return. A return value of 1 indicates an incorrect executable type, a return value of -1 indicates some other problem. This gives us better fallback from /dev/ksyms to /bsd.millert1999-03-241-17/+18
|
* Better fallback from /dev/ksyms to /bsd if there are problems with an nlist of /dev/ksymsmillert1999-03-241-21/+49
|
* crank RLIMIT_DATA, seems to be necessary for some peoplemillert1998-10-061-2/+14
|
* o If the user doesn't specify a file, use /dev/ksyms in preference tomillert1998-08-231-6/+15
| | | | | | /bsd if it exists and we can open it. o Fix a bug where kvm_mkdb would leave a temp file in /var/db if the file argument didn't exit.
* clean up our temp files on failuremillert1998-08-191-6/+12
|
* Make kvm_mkdb work againmillert1998-08-191-11/+18
| | | | | | | | | | | o testdb() needs to take as an arg the name of the kernel so it can do the version test correctly. o add undocumented verbose flag to tell when we are rebuilding the .db file o DO_* -> _NLIST_DO_*, this prevented kvm_mkdb from doing anything at all. o preserve a few error messages so you get error output when none of the exec types match the target. o check malloc return values o get_kerntext should not subtract the sizeof(struct exec) from kernel_text
* From NetBSD: make testdb() fail if database version string has length zero.millert1997-01-151-4/+9
| | | | | Also, KNF, b* -> mem*, getopt tests against -1, not EOF, and index -> strchr. Added OpenBSD tags.
* initial import of NetBSD treederaadt1995-10-181-0/+121