Skip to content

Commit

Permalink
MFC src/lib/libkvm/kvm.c 1.23: mark file descriptors close-on-exec.
Browse files Browse the repository at this point in the history
  • Loading branch information
nectar authored and nectar committed Sep 13, 2002
1 parent 5cc27fd commit 9b15056
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions UPDATING
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ minimal number of processes, if possible, for that patch. For those
updates that don't have an advisory, or to be safe, you can do a full
build and install as described in the COMMON ITEMS section.

20020911: p20
The kvm_openfiles/kvm_open functions now mark the returned file
descriptors close-on-exec in case set-user-ID/set-group-ID
applications are careless.

20020813: p19 FreeBSD-SA-02:38.signed-error
Bounds checking errors in accept(), getsockname(),
getpeername(), and a VESA ioctl() command were corrected.
Expand Down
12 changes: 12 additions & 0 deletions lib/libkvm/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ _kvm_open(kd, uf, mf, flag, errout)
_kvm_syserr(kd, kd->program, "%s", mf);
goto failed;
}
if (fcntl(kd->pmfd, F_SETFD, FD_CLOEXEC) < 0) {
_kvm_syserr(kd, kd->program, "%s", mf);
goto failed;
}
if (S_ISCHR(st.st_mode)) {
/*
* If this is a character special device, then check that
Expand All @@ -224,6 +228,10 @@ _kvm_open(kd, uf, mf, flag, errout)
_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
goto failed;
}
if (fcntl(kd->vmfd, F_SETFD, FD_CLOEXEC) < 0) {
_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
goto failed;
}
}
} else {
/*
Expand All @@ -235,6 +243,10 @@ _kvm_open(kd, uf, mf, flag, errout)
_kvm_syserr(kd, kd->program, "%s", uf);
goto failed;
}
if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) {
_kvm_syserr(kd, kd->program, "%s", uf);
goto failed;
}
if (_kvm_initvtop(kd) < 0)
goto failed;
}
Expand Down
2 changes: 1 addition & 1 deletion sys/conf/newvers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

TYPE="FreeBSD"
REVISION="4.5"
BRANCH="RELEASE-p19"
BRANCH="RELEASE-p20"
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"

Expand Down

0 comments on commit 9b15056

Please sign in to comment.