Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2336603pxk; Mon, 14 Sep 2020 10:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXMgn+fNOTBcnWMX9kYVZL6o5xjcyXM4Iha32+xYVKl30F60GRbmYHjPstCiRYh4BCk+8d X-Received: by 2002:a50:b046:: with SMTP id i64mr19175091edd.9.1600104772685; Mon, 14 Sep 2020 10:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600104772; cv=none; d=google.com; s=arc-20160816; b=CKRqLsN3T6dOFNrf4n3Apbi2zmIGfqUv7iNrbneFMHGehgI6+ovVW6IVU5zg3fpvc5 SVi8ImGFXPXdYKLZyybKHXxOaWnic3h/nOCjZBr4f4OzYR0DKYGxnpMiwaglhix6L91z DX8WCzTQotx+QvPR9hSunVmjD99olVQ92ctTQQnFbX3MKlw8PLtKzJkxElAeIzt7YV98 80zyi+UPPoRPJ59FRRYupaxmjnYd1RXDB5ZhByjUDsvSzRMA8esnLwyAiYBujbV/C/Bw DEQNakw5QiF7wlddTsnTDbf48lxFnw0WQoQsymNb+eYU0gZa2y8vbRAD0lvbqBPc914k OGoQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ev8PHeG2wBS2zSKo7R1VQ4GKo6oUzjZvdtqCLwJ3pDs=; b=JksXQmVNRc3ecPi8hLIcAEAZyX4wrowI9UPn8ctO0PRmHM/H+xZwRp8tVSK8e/ZV2K FQ13LJKvP7UHUADNcaSb+LqkV8YjfoI5ofpVnz/dYRrFHaAvkh5HRXxq4Oz9QulQ0Drl QEoppAeb9KkRBIROK9Hff16lbfxDPxkL+N3kvvFIhpi84I3uj6yM1JqOZvOfaio0wf9M IdfqcrxIVF+inZW6BB6s+W2QiR3nbIaEO3CaQe0EXxV3R1J1+KFgwuwu1Vp2nHOWeodu ygbDypoao+PdYVQmG5yn4gV88y6kTR1Ne83n9cvFibItBnbzZFK7CKOyUtqOUZkUd6GD BsZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ihcd/I42"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r22si7720862edv.388.2020.09.14.10.32.29; Mon, 14 Sep 2020 10:32:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ihcd/I42"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726244AbgINR3i (ORCPT + 99 others); Mon, 14 Sep 2020 13:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbgINR2Y (ORCPT ); Mon, 14 Sep 2020 13:28:24 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0252EC061356 for ; Mon, 14 Sep 2020 10:28:15 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id k18so840080wmj.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=S1b50g0UOFKENUUC2dNwlfprLjOWS4sB+iDPoBxJgY7doSs9ZuV6crABIcLE/ey6hS dNUybwB64Sablo345Sejr+wPgpxCaf/eGHJDjJa0Teu+orKaKDPEmw6paxjD2JKHXC8q EfyzpKR2C2Pmd2xZ0iE7zPibAnOY8VX3gD3nB+eENPpOn3U3nS7ir2/EXL5/Vfn0R64M d0TiWMvNOlF0pLejhbdk3DmaHGwUpGX/P4p1xP+YpknQ2K6nSZYTFGSxNVmPfBwShBv6 szLQ9roRNhMZodZc/KI0i1tBgKETHDSFXkm9v5SWBWc+nhWkYJ1fMm/NWXEfIlhlpFcJ aY1Q== X-Gm-Message-State: AOAM532RKGwRmdkEt89bCradx1637hU614GLcpwQLbkg1GjqJ89RBfLV W1eXkCqmkXnYMv7ZNpz6SXdyRw== 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 Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, natechancellor@gmail.com, ndesaulniers@google.com, dbrazdil@google.com, broonie@kernel.org, maskray@google.com, ascull@google.com, keescook@chromium.org, akpm@linux-foundation.org, dvyukov@google.com, elver@google.com, tglx@linutronix.de, arnd@arndb.de, George Popescu 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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