aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Vidrine <nectar@FreeBSD.org>2002-09-13 15:09:07 +0000
committerJacques Vidrine <nectar@FreeBSD.org>2002-09-13 15:09:07 +0000
commit4917e7796c354d55f5f2bbff9882642661d52e11 (patch)
tree8286e19be662a002b180c76b65068ea8faa1215c
parent3465b7d32c15ed17f750a604fd5168e19ce6f27b (diff)
downloadsrc-4917e7796c354d55f5f2bbff9882642661d52e11.tar.gz
src-4917e7796c354d55f5f2bbff9882642661d52e11.zip
MFC src/lib/libkvm/kvm.c 1.23: mark file descriptors close-on-exec.
Notes
Notes: svn path=/releng/4.6/; revision=103292
-rw-r--r--UPDATING5
-rw-r--r--lib/libkvm/kvm.c12
-rw-r--r--sys/conf/newvers.sh2
3 files changed, 18 insertions, 1 deletions
diff --git a/UPDATING b/UPDATING
index 16d1ae2b9e45..e205069c1c0d 100644
--- a/UPDATING
+++ b/UPDATING
@@ -17,6 +17,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: p2
+ 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.
+
20020909: p1
Fix a bug in pkg_add(1) -r that made it look in the wrong place
for 4.6-RELEASE and 4.6.2-RELEASE packages.
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index d4a7645857e9..e7bde960d3ea 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -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
@@ -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 {
/*
@@ -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;
}
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 41301b633b39..a0deea1be78f 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -36,7 +36,7 @@
TYPE="FreeBSD"
REVISION="4.6.2"
-BRANCH="RELEASE-p1"
+BRANCH="RELEASE-p2"
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"