From patchwork Sat Aug 3 04:48:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 170466 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp1638946ile; Fri, 2 Aug 2019 21:49:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE5zaL5shMePOnUeCsLQHSyGIiEikF0ixGpUSHIuGWs3LKRdP4mpi4ACsxzxOEu8QEM2dX X-Received: by 2002:a65:584f:: with SMTP id s15mr110154776pgr.175.1564807741855; Fri, 02 Aug 2019 21:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564807741; cv=none; d=google.com; s=arc-20160816; b=VnmZXRK5kqnMaypdnobfYJFFUQ6el65bPTbYDnWTxyTVE+TWXBPJD31FZEocIqd5Dq SQtk7qF2vd/MAw+bBowHovKA+YEhDRdMLEee+gGuNstulwbXPXj1M0G6H59vB8d9mVdF wzxT023i/qJjJra3QB1ci204xojJ3kmrCRRqKFYgAOWMhoURFDEqlvV2rgW/S3z+4Kzt 3dtKUExHF/B+K1cuHocZpdLvCMCwtf0M/l8kzRsW22sQyKYfYECSVnhyCnGlzw9E8igH rbM17pBGbR9gP5/nFwoSQaTUW2obrgnOmcxGftXpYaI7y3kzPYMhaGISxVRBN6VzTJ1v hkDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:subject:to:from :date:dkim-signature; bh=pUsYa+oGyg4mhOPRI6wgMHlkllFvP59uqh987O/UzuY=; b=rh7XP9+wyA8vLdB783XddVAeHzpTsYVanVDhz5vNXdA1w8DYPlSIMh1fTuHnVGjWgt jW/TuOgKkYixb2N5do2MRxS5J1aH64X6/a3kzCIaeQMOzD84X297NFo+EuafySprCCWw Wc0tU4LnEiXmqtKICLO6JhKOVEwbUDLJKj2tTZoabVk2xsoF52Y0pbDbj6Kq6M6wUUGW 7Ihvk+2pQpRfFRxJQuGIfL6OIqDcWFabtqCfDposwNzug+3S5f8d+qEAGoYphj72To4L pMlUf4lbHlJ8V33RCi9uNbm1FHh21em2OTIt9qZ5xn+oHSTiZ1kZc0PU6CsmsX+vR/Be sf2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C13z1QJl; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y82si38601876pfb.58.2019.08.02.21.49.01; Fri, 02 Aug 2019 21:49:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=C13z1QJl; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726319AbfHCEtB (ORCPT + 14 others); Sat, 3 Aug 2019 00:49:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:35692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbfHCEtB (ORCPT ); Sat, 3 Aug 2019 00:49:01 -0400 Received: from X1 (unknown [76.191.170.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6FE121726; Sat, 3 Aug 2019 04:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564807739; bh=diRa3/aj/2YHdw0FL1osj2u7iLHlHNttrP4kSyOc6+g=; h=Date:From:To:Subject:From; b=C13z1QJlJh10Uak6x4ZCLJAm8gy3a+GOW0TJA/jg6fhaYxO1uK4ygPr65cockMzIK YSPfiYEiMiKd/whLJN/2pelKwbFH3R8fJVsDk4IXOgqr/0iPm+Nuva59bVTdx9L5QQ XkmziAGD08owOJYhazyt2Y9aD8adUnj34N9P1yCg= Date: Fri, 02 Aug 2019 21:48:58 -0700 From: akpm@linux-foundation.org To: willy@infradead.org, tglx@linutronix.de, stable@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, keescook@chromium.org, jpoimboe@redhat.com, dvyukov@google.com, bp@alien8.de, aryabinin@virtuozzo.com, ard.biesheuvel@linaro.org, andriy.shevchenko@linux.intel.com, arnd@arndb.de, akpm@linux-foundation.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 08/17] ubsan: build ubsan.c more conservatively Message-ID: <20190803044858.fw_-j%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann Subject: ubsan: build ubsan.c more conservatively objtool points out several conditions that it does not like, depending on the combination with other configuration options and compiler variants: stack protector: lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0xbf: call to __stack_chk_fail() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0xbe: call to __stack_chk_fail() with UACCESS enabled stackleak plugin: lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled kasan: lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x25: call to memcpy() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x25: call to memcpy() with UACCESS enabled The stackleak and kasan options just need to be disabled for this file as we do for other files already. For the stack protector, we already attempt to disable it, but this fails on clang because the check is mixed with the gcc specific -fno-conserve-stack option. According to Andrey Ryabinin, that option is not even needed, dropping it here fixes the stackprotector issue. Link: http://lkml.kernel.org/r/20190722125139.1335385-1-arnd@arndb.de Link: https://lore.kernel.org/lkml/20190617123109.667090-1-arnd@arndb.de/t/ Link: https://lore.kernel.org/lkml/20190722091050.2188664-1-arnd@arndb.de/t/ Fixes: d08965a27e84 ("x86/uaccess, ubsan: Fix UBSAN vs. SMAP") Signed-off-by: Arnd Bergmann Reviewed-by: Andrey Ryabinin Cc: Josh Poimboeuf Cc: Peter Zijlstra Cc: Arnd Bergmann Cc: Borislav Petkov Cc: Dmitry Vyukov Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Kees Cook Cc: Matthew Wilcox Cc: Ard Biesheuvel Cc: Andy Shevchenko Cc: Signed-off-by: Andrew Morton --- lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/lib/Makefile~ubsan-build-ubsanc-more-conservatively +++ a/lib/Makefile @@ -279,7 +279,8 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string obj-$(CONFIG_UBSAN) += ubsan.o UBSAN_SANITIZE_ubsan.o := n -CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +KASAN_SANITIZE_ubsan.o := n +CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN) obj-$(CONFIG_SBITMAP) += sbitmap.o