From patchwork Fri Jan 5 09:02:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinbum Park X-Patchwork-Id: 10146107 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 40663601A1 for ; Fri, 5 Jan 2018 09:02:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ABAD2882E for ; Fri, 5 Jan 2018 09:02:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F925288B4; Fri, 5 Jan 2018 09:02:36 +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 62EC82882E for ; Fri, 5 Jan 2018 09:02:34 +0000 (UTC) Received: (qmail 9354 invoked by uid 550); 5 Jan 2018 09:02:32 -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 9307 invoked from network); 5 Jan 2018 09:02:30 -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=obvT5bC8DmCk2YkO96SFqKzBWwXyfSgiCRt/+ST2dNM=; b=qhEPpnTeblW56T3oPx6lA4YjYO7VnOzrCsMZ49aAqkKbSKOUB3FLTq/h+1CD/oBigG tkFeeRXqfBqQ+UHID7INKSV5zsPD5/vKdczjoh8YClR+4pG0xmVVrurJQ21uPpQtZNJx PasxKP8V3AyPOTIqgJLzTkS0hbST6VDBSczezyfWgi5FcF9YXl2rQaWI/T4wxGszZsb8 bzihBL9A85hoIQkIThaewdQ7SezyW7mTMp/1o1CngLR08v7x4kkaut2nc/Lgsi8cdzNI EQEw+Sv5aAyxwIHY+2b0Sf6KQWVSBSpZp08twL6D5x0EBo3fm1GIhCX4LpQvjjCIc9k+ +2og== 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=obvT5bC8DmCk2YkO96SFqKzBWwXyfSgiCRt/+ST2dNM=; b=MCa9Badogcw8imr3iW9kh+Qepbf2Mcpjkqf8xlPFBOGo/EMIQEbw1xl2t1OqAO81Zk 3a1iaaQEJON/bkS/Dox+lxmHW5vV4y8iTHBhfqins9Dup4bRi60tb/n18pvPVfWnGkSV eYe4kR404N2Exc2SIsolaju3xaYSlN3h9hhe52xiMaJUTJ4OoMjdVEuQx82IsXWLxJBF XBzL8inyAzWF2kHQwL4K7+fo7TG8tr2B21NErzSjrKfRUsT0saTln9EUDcywYCwhPaF8 zOSBjap+7/XgY+y5RNBFc0y893zUTSwbRn7mbzMQxgY9p8qS14P7MARIKZUmuCAe49qF o4sQ== X-Gm-Message-State: AKGB3mI9yHoiuydj1w1pVY+hWpFXOCeWmSxQhVHzTltBAbfJmdI8TKFW qXrEOhx2ZEyLGgtwftGH0TA= X-Google-Smtp-Source: ACJfBots80RxIqcdwLWZdFu53Xuwp+MQfNqhJ3ox+/sljA7ZwwFAjXIt1CzWqVU0UgozwGh4j+N0TQ== X-Received: by 10.98.67.151 with SMTP id l23mr2311156pfi.194.1515142938770; Fri, 05 Jan 2018 01:02:18 -0800 (PST) Date: Fri, 5 Jan 2018 18:02:12 +0900 From: Jinbum Park To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: keescook@chromium.org, ard.biesheuvel@linaro.org, Dave.Martin@arm.com, will.deacon@arm.com Message-ID: <20180105090212.GA4026@pjb1027-Latitude-E5410> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [kernel-hardening] [PATCH v2] arm: Always use REFCOUNT_FULL X-Virus-Scanned: ClamAV using ClamSMTP refcount_t overflow detection is implemented as two way. 1. REFCOUNT_FULL - It means the full refcount_t implementation which has validation but is slightly slower. - (fd25d19f6b8d ("locking/refcount: Create unchecked atomic_t implementation")) 2. ARCH_HAS_REFCOUNT - refcount_t overflow detection can be optimized via an arch-dependent way. - It is based on atomic_t infrastructure with some instruction added for detection. - It is faster than REFCOUNT_FULL, as fast as unprotected atomic_t infrastructure. - (7a46ec0e2f48 ("locking/refcounts, x86/asm: Implement fast refcount overflow protection")) ARCH_HAS_REFCOUNT has implemented for x86, not implemented for others. In the case of arm64, Will Deacon said he didn't want the specialized "fast but technically incomplete" refcounting as seen with x86's. But rather to set REFCOUNT_FULL by default because no one could point to real-world performance impacts with REFCOUNT_FULL vs unprotected atomic_t infrastructure. This is the reason arm64 ended up enabling REFCOUNT_FULL. (4adcec1164de ("arm64: Always use REFCOUNT_FULL")) As with the decision of arm64, arm can set REFCOUNT_FULL by default. Signed-off-by: Jinbum Park --- v2: Write a better commit message --- arch/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 64713b6..e111a62 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -101,6 +101,7 @@ config ARM select OLD_SIGACTION select OLD_SIGSUSPEND3 select PERF_USE_VMALLOC + select REFCOUNT_FULL select RTC_LIB select SYS_SUPPORTS_APM_EMULATION # Above selects are sorted alphabetically; please add new ones