From patchwork Mon Mar 5 11:18:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinbum Park X-Patchwork-Id: 10258723 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 4B08660134 for ; Mon, 5 Mar 2018 11:18:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39DCC2896B for ; Mon, 5 Mar 2018 11:18:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E3B128984; Mon, 5 Mar 2018 11:18:46 +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=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 627A62896B for ; Mon, 5 Mar 2018 11:18:45 +0000 (UTC) Received: (qmail 11934 invoked by uid 550); 5 Mar 2018 11:18:43 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 11895 invoked from network); 5 Mar 2018 11:18:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=VS5Cvod2yup69YZ8TkrWuwx4G0+ROdocQ7MzaK//5/M=; b=Mqnedi5d74w3vhGLwtVkaHVaPV/rizriFgnHONg7l1EItxWeXUxHF0TwGrqg7uqQA0 KWRMe2OrhxxBIiKwnh/rZbysLhht4Gi73NzQwhJVJY9OuDHqN64eBHWN2NQtImwJMwuU TYMUzl8v65LH00zlBCqBrzrFUu7VKPM1ZGuY0ta32k8hwcRl5RmX3UUNZv4/i+zMasSp pMV8A90aZVAzZnOZ8NVZyKNHm2Xum3JUaDKrFyXZKo4qFIK5disUhyUtakM1rUQoqg8m 7aTXgyHVeKCj6STcKu+kYQYdnXp1ztc2kuxTgrTSW2XjMToeT0s/K7IY0WLmFsJkot3u 1cSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=VS5Cvod2yup69YZ8TkrWuwx4G0+ROdocQ7MzaK//5/M=; b=OCvSZsKQ9TWC8zG0B4BScVdUNu9yFREFFG49c3LY3sU4c4L+GNuIVW1xLUdKP1QUuS QU91JOm+ZBthghQlZpxG9I+XH2DL7sHJnzuOoUyxYdhkSUDmYElzlQSxCVhXoEvKUWvF 6gd/zlerB3aNZNjSn0xd6n7Ldh+UpArJniKrDeJg6UO/D5sNukxqDXU+nshGSjBJ/M7Z VJ9QqE0sAt6wqCiaGUt1AHYqclDvKW5mwSHGJVPeRTu+moQq2Qv4sS+uMcxin4flDova Xn0rVx8nIsKeB5ZC7AcNfkmRWXrS/7kyZj6L2KtA772XOip7OG2x+yIrcGyJ+i45sP/r Z9UA== X-Gm-Message-State: APf1xPDK5Zy9sdBkWUaaHL9KUVPjKpl+8POsdAth1jj1+EpYEvHTMioa vmiYJSa+z0/E7Rw9RhbPIJQ= X-Google-Smtp-Source: AG47ELuyQJykPPp4OHWuZbYYO3hWXSmg4n1lenpFYYjGGa4cwOPMCxiUibVctIkA2rXzoc09FgJlbw== X-Received: by 10.99.179.77 with SMTP id x13mr11042502pgt.148.1520248711052; Mon, 05 Mar 2018 03:18:31 -0800 (PST) Date: Mon, 5 Mar 2018 20:18:24 +0900 From: Jinbum Park To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: gregkh@linuxfoundation.org, tglx@linutronix.de, kstewart@linuxfoundation.org, luto@amacapital.net, dsafonov@virtuozzo.com, keescook@chromium.org, will.deacon@arm.com, mark.rutland@arm.com, danielmicay@gmail.com, arnd@arndb.de, catalin.marinas@arm.com Subject: [PATCH v2 2/2] arm: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE Message-ID: <20180305111824.GA4216@pjb1027-Latitude-E5410> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: ClamAV using ClamSMTP CONFIG_FORTIFY_SOURCE detects various overflows at compile-time. (6974f0c4555e ("include/linux/string.h: add the option of fortified string.h functions) ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and run with CONFIG_FORTIFY_SOURCE. Since ARM can be built and run with that flag like other architectures, select ARCH_HAS_FORTIFY_SOURCE as default. Acked-by: Kees Cook Signed-off-by: Jinbum Park --- v2: Add fortify_panic() in arch/arm/boot/compressed/misc.c, Because there will be a build error if without that function. --- arch/arm/Kconfig | 1 + arch/arm/boot/compressed/misc.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7e3d535..3765336 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -7,6 +7,7 @@ config ARM select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_ELF_RANDOMIZE + select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_SET_MEMORY select ARCH_HAS_PHYS_TO_DMA select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index 16a8a80..4a247ac 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -167,3 +167,8 @@ void __stack_chk_fail(void) else putstr(" done, booting the kernel.\n"); } + +void fortify_panic(const char *name) +{ + error("detected buffer overflow"); +}