From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756932Ab0ANXKR (ORCPT ); Thu, 14 Jan 2010 18:10:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756742Ab0ANXKI (ORCPT ); Thu, 14 Jan 2010 18:10:08 -0500 Received: from kroah.org ([198.145.64.141]:41902 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754554Ab0ANXKH (ORCPT ); Thu, 14 Jan 2010 18:10:07 -0500 X-Mailbox-Line: From gregkh@mini.kroah.org Thu Jan 14 15:06:20 2010 Message-Id: <20100114230620.830938718@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Thu, 14 Jan 2010 15:04:49 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Andi Kleen , Ingo Molnar , Oleg Nesterov Subject: [1/6] kernel/signal.c: fix kernel information leak with print-fatal-signals=1 In-Reply-To: <20100114230640.GA7259@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2.6.27-stable review patch. If anyone has any objections, please let us know. ------------------ From: Andi Kleen commit b45c6e76bc2c72f6426c14bed64fdcbc9bf37cb0 upstream. When print-fatal-signals is enabled it's possible to dump any memory reachable by the kernel to the log by simply jumping to that address from user space. Or crash the system if there's some hardware with read side effects. The fatal signals handler will dump 16 bytes at the execution address, which is fully controlled by ring 3. In addition when something jumps to a unmapped address there will be up to 16 additional useless page faults, which might be potentially slow (and at least is not very efficient) Fortunately this option is off by default and only there on i386. But fix it by checking for kernel addresses and also stopping when there's a page fault. Signed-off-by: Andi Kleen Cc: Ingo Molnar Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/signal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -884,7 +884,8 @@ static void print_fatal_signal(struct pt for (i = 0; i < 16; i++) { unsigned char insn; - __get_user(insn, (unsigned char *)(regs->ip + i)); + if (get_user(insn, (unsigned char *)(regs->ip + i))) + break; printk("%02x ", insn); } }