linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: riel@redhat.com
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] fork,random: use get_random_canary to set tsk->stack_canary
Date: Fri, 19 May 2017 21:26:33 +0000	[thread overview]
Message-ID: <20170519212636.30440-3-riel@redhat.com> (raw)
In-Reply-To: <20170519212636.30440-1-riel@redhat.com>

From: Rik van Riel <riel@redhat.com>

Use the ascii-armor canary to prevent unterminated C string overflows
from being able to successfully overwrite the canary, even if they
somehow obtain the canary value.

Inspired by execshield ascii-armor and PaX/grsecurity.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index aa1076c5e4a9..b3591e9250a8 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -560,7 +560,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
 	set_task_stack_end_magic(tsk);
 
 #ifdef CONFIG_CC_STACKPROTECTOR
-	tsk->stack_canary = get_random_long();
+	tsk->stack_canary = get_random_canary();
 #endif
 
 	/*
-- 
2.9.3


  parent reply	other threads:[~2017-05-19 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 21:26 stackprotector: ascii armor the stack canary riel
2017-05-19 21:26 ` [PATCH 1/5] random,stackprotect: introduce get_random_canary function riel
2017-05-24  8:30   ` Ingo Molnar
2017-05-19 21:26 ` riel [this message]
2017-05-19 21:26 ` [PATCH 3/5] x86: ascii armor the x86_64 boot init stack canary riel
2017-05-19 21:26 ` [PATCH 4/5] arm64: ascii armor the arm64 " riel
2017-05-19 21:26 ` [PATCH 5/5] sh64: ascii armor the sh64 " riel
2017-05-19 21:32 ` stackprotector: ascii armor the " Kees Cook
2017-05-24 11:57   ` Geert Uytterhoeven
2017-05-19 23:57 ` Daniel Micay
  -- strict thread matches above, loose matches on Subject: below --
2017-05-24 15:57 [PATCH v2 0/5] " riel
2017-05-24 15:57 ` [PATCH 2/5] fork,random: use get_random_canary to set tsk->stack_canary riel
2017-05-24 16:16   ` Kees Cook

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=20170519212636.30440-3-riel@redhat.com \
    --to=riel@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.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).