aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2017-11-15 22:51:08 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2017-11-15 22:51:08 +0000
commitf8ea0a67d3893ae14d6cccf766bccd7226474cf9 (patch)
tree43890fb76aa9401bbb1991ec56f06914341e3e89
parentae7f9f96b8cdcea9fa4de186d61206ae0a2aa9b6 (diff)
downloadsrc-f8ea0a67d3893ae14d6cccf766bccd7226474cf9.tar.gz
src-f8ea0a67d3893ae14d6cccf766bccd7226474cf9.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/10.3/; revision=325878
-rw-r--r--UPDATING10
-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, 36 insertions, 19 deletions
diff --git a/UPDATING b/UPDATING
index 4f13bb31ca6f..3af542afba6e 100644
--- a/UPDATING
+++ b/UPDATING
@@ -16,6 +16,16 @@ from older versions of FreeBSD, try WITHOUT_CLANG to bootstrap to the tip of
stable/10, and then rebuild without this option. The bootstrap process from
older version of current is a bit fragile.
+20171115 p24 FreeBSD-SA-17:08.ptrace
+ FreeBSD-SA-17:09.shm
+ FreeBSD-SA-17:10.kldstat
+
+ Fix ptrace(2) vulnerability. [SA-17:08.ptrace]
+
+ Fix POSIX shm namespace vulnerability. [SA-17:09.shm]
+
+ Fix kldstat(2) vulnerability. [SA-17:10.kldstat]
+
20171102 p23 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 2f60c138b995..9aa885dc3a46 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -3040,8 +3040,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)))
@@ -3051,17 +3051,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 5d3b3b4a1cd0..67e30091709f 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="10.3"
-BRANCH="RELEASE-p23"
+BRANCH="RELEASE-p24"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 78eab87ca767..6a02f026aed0 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1196,7 +1196,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;
/*
@@ -1209,10 +1209,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