aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2012-06-12 12:10:10 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2012-06-12 12:10:10 +0000
commit03bfa4c289a83087dec6e108481aca8e39418eb0 (patch)
tree58c04a59b64677bad8f6d63099a894aa87d5cfd8
parent932e6259f0f3160a9dd6c617b3881238c42f7a8f (diff)
downloadsrc-03bfa4c289a83087dec6e108481aca8e39418eb0.tar.gz
src-03bfa4c289a83087dec6e108481aca8e39418eb0.zip
Fix a problem where zero-length RDATA fields can cause named(8) to crash.
[12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz)
Notes
Notes: svn path=/releng/8.3/; revision=236953
-rw-r--r--UPDATING11
-rw-r--r--contrib/bind9/lib/dns/rdata.c4
-rw-r--r--contrib/bind9/lib/dns/rdataslab.c11
-rw-r--r--sys/amd64/amd64/trap.c17
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/netinet/tcp_input.c5
-rw-r--r--sys/netinet6/in6.c19
-rw-r--r--sys/netinet6/ip6_input.c24
8 files changed, 72 insertions, 21 deletions
diff --git a/UPDATING b/UPDATING
index 1352cf450b3a..39a64129231c 100644
--- a/UPDATING
+++ b/UPDATING
@@ -15,6 +15,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW ON IA64 OR SUN4V:
debugging tools present in HEAD were left in place because
sun4v support still needs work to become production ready.
+20120612: p3 FreeBSD-SA-12:03.bind
+ FreeBSD-SA-12:04.sysret
+ FreeBSD-EN-12:02.ipv6refcount
+ Fix a problem where zero-length RDATA fields can cause named to crash.
+ [12:03]
+
+ Correct a privilege escalation when returning from kernel if
+ running FreeBSD/amd64 on non-AMD processors. [12:04]
+
+ Fix reference count errors in IPv6 code. [EN-12:02]
+
20120530: p2 FreeBSD-SA-12:01.openssl (revised),
FreeBSD-SA-12:02.crypt
Update the previous openssl fix. [12:01]
diff --git a/contrib/bind9/lib/dns/rdata.c b/contrib/bind9/lib/dns/rdata.c
index b29cd16bae27..19f84914a4ef 100644
--- a/contrib/bind9/lib/dns/rdata.c
+++ b/contrib/bind9/lib/dns/rdata.c
@@ -341,8 +341,8 @@ dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) {
REQUIRE(rdata1 != NULL);
REQUIRE(rdata2 != NULL);
- REQUIRE(rdata1->data != NULL);
- REQUIRE(rdata2->data != NULL);
+ REQUIRE(rdata1->length == 0 || rdata1->data != NULL);
+ REQUIRE(rdata2->length == 0 || rdata2->data != NULL);
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1));
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2));
diff --git a/contrib/bind9/lib/dns/rdataslab.c b/contrib/bind9/lib/dns/rdataslab.c
index d1a02a0cad6a..41038d4f1362 100644
--- a/contrib/bind9/lib/dns/rdataslab.c
+++ b/contrib/bind9/lib/dns/rdataslab.c
@@ -125,6 +125,11 @@ isc_result_t
dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
isc_region_t *region, unsigned int reservelen)
{
+ /*
+ * Use &removed as a sentinal pointer for duplicate
+ * rdata as rdata.data == NULL is valid.
+ */
+ static unsigned char removed;
struct xrdata *x;
unsigned char *rawbuf;
#if DNS_RDATASET_FIXED
@@ -164,6 +169,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
INSIST(result == ISC_R_SUCCESS);
dns_rdata_init(&x[i].rdata);
dns_rdataset_current(rdataset, &x[i].rdata);
+ INSIST(x[i].rdata.data != &removed);
#if DNS_RDATASET_FIXED
x[i].order = i;
#endif
@@ -196,8 +202,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
*/
for (i = 1; i < nalloc; i++) {
if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) {
- x[i-1].rdata.data = NULL;
- x[i-1].rdata.length = 0;
+ x[i-1].rdata.data = &removed;
#if DNS_RDATASET_FIXED
/*
* Preserve the least order so A, B, A -> A, B
@@ -284,7 +289,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
#endif
for (i = 0; i < nalloc; i++) {
- if (x[i].rdata.data == NULL)
+ if (x[i].rdata.data == &removed)
continue;
#if DNS_RDATASET_FIXED
offsettable[x[i].order] = rawbuf - offsetbase;
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 2c97a2b4d343..7728205e9c1c 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -945,4 +945,21 @@ amd64_syscall(struct thread *td, int traced)
syscallname(td->td_proc, sa.code)));
syscallret(td, error, &sa);
+
+ /*
+ * If the user-supplied value of %rip is not a canonical
+ * address, then some CPUs will trigger a ring 0 #GP during
+ * the sysret instruction. However, the fault handler would
+ * execute with the user's %gs and %rsp in ring 0 which would
+ * not be safe. Instead, preemptively kill the thread with a
+ * SIGBUS.
+ */
+ if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) {
+ ksiginfo_init_trap(&ksi);
+ ksi.ksi_signo = SIGBUS;
+ ksi.ksi_code = BUS_OBJERR;
+ ksi.ksi_trapno = T_PROTFLT;
+ ksi.ksi_addr = (void *)td->td_frame->tf_rip;
+ trapsignal(td, &ksi);
+ }
}
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 0b19c87b61af..7943050731b9 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="8.3"
-BRANCH="RELEASE-p2"
+BRANCH="RELEASE-p3"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index c5c03dc8e796..85a8b8755ff7 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -538,6 +538,8 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
(caddr_t)&ip6->ip6_dst - (caddr_t)ip6);
return IPPROTO_DONE;
}
+ if (ia6)
+ ifa_free(&ia6->ia_ifa);
tcp_input(m, *offp);
return IPPROTO_DONE;
@@ -1206,7 +1208,8 @@ relocked:
rstreason = BANDLIM_RST_OPENPORT;
goto dropwithreset;
}
- ifa_free(&ia6->ia_ifa);
+ if (ia6)
+ ifa_free(&ia6->ia_ifa);
}
#endif
/*
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index ce01d220ae07..56e6ea40808b 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1548,14 +1548,19 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data,
hostid = IFA_IN6(ifa);
/* prefixlen must be <= 64. */
- if (64 < iflr->prefixlen)
+ if (64 < iflr->prefixlen) {
+ if (ifa != NULL)
+ ifa_free(ifa);
return EINVAL;
+ }
prefixlen = iflr->prefixlen;
/* hostid part must be zero. */
sin6 = (struct sockaddr_in6 *)&iflr->addr;
if (sin6->sin6_addr.s6_addr32[2] != 0 ||
sin6->sin6_addr.s6_addr32[3] != 0) {
+ if (ifa != NULL)
+ ifa_free(ifa);
return EINVAL;
}
} else
@@ -2148,14 +2153,20 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst)
IF_ADDR_UNLOCK(ifp);
return (struct in6_ifaddr *)ifa;
}
- IF_ADDR_UNLOCK(ifp);
/* use the last-resort values, that are, deprecated addresses */
- if (dep[0])
+ if (dep[0]) {
+ ifa_ref((struct ifaddr *)dep[0]);
+ IF_ADDR_UNLOCK(ifp);
return dep[0];
- if (dep[1])
+ }
+ if (dep[1]) {
+ ifa_ref((struct ifaddr *)dep[1]);
+ IF_ADDR_UNLOCK(ifp);
return dep[1];
+ }
+ IF_ADDR_UNLOCK(ifp);
return NULL;
}
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 089cee183630..86f5721bc59f 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -734,19 +734,23 @@ passin:
* as our interface address (e.g. multicast addresses, addresses
* within FAITH prefixes and such).
*/
- if (deliverifp && !ip6_getdstifaddr(m)) {
+ if (deliverifp) {
struct in6_ifaddr *ia6;
- ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
- if (ia6) {
- if (!ip6_setdstifaddr(m, ia6)) {
- /*
- * XXX maybe we should drop the packet here,
- * as we could not provide enough information
- * to the upper layers.
- */
- }
+ if ((ia6 = ip6_getdstifaddr(m)) != NULL) {
ifa_free(&ia6->ia_ifa);
+ } else {
+ ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst);
+ if (ia6) {
+ if (!ip6_setdstifaddr(m, ia6)) {
+ /*
+ * XXX maybe we should drop the packet here,
+ * as we could not provide enough information
+ * to the upper layers.
+ */
+ }
+ ifa_free(&ia6->ia_ifa);
+ }
}
}