From patchwork Wed May 24 15:57:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rik van Riel X-Patchwork-Id: 9746307 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4DC1601C2 for ; Wed, 24 May 2017 15:58:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D470428985 for ; Wed, 24 May 2017 15:58:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6DA72236A; Wed, 24 May 2017 15:58:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B67612236A for ; Wed, 24 May 2017 15:58:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vBT9ZaqOGLaWaUNcVzPNC13Shd+Hy6/U9iKyiAN1jP4=; b=h6Hj3MkBYBC03nBJTs4LhXnVfv dJJRA8E8Jr/L1w/SRXcq1rZ4bivF+0dHtWG9fKoCFnUZUKitJzFmGZ2QyiwP3yLShoC0bo2MPsNDY wqNK+kSn6+Q5yoOoYTN+4RgvWvlpBQsvvaLq2jj0abxAYqwiEC61L1m3mz5aRIRuxhfxc/N2zRQYe MkOX0LY8GtAingLHd9wbWreuVq/mqPLkf6QOMI1HiYm14+ZHflJsmLP5Y5to+gj+GgacQkc0tnVqN qyF3IbpWdT+b0sAlmDfJcfeZohz8HQ7TrnX/336BH5wl04fC7nPDAHyz8P7j60QCeNYTZRGqvaTXV U6uGmmUg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dDYg8-0006R6-Sz; Wed, 24 May 2017 15:58:28 +0000 Received: from shelob.surriel.com ([96.67.55.147]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dDYg5-0006NJ-7R for linux-arm-kernel@lists.infradead.org; Wed, 24 May 2017 15:58:27 +0000 Received: from [2603:3005:d05:2b00:224:e8ff:fe38:995c] (helo=annuminas.surriel.com) by shelob.surriel.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1dDYfc-0004jw-QN; Wed, 24 May 2017 11:57:56 -0400 Received: from annuminas.surriel.com (localhost.localdomain [127.0.0.1]) by annuminas.surriel.com (8.15.2/8.14.5) with ESMTP id v4OFvukq000736; Wed, 24 May 2017 11:57:56 -0400 Received: (from riel@localhost) by annuminas.surriel.com (8.15.2/8.15.2/Submit) id v4OFvuDB000735; Wed, 24 May 2017 11:57:56 -0400 X-Authentication-Warning: annuminas.surriel.com: riel set sender to riel@redhat.com using -f From: riel@redhat.com To: linux-kernel@vger.kernel.org Subject: [PATCH 2/5] fork, random: use get_random_canary to set tsk->stack_canary Date: Wed, 24 May 2017 11:57:48 -0400 Message-Id: <20170524155751.424-3-riel@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170524155751.424-1-riel@redhat.com> References: <20170524155751.424-1-riel@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170524_085825_385716_CA465284 X-CRM114-Status: UNSURE ( 8.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tytso@mit.edu, keescook@chromium.org, ysato@users.sourceforge.jp, linux-sh@vger.kernel.org, catalin.marinas@arm.com, x86@kernel.org, luto@amacapital.net, danielmicay@gmail.com, hpa@zytor.com, kernel-hardening@lists.openwall.com, mingo@kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rik van Riel 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 Daniel Micay's linux-hardened tree. Signed-off-by: Rik van Riel Acked-by: Kees Cook --- 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 /*