From patchwork Fri May 19 21:26:33 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: 9738219 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 E93B4601C2 for ; Fri, 19 May 2017 21:35:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEFCB27FBA for ; Fri, 19 May 2017 21:35:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3A9C28535; Fri, 19 May 2017 21:35:37 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7492E27FBA for ; Fri, 19 May 2017 21:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756315AbdESVfG (ORCPT ); Fri, 19 May 2017 17:35:06 -0400 Received: from shelob.surriel.com ([96.67.55.147]:35581 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756175AbdESVfF (ORCPT ); Fri, 19 May 2017 17:35:05 -0400 Received: from [2001:470:1f07:12aa:224:e8ff:fe38:995c] (helo=annuminas.surriel.com) by shelob.surriel.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1dBpQ0-00048x-SJ; Fri, 19 May 2017 17:26:40 -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 v4JLQevt000754; Fri, 19 May 2017 17:26:40 -0400 Received: (from riel@localhost) by annuminas.surriel.com (8.15.2/8.15.2/Submit) id v4JLQeeN000753; Fri, 19 May 2017 17:26:40 -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 Cc: danielmicay@gmail.com, tytso@mit.edu, keescook@chromium.org, hpa@zytor.com, luto@amacapital.net, mingo@kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, linux-sh@vger.kernel.org, ysato@users.sourceforge.jp Subject: [PATCH 2/5] fork, random: use get_random_canary to set tsk->stack_canary Date: Fri, 19 May 2017 17:26:33 -0400 Message-Id: <20170519212636.30440-3-riel@redhat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170519212636.30440-1-riel@redhat.com> References: <20170519212636.30440-1-riel@redhat.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.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 PaX/grsecurity. Signed-off-by: Rik van Riel --- 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 /*