From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 7CC4FC433E2 for ; Mon, 14 Sep 2020 17:30:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C587A20735 for ; Mon, 14 Sep 2020 17:30:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aCFiyaNC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Ihcd/I42" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C587A20735 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8ztNaTEYZFXI/Lkxl8KUklAdXm7VIhhPOVJX8uib/Ug=; b=aCFiyaNCw7jiOHkcvcQrWJeAS BBrQctzQRmwqRqlKI/w386T9QLE+b1eHEFU1eaO9lji+7ezVSC8GulK1ZwxBEfjYNBMnzNdz4jpKS NDJa614J1ATcHOticLg07mpdoj/mxWNwOrPqvndQ9gbkCzL/gzUjm4hjzkomG2RcBDfnvqDpwGTWE /ymZK81eHHORroqmkIyc9h5SUWEe3V9oz30W1aONDiRHZ4ERLZJ4qmCdlwlCsBxBDU7ixFglMP6KO p35v49PtEClNbLFo7UDyVauTTaHgMDey4y6Qim7o6Th4WZPpXmqikB7PCFnmImMh/6MfwyEBqIYOC GJh+LP7zA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHsHm-0000rK-BL; Mon, 14 Sep 2020 17:29:02 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHsH1-0000aR-3h for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 17:28:16 +0000 Received: by mail-wm1-x342.google.com with SMTP id d4so794711wmd.5 for ; Mon, 14 Sep 2020 10:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ev8PHeG2wBS2zSKo7R1VQ4GKo6oUzjZvdtqCLwJ3pDs=; b=Ihcd/I42/8bqTmauvPs6wDsvnxOAZx+wYOevPiQvp+xJchPV5GVJkIShVJHhNU2FjO Zf1FpuxhmFlq6/3mUCs6IS98Ps2pku3dV/3fh5ECJ4gDZPm9+Ct13ppA30R3IhTtGzSd KyjRpOxXeBwr5vS+ttAyiOJy1txvnpeI7w+7wvzy7JfFhvY/m6Hyiw0ksxJxvBH1TKmw CpSNjsUVu0fP6g5CeuWF6cI5+zgTBD8gSJA/WEILjUZoiAXavXc7DnpojnXNHupGQsvG s7eZ41WyrXa0IMZ4lhH1LzLbNKcQgdbq0M8s5dYCdEOag6uxg2zPjBYciaEkq0N6363O Svhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ev8PHeG2wBS2zSKo7R1VQ4GKo6oUzjZvdtqCLwJ3pDs=; b=AYkuGDGNPSk6Mm4CSx/gpI4LetEDWX1zV1zEz0DNiXZnEQeFEEOoBLkD3nVG2bCGMQ HU1hy8JsMOKz+446ttzTedPTxDaGUUc3qPN4MaqNaWw581H9vTq1lmY5LyxtV2eUCarK CdIEkn0USl+M5TaIgJioI/BoEg6uRuvab6Rz+9a1gzAi/N43Ebw1Flg+BPFSZjiuTlQQ dEgw5I1wVwhQb+K8z4EW9sT6dZ0UZXXCeljBb54h9ilgy66fmhCgIiXr8r3pla7sxVCY mBcbrA32y6ZkW5tgqu7HWzQIq9BtjSELydgJ+4poF+MjtnZphaJ4VQQQji/sfI58CeGn j7RQ== X-Gm-Message-State: AOAM532PtqC7Mkk1KNkUfFgh9Q9BMaKn+gT2L2LarHy1na3kvR4rH4r9 EzQYFiC8mzzxJflAZfb/CxYXl8i1RqXrLQ== X-Google-Smtp-Source: ABdhPJwtapIR59wfa+PjunnI9DEEbaEmNaoIsHmxwFfZkq+7/rS32R8lqozJpnsFIN4Urr9dofZ6Kw== X-Received: by 2002:a1c:f619:: with SMTP id w25mr459880wmc.62.1600104493518; Mon, 14 Sep 2020 10:28:13 -0700 (PDT) Received: from localhost (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id s12sm13377783wmd.20.2020.09.14.10.28.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Sep 2020 10:28:12 -0700 (PDT) From: George-Aurelian Popescu To: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org, masahiroy@kernel.org, michal.lkml@markovi.net Subject: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Date: Mon, 14 Sep 2020 17:27:42 +0000 Message-Id: <20200914172750.852684-7-georgepope@google.com> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog In-Reply-To: <20200914172750.852684-1-georgepope@google.com> References: <20200914172750.852684-1-georgepope@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_132815_183300_F6F9A149 X-CRM114-Status: GOOD ( 13.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, elver@google.com, tglx@linutronix.de, keescook@chromium.org, maskray@google.com, linux-kbuild@vger.kernel.org, suzuki.poulose@arm.com, ndesaulniers@google.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, George Popescu , clang-built-linux@googlegroups.com, broonie@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, dvyukov@google.com, natechancellor@gmail.com, dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, ascull@google.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: George Popescu When the kernel is compiled with Clang, UBSAN_BOUNDS inserts a brk after the handler call, preventing it from printing any information processed inside the buffer. For Clang -fsanitize=bounds expands to -fsanitize=array-bounds and -fsanitize=local-bounds, and the latter adds a brk after the handler call Signed-off-by: George Popescu --- scripts/Makefile.ubsan | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index 27348029b2b8..3d15ac346c97 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan @@ -4,7 +4,14 @@ ifdef CONFIG_UBSAN_ALIGNMENT endif ifdef CONFIG_UBSAN_BOUNDS - CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) + # For Clang -fsanitize=bounds translates to -fsanitize=array-bounds and + # -fsanitize=local-bounds; the latter adds a brk right after the + # handler is called. + ifdef CONFIG_CC_IS_CLANG + CFLAGS_UBSAN += $(call cc-option, -fsanitize=array-bounds) + else + CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) + endif endif ifdef CONFIG_UBSAN_MISC -- 2.28.0.618.gf4bc123cb7-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel