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=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 497A7C43463 for ; Thu, 17 Sep 2020 22:23:22 +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 EE02220874 for ; Thu, 17 Sep 2020 22:23:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QygbFweq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ciFNzf+h" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE02220874 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=MFaKwyQ6PH17sDl88ZUcwWOvN3lGWFthEnSTROxAeks=; b=QygbFweq1sJ3VvltWYxx7jeBd CfaeHjw3KOn7DKCrReEL2ZlQM1F2gjsIA43jfyLugNUUzBTPn4xYzXsrShAOvvTF0yuIHwCwpyfAC wj2cdD2BPpOzkoAuJsLuQmtuO9wcjvqSEBEHKjLZNXY1pE5e+ZDLVPPdJ1RKgVyO0ZpiCjlBRVp3w /RS6/HFKjR6JJA581Yzz5XCWEqvsuMcwocjzW6VAWbM9WGYnb3zkmyhMbKNkVdOqTxyBkAwqsI04D D/PCXGjx4z/SjG9RtMM8AkdJxca4fGr9QmVFl7jafgpcf32clr78oXryibacm7VRIKVKAQT4hFx7C 3AaM+rz2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJ2Hr-0003WT-0Q; Thu, 17 Sep 2020 22:21:55 +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 1kJ2Hn-0003VG-Fj for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 22:21:52 +0000 Received: by mail-pj1-x1042.google.com with SMTP id b17so1932216pji.1 for ; Thu, 17 Sep 2020 15:21:51 -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=9DPIpM4LW2/8oZNQwQFTEuyuoQvJ/tNgC5mR+LCoUuA=; b=ciFNzf+hWaaGAKU6nkGzF1KKLKx3MJ70q8Ni0LPweKihXGvpq6moFu4zD/nw+2Lsu2 hG7z5Vbe2Fr+pZbcXaXgeQOOcwOSHXdKYdGRyAb3lYBBjHrdV/XrZmxlXYGyh8CQWs4j ANuu2VhQPJzyzwyw6dJ3li/I9SmdUgDjG3jzY= 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=9DPIpM4LW2/8oZNQwQFTEuyuoQvJ/tNgC5mR+LCoUuA=; b=r2aU6Pfj/muznkRxueglZvoFJyF6GN8rQpEzOM2i+4RiNNpQtmTtH1EZjVkFRYj8AV 3m5gE4QV16LEUGu3TWeqSMRkbCvudo8T1RDflY9Dakt1d03zEkmtIF01a/t32qkxviDJ jswzq9+xla55r0rVN02TPoAC2T1yUPQJAURXykLbB9ssdxKV6WF3DyPDv8hzhYM6Iju6 iJANUyyxM0qn7NfTUNlucz3KerPTqdAqqxI3nLIUDMQG/zD4Z5Ftw5z8tHLMZtVvxBOT Z21ZUDKMNTb+eg9reZOdL5jSRK0icl3BQNUw9enjuJUClUZE+y/1F3PKC7h0AkoQNQkN zuNA== X-Gm-Message-State: AOAM530O9ciXMIbeFqlHq12vW8AINr0aXhurdEqNmfii52KuI3eWsypy QwXjmebL5TGGI65oLNr2nDnTaw== X-Google-Smtp-Source: ABdhPJwbTUDkLG7CpK2l4q0THRgaxSIQsaFQZa0MeaaJn7k/XwhUlLp3dEUsHAcW8oF24GhOQ/5eBg== X-Received: by 2002:a17:902:c212:b029:d1:e629:92f4 with SMTP id 18-20020a170902c212b02900d1e62992f4mr12676668pll.75.1600381309149; Thu, 17 Sep 2020 15:21:49 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m5sm627685pjn.19.2020.09.17.15.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 15:21:48 -0700 (PDT) Date: Thu, 17 Sep 2020 15:21:47 -0700 From: Kees Cook To: George Popescu Subject: Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Message-ID: <202009171519.951D26DB@keescook> References: <20200915102458.GA1650630@google.com> <20200915120105.GA2294884@google.com> <20200916074027.GA2946587@google.com> <20200916121401.GA3362356@google.com> <20200916134029.GA1146904@elver.google.com> <20200917113540.GA1742660@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200917113540.GA1742660@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_182151_534044_471D601C X-CRM114-Status: GOOD ( 27.01 ) 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: Thomas Gleixner , Catalin Marinas , Alexander Potapenko , Will Deacon , kvmarm@lists.cs.columbia.edu, Fangrui Song , maz@kernel.org, Masahiro Yamada , suzuki.poulose@arm.com, kasan-dev , clang-built-linux , Linux ARM , David Brazdil , julien.thierry.kdev@gmail.com, Marco Elver , Arnd Bergmann , Linux Kbuild mailing list , Andrey Konovalov , broonie@kernel.org, Andrew Scull , Nathan Chancellor , Dmitry Vyukov , Michal Marek , Nick Desaulniers , LKML , james.morse@arm.com, Andrew Morton 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 Thu, Sep 17, 2020 at 11:35:40AM +0000, George Popescu wrote: > On Thu, Sep 17, 2020 at 08:37:07AM +0200, Marco Elver wrote: > > So, it seems that local-bounds can still catch some rare OOB accesses, > > where KASAN fails to catch it because the access might skip over the > > redzone. > > > > The other more interesting bit of history is that > > -fsanitize=local-bounds used to be -fbounds-checking, and meant for > > production use as a hardening feature: > > http://lists.llvm.org/pipermail/llvm-dev/2012-May/049972.html > > > > And local-bounds just does not behave like any other sanitizer as a > > result, it just traps. The fact that it's enabled via > > -fsanitize=local-bounds (or just bounds) but hasn't much changed in > > behaviour is a little unfortunate. > > > I suppose there are 3 options: > > > > 1. George implements trap handling somehow. Is this feasible? If not, > > why not? Maybe that should also have been explained in the commit > > message. > > > > 2. Only enable -fsanitize=local-bounds if UBSAN_TRAP was selected, at > > least for as long as Clang traps for local-bounds. I think this makes > > sense either way, because if we do not expect UBSAN to trap, it really > > should not trap! > > > > 3. Change the compiler. As always, this will take a while to implement > > and then to reach whoever should have that updated compiler. > > > > Preferences? > Considering of what you said above, I find option 2 the most elegant. > The first one doesn't sound doable for the moment, also the third. > I will edit this patch considering your comments and resend it to the > list. I have a slightly different suggestion that is very nearly #2 above: split local-bounds into a separate CONFIG that requires UBSAN_TRAP, and then carefully document both: - what does it catch that "bounds" doesn't - why it only operates in trap mode The rationale I have is that I don't like the coverage of some mitigation or detection to "silently" vary between builds. e.g. someone would build with/without UBSAN_TRAP and end up with unexpectedly different coverage. I'd rather there be a separate CONFIG that appears. -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel