Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2762626ybh; Mon, 5 Aug 2019 06:27:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9U0wlFqCK489IG2Lc5Waf6d8zYZ5Gr3doGvIRnJmXat41EWY7JhVIMMJDmK67vwAxe33T X-Received: by 2002:aa7:858b:: with SMTP id w11mr69968724pfn.68.1565011662257; Mon, 05 Aug 2019 06:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565011662; cv=none; d=google.com; s=arc-20160816; b=Cxx3OGbIN6Vg22S8QHp39acuWa+hPHs4hSiWOoOdZg/YB8RRmf/JnjlCkn68Bl1WQl vTTR80UrqVRnjRBW2VKqXy2dbMiBTPvjxC1AfmDxEZWU6Ec6rNq5/hPLZxI6SEMmUvmg s6AaKaX8wAF+15xgJi34OMiXvoKsTTEIuddWoHTkBA1j3edCwb7izY5BxRoKvRmkZevw D4psDd5Sf+lcSBnCdx5XgZJ+anwCuMh20T+/eh/u8qYr6Gvx1/sEgkttNQga6wZTerc1 LfaJz8xxjIwSvO33u+dbhAgM1p1qWO+dBCjRd6IWL9SNDf1Ili8qHi4Aao5OUaOBlK62 rOog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vb4chBgUHTvtJQ+Wcg0s6t0bW85VBo6vmvig217Jpu4=; b=UKZCXqHJSsSe5f+oIf8zixP4etZl5cdEEMrEZbgrNdlI5Dse/FX/G3qcbCGldOI6/1 fdSnkIrR6ShRdnTWQr32KxfhE5iuL54XeUwjJAE0NsUrza3VqnQPzu5n9ZjiHvjF3I5F JMWIXuNsWAAfI9oajyGoAtp0nZKvP0OFshx54miP6OElMrl9xDknqWa8I1/ULNz/o3S3 +2hLuz0UgSCr4e4gQhRzix1GbVsRzIP7O5bhEM1F/DDXKhmuvWJLKYN/4MhMASD15j5M 1rrj3n580S3GECJA2r1sBQ9V4Rbt/csWRCLjNoLiy/XcjDa8MOQoacPPh1PEB0UJmMhk a1XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tOMGCRdv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 c13si42839341pfr.36.2019.08.05.06.27.26; Mon, 05 Aug 2019 06:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=tOMGCRdv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731094AbfHEN02 (ORCPT + 99 others); Mon, 5 Aug 2019 09:26:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:34786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731412AbfHEN0N (ORCPT ); Mon, 5 Aug 2019 09:26:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3232620644; Mon, 5 Aug 2019 13:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565011572; bh=g/aiK7KHlJwpW7n5tGJSO+VFCcemY6f1VKZdH/9n0VQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tOMGCRdv8xYsmAPsJZdmk/DEHF//yMGrOLwKavtPMUad+ih6KAql+fM2j8RbCQysx yV/6pal4hKOi+i537aY61hqabHQ39Ta4/Vf7le5NRDdo2cJ2ssZskJgvr3U5ZWFlEw IQBFmrV4G4y7qL9GlP1E7n96drd7g5T+E+jmH/gE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Andrey Ryabinin , Josh Poimboeuf , Peter Zijlstra , Borislav Petkov , Dmitry Vyukov , Thomas Gleixner , Ingo Molnar , Kees Cook , Matthew Wilcox , Ard Biesheuvel , Andy Shevchenko , Andrew Morton , Linus Torvalds Subject: [PATCH 5.2 103/131] ubsan: build ubsan.c more conservatively Date: Mon, 5 Aug 2019 15:03:10 +0200 Message-Id: <20190805124958.858669410@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124951.453337465@linuxfoundation.org> References: <20190805124951.453337465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit af700eaed0564d5d3963a7a51cb0843629d7fe3d upstream. 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 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/lib/Makefile +++ b/lib/Makefile @@ -278,7 +278,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