lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 7 Jul 2018 10:04:02 -0700
From:   tip-bot for Jann Horn <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     andriy.shevchenko@...ux.intel.com, jannh@...gle.com,
        linux-kernel@...r.kernel.org, mingo@...nel.org, hpa@...or.com,
        tglx@...utronix.de
Subject: [tip:x86/urgent] x86/mtrr: Don't copy out-of-bounds data in
 mtrr_write

Commit-ID:  15279df6f26cf2013d713904b4a0c957ae8abb96
Gitweb:     https://git.kernel.org/tip/15279df6f26cf2013d713904b4a0c957ae8abb96
Author:     Jann Horn <jannh@...gle.com>
AuthorDate: Fri, 6 Jul 2018 23:50:03 +0200
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sat, 7 Jul 2018 18:58:41 +0200

x86/mtrr: Don't copy out-of-bounds data in mtrr_write

Don't access the provided buffer out of bounds - this can cause a kernel
out-of-bounds read when invoked through sys_splice() or other things that
use kernel_write()/__kernel_write().

Fixes: 7f8ec5a4f01a ("x86/mtrr: Convert to use strncpy_from_user() helper")
Signed-off-by: Jann Horn <jannh@...gle.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: stable@...r.kernel.org
Link: https://lkml.kernel.org/r/20180706215003.156702-1-jannh@google.com

---
 arch/x86/kernel/cpu/mtrr/if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index 4021d3859499..40eee6cc4124 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -106,7 +106,8 @@ mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t * ppos)
 
 	memset(line, 0, LINE_SIZE);
 
-	length = strncpy_from_user(line, buf, LINE_SIZE - 1);
+	len = min_t(size_t, len, LINE_SIZE - 1);
+	length = strncpy_from_user(line, buf, len);
 	if (length < 0)
 		return length;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ