aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2017-11-15 22:49:47 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2017-11-15 22:49:47 +0000
commitea78ebbe02c23eb1f30e7c2d58f7d77dcee94f7f (patch)
treeaae272cb282f62551336f07e43215330b57e2e52
parent76b971e02fc70584206e60beac7827b92846b9b8 (diff)
downloadsrc-ea78ebbe02c23eb1f30e7c2d58f7d77dcee94f7f.tar.gz
src-ea78ebbe02c23eb1f30e7c2d58f7d77dcee94f7f.zip
Properly bzero kldstat structure to prevent information leak. [SA-17:10]
Approved by: so Security: FreeBSD-SA-17:10.kldstat Security: CVE-2017-1088
Notes
Notes: svn path=/releng/11.1/; revision=325875
-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 ab284df7c765..6f1bd5e36d4e 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 a8e69b731fe7..c097cf376867 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 6d03232a1e9e..6e7f7f204fe9 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 4758cdc2072a..6c653da5df15 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