1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-11 09:50:12 +00:00

Report jail directory if set.

Sanity-check fd_lastfile.

PR:	62699
Patch by:	"Mark W. Krentel" <krentel@dreamscape.com>
This commit is contained in:
Poul-Henning Kamp 2005-01-29 11:38:00 +00:00
parent e937d4a295
commit 5dc1f79ed8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140958

View File

@ -106,6 +106,7 @@ __FBSDID("$FreeBSD$");
#define RDIR -3
#define TRACE -4
#define MMAP -5
#define JDIR -6
DEVS *devs;
@ -309,6 +310,9 @@ int Pid;
case MMAP: \
printf(" mmap"); \
break; \
case JDIR: \
printf(" jail"); \
break; \
default: \
printf(" %4d", i); \
break; \
@ -344,6 +348,11 @@ dofiles(struct kinfo_proc *kp)
* current working directory vnode
*/
vtrans(filed.fd_cdir, CDIR, FREAD);
/*
* jail root, if any.
*/
if (filed.fd_jdir)
vtrans(filed.fd_jdir, JDIR, FREAD);
/*
* ktrace vnode, if one
*/
@ -358,6 +367,12 @@ dofiles(struct kinfo_proc *kp)
* open files
*/
#define FPSIZE (sizeof (struct file *))
#define MAX_LASTFILE (0x1000000)
/* Sanity check on filed.fd_lastfile */
if (filed.fd_lastfile <= -1 || filed.fd_lastfile > MAX_LASTFILE)
return;
ALLOC_OFILES(filed.fd_lastfile+1);
if (!KVM_READ(filed.fd_ofiles, ofiles,
(filed.fd_lastfile+1) * FPSIZE)) {