summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgordon <gordon@FreeBSD.org>2017-11-15 22:49:47 +0000
committergordon <gordon@FreeBSD.org>2017-11-15 22:49:47 +0000
commit03a0fa11ebe6236939f2a28185b0d78d62b666b8 (patch)
treeaae272cb282f62551336f07e43215330b57e2e52
parent7bfcc0bdc10f78c17fe931789b415e0d95b7bdf7 (diff)
downloadFreeBSD-src-03a0fa11ebe6236939f2a28185b0d78d62b666b8.zip
FreeBSD-src-03a0fa11ebe6236939f2a28185b0d78d62b666b8.tar.gz
Properly bzero kldstat structure to prevent information leak. [SA-17:10]
Approved by: so Security: FreeBSD-SA-17:10.kldstat Security: CVE-2017-1088
-rw-r--r--UPDATING7
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c31
-rw-r--r--sys/conf/newvers.sh2
-rw-r--r--sys/kern/kern_linker.c12
4 files changed, 33 insertions, 19 deletions
diff --git a/UPDATING b/UPDATING
index ab284df..6f1bd5e 100644
--- a/UPDATING
+++ b/UPDATING
@@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to
the tip of head, and then rebuild without this option. The bootstrap process
from older version of current across the gcc/clang cutover is a bit fragile.
+20171115 p3 FreeBSD-SA-17:08.ptrace
+ FreeBSD-SA-17:10.kldstat
+
+ Fix ptrace(2) vulnerability. [SA-17:08.ptrace]
+
+ Fix kldstat(2) vulnerability. [SA-17:10.kldstat]
+
20171102 p3 FreeBSD-EN-17:09.tzdata
Update timezone database information. [EN-17:09]
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index a8e69b7..c097cf3 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -2950,8 +2950,8 @@ freebsd32_copyout_strings(struct image_params *imgp)
int
freebsd32_kldstat(struct thread *td, struct freebsd32_kldstat_args *uap)
{
- struct kld_file_stat stat;
- struct kld32_file_stat stat32;
+ struct kld_file_stat *stat;
+ struct kld32_file_stat *stat32;
int error, version;
if ((error = copyin(&uap->stat->version, &version, sizeof(version)))
@@ -2961,17 +2961,22 @@ freebsd32_kldstat(struct thread *td, struct freebsd32_kldstat_args *uap)
version != sizeof(struct kld32_file_stat))
return (EINVAL);
- error = kern_kldstat(td, uap->fileid, &stat);
- if (error != 0)
- return (error);
-
- bcopy(&stat.name[0], &stat32.name[0], sizeof(stat.name));
- CP(stat, stat32, refs);
- CP(stat, stat32, id);
- PTROUT_CP(stat, stat32, address);
- CP(stat, stat32, size);
- bcopy(&stat.pathname[0], &stat32.pathname[0], sizeof(stat.pathname));
- return (copyout(&stat32, uap->stat, version));
+ stat = malloc(sizeof(*stat), M_TEMP, M_WAITOK | M_ZERO);
+ stat32 = malloc(sizeof(*stat32), M_TEMP, M_WAITOK | M_ZERO);
+ error = kern_kldstat(td, uap->fileid, stat);
+ if (error == 0) {
+ bcopy(&stat->name[0], &stat32->name[0], sizeof(stat->name));
+ CP(*stat, *stat32, refs);
+ CP(*stat, *stat32, id);
+ PTROUT_CP(*stat, *stat32, address);
+ CP(*stat, *stat32, size);
+ bcopy(&stat->pathname[0], &stat32->pathname[0],
+ sizeof(stat->pathname));
+ error = copyout(stat32, uap->stat, version);
+ }
+ free(stat, M_TEMP);
+ free(stat32, M_TEMP);
+ return (error);
}
int
diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index 6d03232..6e7f7f2 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -44,7 +44,7 @@
TYPE="FreeBSD"
REVISION="11.1"
-BRANCH="RELEASE-p3"
+BRANCH="RELEASE-p4"
if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 4758cdc..6c653da 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1201,7 +1201,7 @@ out:
int
sys_kldstat(struct thread *td, struct kldstat_args *uap)
{
- struct kld_file_stat stat;
+ struct kld_file_stat *stat;
int error, version;
/*
@@ -1214,10 +1214,12 @@ sys_kldstat(struct thread *td, struct kldstat_args *uap)
version != sizeof(struct kld_file_stat))
return (EINVAL);
- error = kern_kldstat(td, uap->fileid, &stat);
- if (error != 0)
- return (error);
- return (copyout(&stat, uap->stat, version));
+ stat = malloc(sizeof(*stat), M_TEMP, M_WAITOK | M_ZERO);
+ error = kern_kldstat(td, uap->fileid, stat);
+ if (error == 0)
+ error = copyout(stat, uap->stat, version);
+ free(stat, M_TEMP);
+ return (error);
}
int
OpenPOWER on IntegriCloud