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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 37882C43461 for ; Mon, 14 Sep 2020 22:15:14 +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 C1984208DB for ; Mon, 14 Sep 2020 22:15:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tpizS8iD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FLfu5qkp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1984208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YL30otSH0CI1LPcriLxFnM7doAHDPrQLx27wmMtTRhg=; b=tpizS8iD1STRRxFy+/frnM9eq Jg//m8X2Ohzq8oDCk64aOQBdsgLSSBxs3qo70bFIPG9kyo3yfubaoMG7pPSQYOeAEgCcMtwZPFanr KlbHiZ4JapWsXTGctXbhQ4DSDRGaHmkyvhuMX7LFaChw1Nw8zz0U+LqQTIjF5iS9nBKDKnsrFNezZ QBelPbrmM7uabnHNec7P1WoFtFqyDLnvmMp7H41NCFeLA7YVxxPe9lIu+nP7HXOzXNSFawNXwNy2n Qlf11jD7IHzyKgeOf4kuUjpx04HrCUinQLgJYqOi0iiGIXgOynQpJ7xt+wdl5qw0DogJv2AWvSENJ 7KmX4Y47g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHwj0-0000mQ-3z; Mon, 14 Sep 2020 22:13:26 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHwis-0000kk-Ey for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2020 22:13:21 +0000 Received: by mail-pj1-x1042.google.com with SMTP id b17so661857pji.1 for ; Mon, 14 Sep 2020 15:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=XKHeWnZTmr+44PA1uk+tmIoZZMZNVyaEbUZsmkorfxM=; b=FLfu5qkpDm7o5/xP0ilZmNxVe+jdmcJEkTL/4DGLQ5xUBs9smNtW0pRVX074Wodffb QUGa2sH5fudwFrwS49G9uXA9hzulhM+YqeS3JvomF2XSTDvvz161Ko8MHkn/a5Vkn26o 2wUHbRjJ9JT+dslYXV4aBJuwNU5aQBs5Tz/Pg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XKHeWnZTmr+44PA1uk+tmIoZZMZNVyaEbUZsmkorfxM=; b=RYS1pgjE5NJlIzu2hC6EgDA+MXakgWK7bJmjvW+cfbavgvt+UbI5Xua752Mj8tYSJO pnx3VtR58WOG2mWJuXxw6yjdN7RcVm10PFjuDVKBfwr9C2x/MISzAgn9WJnDStyQnwtW 2R1ihyn280gQ6BqoP/loI6mh5EOA7yDRMq1UixedFknQ9iOzV2h1vgPKFUe1DM6oeaG9 1vqRAjv5CpS7Lwo5bgKiLXq7jZvF5cFE8aPMEy3bNCb1/ts8QpVM3+IUjByyB7hSGyfP wjYtKQHQCljQyMVQiRSFs2q6DW0YzDOrZZQW76nV6thq2KUH5GAvTdtQ42bkn8nMmbEy /Z6A== X-Gm-Message-State: AOAM5302xOa07293Z+jmjpkcvVOzYGHZYev6Jc+ThT9FNW75weIkyz55 6/wD8lBxgiI4vHYonBoKid9rug== X-Google-Smtp-Source: ABdhPJyn8NpGqIRjrEpOsVjRNLYYQTqkknDqHNXZZiqb/DFr4jKhXnJkQxxoYZIMjCxQkiwbcgTD4Q== X-Received: by 2002:a17:90b:3505:: with SMTP id ls5mr1284670pjb.105.1600121596214; Mon, 14 Sep 2020 15:13:16 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i187sm9130990pgd.82.2020.09.14.15.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 15:13:15 -0700 (PDT) Date: Mon, 14 Sep 2020 15:13:14 -0700 From: Kees Cook To: George-Aurelian Popescu Subject: Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Message-ID: <202009141509.CDDC8C8@keescook> References: <20200914172750.852684-1-georgepope@google.com> <20200914172750.852684-7-georgepope@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200914172750.852684-7-georgepope@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200914_181320_498616_8601CD6F X-CRM114-Status: GOOD ( 19.59 ) 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: tglx@linutronix.de, catalin.marinas@arm.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, maskray@google.com, maz@kernel.org, masahiroy@kernel.org, suzuki.poulose@arm.com, clang-built-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, dbrazdil@google.com, julien.thierry.kdev@gmail.com, elver@google.com, arnd@arndb.de, linux-kbuild@vger.kernel.org, broonie@kernel.org, ascull@google.com, natechancellor@gmail.com, dvyukov@google.com, michal.lkml@markovi.net, ndesaulniers@google.com, linux-kernel@vger.kernel.org, james.morse@arm.com, akpm@linux-foundation.org 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 On Mon, Sep 14, 2020 at 05:27:42PM +0000, George-Aurelian Popescu wrote: > 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 That sounds like a compiler bug? > 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) This would mean losing the local-bounds coverage? Isn't that for locally defined arrays on the stack? > + else > + CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > + endif > endif > > ifdef CONFIG_UBSAN_MISC > -- > 2.28.0.618.gf4bc123cb7-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel