linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: akpm@osdl.org, linux-kernel@vger.kernel.org, mingo@elte.hu
Cc: stable@kernel.org
Subject: [PATCH] Fix kernel information leak with print-fatal-signals=1
Date: Fri, 25 Dec 2009 21:29:56 +0100	[thread overview]
Message-ID: <20091225202956.GA23141@basil.fritz.box> (raw)

Fix kernel information leak with print-fatal-signals=1

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.

Stable candidate.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 kernel/signal.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6.33-rc1-ak/kernel/signal.c
===================================================================
--- linux-2.6.33-rc1-ak.orig/kernel/signal.c
+++ linux-2.6.33-rc1-ak/kernel/signal.c
@@ -979,7 +979,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);
 		}
 	}

                 reply	other threads:[~2009-12-25 20:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091225202956.GA23141@basil.fritz.box \
    --to=andi@firstfloor.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).