mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, ak@suse.de
Subject: [patch 4/5] -fstack-protector feature: Add the __stack_chk_fail() function
Date: Wed, 16 Aug 2006 18:52:23 +0200	[thread overview]
Message-ID: <1155747144.3023.71.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1155746902.3023.63.camel@laptopd505.fenrus.org>

Subject: [patch 4/5] Add the __stack_chk_fail() function

GCC emits a call to a __stack_chk_fail() function when the stack canary is
not matching the expected value.

Since this is a bad security issue; lets panic the kernel rather than limping
along; the kernel really can't be trusted anymore when this happens.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
CC: Andi Kleen <ak@suse.de>

---
 kernel/panic.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: linux-2.6.18-rc4-stackprot/kernel/panic.c
===================================================================
--- linux-2.6.18-rc4-stackprot.orig/kernel/panic.c
+++ linux-2.6.18-rc4-stackprot/kernel/panic.c
@@ -269,3 +269,15 @@ void oops_exit(void)
 {
 	do_oops_enter_exit();
 }
+
+#ifdef CONFIG_CC_STACKPROTECTOR
+/*
+ * Called when gcc's -fstack-protector feature is used, and
+ * gcc detects corruption of the on-stack canary value
+ */
+void __stack_chk_fail(void)
+{
+	panic("stack-protector: Kernel stack is corrupted");
+}
+EXPORT_SYMBOL(__stack_chk_fail);
+#endif


  parent reply	other threads:[~2006-08-16 17:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-16 16:48 [patch 0/5] -fstack-protector feature for the kernel (try 2) Arjan van de Ven
2006-08-16 16:49 ` [patch 1/5] -fstack-protector feature: annotate the PDA offsets Arjan van de Ven
2006-08-16 16:50 ` [patch 2/5] -fstack-protector feature: Add the Kconfig option Arjan van de Ven
2006-08-16 18:12   ` Adrian Bunk
2006-08-18 11:08   ` Andi Kleen
2006-08-18 11:23     ` Arjan van de Ven
2006-08-18 14:05       ` Andi Kleen
2006-08-18 13:10         ` Arjan van de Ven
2006-08-18 13:30           ` Arjan van de Ven
2006-08-18 17:21         ` Sam Ravnborg
2006-08-16 16:51 ` [patch 3/5] -fstack-protector feature: Add the canary field to the PDA area Arjan van de Ven
2006-08-16 16:52 ` Arjan van de Ven [this message]
2006-08-16 16:53 ` [patch 5/5] -fstack-protector feature: Enable the compiler flags in CFLAGS Arjan van de Ven
2006-08-16 18:55   ` Sam Ravnborg
2006-08-16 19:24     ` Arjan van de Ven
2006-08-18 11:15 ` [patch 0/5] -fstack-protector feature for the kernel (try 2) Andi Kleen
2006-08-18 11:29   ` Arjan van de Ven

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=1155747144.3023.71.camel@laptopd505.fenrus.org \
    --to=arjan@linux.intel.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®