From patchwork Wed Dec 16 04:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11976553 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 445DFC4361B for ; Wed, 16 Dec 2020 04:46:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EE4262311F for ; Wed, 16 Dec 2020 04:46:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE4262311F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 912186B00AB; Tue, 15 Dec 2020 23:46:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89B688D0015; Tue, 15 Dec 2020 23:46:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78AE36B00AD; Tue, 15 Dec 2020 23:46:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 616A36B00AB for ; Tue, 15 Dec 2020 23:46:38 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 362A7362D for ; Wed, 16 Dec 2020 04:46:38 +0000 (UTC) X-FDA: 77597909676.20.birds40_410aa4527429 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 17CED180C07A3 for ; Wed, 16 Dec 2020 04:46:38 +0000 (UTC) X-HE-Tag: birds40_410aa4527429 X-Filterd-Recvd-Size: 3993 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 04:46:37 +0000 (UTC) Date: Tue, 15 Dec 2020 20:46:35 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1608093996; bh=2E+0LcrreVdGOOMrdISTzy+ry0zzma2SvwkS4V6P22c=; h=From:To:Subject:In-Reply-To:From; b=BiU4e1GPSCBKAQWrbmCXPeIW7Mir8dpld4hzGGbn4mc0plNBjKpeKLkN16agWqyW5 e3xAdst6U+hFL3hDI7JB+2SFa+WP1aMN6y/Xg/ekBe9Hj0PKnyEdga7jbIjQsq3ae+ Pp4vE9xjlRk+86GQ9JDe0zXanj4dKdi1qRqyCQQk= From: Andrew Morton To: akpm@linux-foundation.org, ardb@kernel.org, arnd@arndb.de, aryabinin@virtuozzo.com, dvyukov@google.com, elver@google.com, georgepope@android.com, herbert@gondor.apana.org.au, keescook@chromium.org, linux-mm@kvack.org, masahiroy@kernel.org, michal.lkml@markovi.net, mm-commits@vger.kernel.org, natechancellor@gmail.com, ndesaulniers@google.com, oberpar@linux.ibm.com, rdunlap@infradead.org, sfr@canb.auug.org.au, torvalds@linux-foundation.org Subject: [patch 78/95] ubsan: enable for all*config builds Message-ID: <20201216044635.ftPKbagAO%akpm@linux-foundation.org> In-Reply-To: <20201215204156.f05ec694b907845bcfab5c44@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Kees Cook Subject: ubsan: enable for all*config builds With UBSAN_OBJECT_SIZE disabled for GCC, only UBSAN_ALIGNMENT remained a noisy UBSAN option. Disable it for COMPILE_TEST so the rest of UBSAN can be used for full all*config builds or other large combinations. [sfr@canb.auug.org.au: add .data..Lubsan_data*/.data..Lubsan_type* sections explicitly] Link: https://lkml.kernel.org/r/20201208230157.42c42789@canb.auug.org.au Link: https://lore.kernel.org/lkml/CAHk-=wgXW=YLxGN0QVpp-1w5GDd2pf1W-FqY15poKzoVfik2qA@mail.gmail.com/ Link: https://lkml.kernel.org/r/20201203004437.389959-6-keescook@chromium.org Signed-off-by: Kees Cook Signed-off-by: Stephen Rothwell Cc: Andrey Ryabinin Cc: Ard Biesheuvel Cc: Arnd Bergmann Cc: Dmitry Vyukov Cc: George Popescu Cc: Herbert Xu Cc: Linus Torvalds Cc: Marco Elver Cc: Masahiro Yamada Cc: Michal Marek Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Peter Oberparleiter Cc: Randy Dunlap Signed-off-by: Andrew Morton --- arch/powerpc/kernel/vmlinux.lds.S | 4 ++++ lib/Kconfig.ubsan | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/vmlinux.lds.S~ubsan-enable-for-allconfig-builds +++ a/arch/powerpc/kernel/vmlinux.lds.S @@ -313,6 +313,10 @@ SECTIONS #else .data : AT(ADDR(.data) - LOAD_OFFSET) { DATA_DATA +#ifdef CONFIG_UBSAN + *(.data..Lubsan_data*) + *(.data..Lubsan_type*) +#endif *(.data.rel*) *(.toc1) *(.branch_lt) --- a/lib/Kconfig.ubsan~ubsan-enable-for-allconfig-builds +++ a/lib/Kconfig.ubsan @@ -130,7 +130,6 @@ config UBSAN_ENUM config UBSAN_SANITIZE_ALL bool "Enable instrumentation for the entire kernel" depends on ARCH_HAS_UBSAN_SANITIZE_ALL - depends on !COMPILE_TEST default y help This option activates instrumentation for the entire kernel. @@ -142,7 +141,7 @@ config UBSAN_SANITIZE_ALL config UBSAN_ALIGNMENT bool "Enable checks for pointers alignment" default !HAVE_EFFICIENT_UNALIGNED_ACCESS - depends on !UBSAN_TRAP + depends on !UBSAN_TRAP && !COMPILE_TEST depends on $(cc-option,-fsanitize=alignment) help This option enables the check of unaligned memory accesses.