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.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 2799AC433E2 for ; Wed, 16 Sep 2020 07:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E42C520684 for ; Wed, 16 Sep 2020 07:40:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gjM7bxmS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726511AbgIPHkg (ORCPT ); Wed, 16 Sep 2020 03:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbgIPHkd (ORCPT ); Wed, 16 Sep 2020 03:40:33 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE615C06174A for ; Wed, 16 Sep 2020 00:40:31 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id e17so1773085wme.0 for ; Wed, 16 Sep 2020 00:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=gjM7bxmS6+Hzs07rV/WLqiZ7oypbPZeeynUIbEGf+1I9i5xUZgFTr9pBvxoJKit3lh /TC/qQi6Hp2TtnCO/NeCATHt2bkpPA/JZvcO9Wttw2I/Sc/8JV0ACXRCD1k8lq2qSH2u xFt8e4VclXK6orUp/sR81UNyuRsBU9CKP69jotta8/o3ZN0y/ATIUSrKa0W8LIOgRy2n DkB86wfYPzlKcUglMBue1jJjXIt1v3N2MKI2EvcrO/plB1MItPyrUhAx217Bc/mR4MCH vj2Ii+bGg1WlPNB/9eezKaFrqWjQ4uNrrqwZjwW+1wrycv8XxA+imCdxpWXZ+TBspfEU cO6A== 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=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=tEiPOo+4gO0iFCGzfb7+nE/vki/+/g8WxGsu7j69sdItqspefaMU5L1PQxI9m1J4co W+k2mAy5kxKA6k4VLQJarg433R77otw06ZkXHksh3bZ4WX0wOdwQTxEvwWGJk4P3tHqt BBvULYFfGw4Kyi1pAfKB/Twrnj0r6Qb4sd+cqWgAqpyjGPs69HGPTCXcJrMXuogljo5I 1/W64F8Cuwi0fX2AvpFwmP9F7hQ33PYqE591nD+r0tblvTUyL3N7lByjN5JTLOlUSSBZ IlR5yQ7zulZaBwh/gmwwbozPfAalEJiK0f8qpN7kpwyf6+pnOt7TQzRmyT1Lcwc65t72 12yg== X-Gm-Message-State: AOAM530aImVDxOhmVgOu3uQRmtPFrinnJ4O+UlKJAzwz74i4D1+hkUVr OsyTEBoMmK/7l4TwFD6P7ykBaw== X-Google-Smtp-Source: ABdhPJx/FHKbG/LfARiaWGrhnM+fErvXhr1oAsC0Dy1+R1K4G2d1MrURncNcx4OJ1k5GECgPKBKUBg== X-Received: by 2002:a1c:9a57:: with SMTP id c84mr3177066wme.136.1600242029785; Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Received: from google.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id u66sm3770553wme.12.2020.09.16.00.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Date: Wed, 16 Sep 2020 07:40:27 +0000 From: George Popescu To: Marco Elver Cc: Kees Cook , maz@kernel.org, Catalin Marinas , Will Deacon , Masahiro Yamada , Michal Marek , Linux ARM , kvmarm@lists.cs.columbia.edu, LKML , Linux Kbuild mailing list , clang-built-linux , james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, Nathan Chancellor , Nick Desaulniers , David Brazdil , broonie@kernel.org, Fangrui Song , Andrew Scull , Andrew Morton , Dmitry Vyukov , Thomas Gleixner , Arnd Bergmann Subject: Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Message-ID: <20200916074027.GA2946587@google.com> References: <20200914172750.852684-1-georgepope@google.com> <20200914172750.852684-7-georgepope@google.com> <202009141509.CDDC8C8@keescook> <20200915102458.GA1650630@google.com> <20200915120105.GA2294884@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 07:32:28PM +0200, Marco Elver wrote: > On Tue, 15 Sep 2020 at 14:01, George Popescu wrote: > > > > On Tue, Sep 15, 2020 at 01:18:11PM +0200, Marco Elver wrote: > > > On Tue, 15 Sep 2020 at 12:25, George Popescu wrote: > > > > On Mon, Sep 14, 2020 at 03:13:14PM -0700, Kees Cook wrote: > > > > > 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 > > > > > > > > > This would mean losing the local-bounds coverage. I tried to test it without > > > > local-bounds and with a locally defined array on the stack and it works fine > > > > (the handler is called and the error reported). For me it feels like > > > > --array-bounds and --local-bounds are triggered for the same type of > > > > undefined_behaviours but they are handling them different. > > > > > > Does -fno-sanitize-trap=bounds help?> > > > > I tried replacing it with: > > ifdef CONFIG_CC_IS_CLANG > > CFLAGS_UBSAN += $(call cc-option, -fno-sanitize-trap=bounds) > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > else > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > endif > > > > The code traps. > > What's your config? Do you have CONFIG_UBSAN_TRAP=y? If so, you have 2 > options: honor UBSAN_TRAP and crash the kernel, or have a > 'CFLAGS_REMOVE_... = -fsanitize-undefined-trap-on-error' for the files > where you can't deal with traps> I don't have CONFIG_UBSAN_TRAP=y. My .config is: CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_UBSAN=y # CONFIG_UBSAN_TRAP is not set CONFIG_UBSAN_KCOV_BROKEN=y CONFIG_UBSAN_MISC=y CONFIG_UBSAN_SANITIZE_ALL=y # CONFIG_UBSAN_ALIGNMENT is not set CONFIG_TEST_UBSAN=m Thanks, George 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=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 0E08AC35257 for ; Wed, 16 Sep 2020 07:40:37 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 48B762076C for ; Wed, 16 Sep 2020 07:40:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="gjM7bxmS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48B762076C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7ADC94B348; Wed, 16 Sep 2020 03:40:35 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6-+40sE9GeNv; Wed, 16 Sep 2020 03:40:34 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 752DD4B351; Wed, 16 Sep 2020 03:40:34 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 59CA54B348 for ; Wed, 16 Sep 2020 03:40:33 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xMi7TTwKNj8S for ; Wed, 16 Sep 2020 03:40:31 -0400 (EDT) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 6124C4B345 for ; Wed, 16 Sep 2020 03:40:31 -0400 (EDT) Received: by mail-wm1-f68.google.com with SMTP id a9so1863590wmm.2 for ; Wed, 16 Sep 2020 00:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=gjM7bxmS6+Hzs07rV/WLqiZ7oypbPZeeynUIbEGf+1I9i5xUZgFTr9pBvxoJKit3lh /TC/qQi6Hp2TtnCO/NeCATHt2bkpPA/JZvcO9Wttw2I/Sc/8JV0ACXRCD1k8lq2qSH2u xFt8e4VclXK6orUp/sR81UNyuRsBU9CKP69jotta8/o3ZN0y/ATIUSrKa0W8LIOgRy2n DkB86wfYPzlKcUglMBue1jJjXIt1v3N2MKI2EvcrO/plB1MItPyrUhAx217Bc/mR4MCH vj2Ii+bGg1WlPNB/9eezKaFrqWjQ4uNrrqwZjwW+1wrycv8XxA+imCdxpWXZ+TBspfEU cO6A== 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=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=ssdQr4g7PmgTr7SD6VPpeL1Y9LAz/WNh24lYOwD+X6zgBA+kH4HvQ7JwKBpd3YdLtE OQJp7x6wBOFDUjUJJF3UJGQ+gNKvPnXg/yVaFM019wBNUzPqKYu0CPjoasHj4pGSoXHR j9MZqJf3jzmUZqEBEVSmw8J6ZloHaT4pWozgpy5vgtWgjb2boKL3HXKTieJvPZ3HBm0g iXIzg9LpjRH28SkJ6Hrtj0k3x4HAj2Wbl2IeO+o5y9KbcRo6j3XZoVoye2lnIbm4h4Nw tN4LK4pFHXTdYd5bjcFMNfEWyxkfHGv0gCGvEImTI4uh6UuUikht3oClGVkaSSrr8zCN 83eQ== X-Gm-Message-State: AOAM532ujnZa6DAji1IZ3ot6O6HaonybuzXwNnU1Ix4FVKLwwgIaa8R/ mNiVBlxWDJnHpTODxG0vvtVx6w== X-Google-Smtp-Source: ABdhPJx/FHKbG/LfARiaWGrhnM+fErvXhr1oAsC0Dy1+R1K4G2d1MrURncNcx4OJ1k5GECgPKBKUBg== X-Received: by 2002:a1c:9a57:: with SMTP id c84mr3177066wme.136.1600242029785; Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Received: from google.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id u66sm3770553wme.12.2020.09.16.00.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Date: Wed, 16 Sep 2020 07:40:27 +0000 From: George Popescu To: Marco Elver Subject: Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Message-ID: <20200916074027.GA2946587@google.com> References: <20200914172750.852684-1-georgepope@google.com> <20200914172750.852684-7-georgepope@google.com> <202009141509.CDDC8C8@keescook> <20200915102458.GA1650630@google.com> <20200915120105.GA2294884@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: Thomas Gleixner , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, Fangrui Song , maz@kernel.org, Masahiro Yamada , clang-built-linux , Linux ARM , Kees Cook , Arnd Bergmann , Linux Kbuild mailing list , broonie@kernel.org, Nathan Chancellor , Dmitry Vyukov , Michal Marek , Nick Desaulniers , LKML , Andrew Morton X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Tue, Sep 15, 2020 at 07:32:28PM +0200, Marco Elver wrote: > On Tue, 15 Sep 2020 at 14:01, George Popescu wrote: > > > > On Tue, Sep 15, 2020 at 01:18:11PM +0200, Marco Elver wrote: > > > On Tue, 15 Sep 2020 at 12:25, George Popescu wrote: > > > > On Mon, Sep 14, 2020 at 03:13:14PM -0700, Kees Cook wrote: > > > > > 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 > > > > > > > > > This would mean losing the local-bounds coverage. I tried to test it without > > > > local-bounds and with a locally defined array on the stack and it works fine > > > > (the handler is called and the error reported). For me it feels like > > > > --array-bounds and --local-bounds are triggered for the same type of > > > > undefined_behaviours but they are handling them different. > > > > > > Does -fno-sanitize-trap=bounds help?> > > > > I tried replacing it with: > > ifdef CONFIG_CC_IS_CLANG > > CFLAGS_UBSAN += $(call cc-option, -fno-sanitize-trap=bounds) > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > else > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > endif > > > > The code traps. > > What's your config? Do you have CONFIG_UBSAN_TRAP=y? If so, you have 2 > options: honor UBSAN_TRAP and crash the kernel, or have a > 'CFLAGS_REMOVE_... = -fsanitize-undefined-trap-on-error' for the files > where you can't deal with traps> I don't have CONFIG_UBSAN_TRAP=y. My .config is: CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_UBSAN=y # CONFIG_UBSAN_TRAP is not set CONFIG_UBSAN_KCOV_BROKEN=y CONFIG_UBSAN_MISC=y CONFIG_UBSAN_SANITIZE_ALL=y # CONFIG_UBSAN_ALIGNMENT is not set CONFIG_TEST_UBSAN=m Thanks, George _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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_ADSP_CUSTOM_MED,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 48717C433E2 for ; Wed, 16 Sep 2020 07:42:11 +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 C3E462076C for ; Wed, 16 Sep 2020 07:42:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jFIvYb61"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="gjM7bxmS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C3E462076C 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: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=23WbCI/og1D9vCv8pseETb/R3WpyWUwC6vNqeYID0pg=; b=jFIvYb61ARl2zCdvucnaxwddQ T8snWKy/sraaCviU2r4uDk60ocuEjhkjUf8uqeVBNUf+LibIgRRIFoGw11/pYsDaWa1tdRMIK3BUv WXnbcontEv8wq+VGFAP8veMIGnaEgcpN7NMUX3A02GC/OKkAJSvKICN2nVCks6AMz3xI420JJcjRw H1we2eorERQ9NMWQKU12Bsez42kqPDBOZA9Q1wfe7zFwLGL65mE9AHIzf0aTzUwyMfwVZsawca/6D SxjoSRfOMEOpzfirZfeEn8OKooMnyBg3ZX8tWVEHfgaCHs3eMCOLLXiephuaUkHvEYR8aRS7tP/IR naa9pCGwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIS3Q-0001y9-7t; Wed, 16 Sep 2020 07:40:36 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIS3M-0001wu-Vu for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 07:40:33 +0000 Received: by mail-wm1-x343.google.com with SMTP id x23so1753454wmi.3 for ; Wed, 16 Sep 2020 00:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=gjM7bxmS6+Hzs07rV/WLqiZ7oypbPZeeynUIbEGf+1I9i5xUZgFTr9pBvxoJKit3lh /TC/qQi6Hp2TtnCO/NeCATHt2bkpPA/JZvcO9Wttw2I/Sc/8JV0ACXRCD1k8lq2qSH2u xFt8e4VclXK6orUp/sR81UNyuRsBU9CKP69jotta8/o3ZN0y/ATIUSrKa0W8LIOgRy2n DkB86wfYPzlKcUglMBue1jJjXIt1v3N2MKI2EvcrO/plB1MItPyrUhAx217Bc/mR4MCH vj2Ii+bGg1WlPNB/9eezKaFrqWjQ4uNrrqwZjwW+1wrycv8XxA+imCdxpWXZ+TBspfEU cO6A== 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=tqvp+bkIU1TWNlZpwcv+TKRU2X5GojmD5HYurFQV7BY=; b=SXTStOjYo6nzP+PCLrFCWhFm1se6XLzBC4svX4nBIuCBtxYzn6lZgDb93D8CZbSJtB 7GPv/TQqef18Uh6RnjO8hrIgaMw2qR98SWLSvIzMKq8sghe6/t/UIcaAnVroMezR6SlT jIkYIK2PWAoGSjxx0yVIqf7uwnUNz/P0BMbyDzfkEcRpQ8nfriDaCLEoM0ASdL0eYWeU k+UmKdaQMWYfgigdzva9JsiOLYMofZAwQzS3aNJAkoc7q53kNeQtm4OKn8t+p0rrxCGT P/rc9AcaZ+/5vVxC+p7gPRfCU70GH4zf+oUpEKcBjAsdNJYrE4AWy4K4dElWgRdFFTcw vSHg== X-Gm-Message-State: AOAM531PYUId1zYgOauLWhei5OGD3szu4VzLaGVbp6lEzF5eBB5tJrXT r8ULWLTuZtnLn1rEQHTG6fACkA== X-Google-Smtp-Source: ABdhPJx/FHKbG/LfARiaWGrhnM+fErvXhr1oAsC0Dy1+R1K4G2d1MrURncNcx4OJ1k5GECgPKBKUBg== X-Received: by 2002:a1c:9a57:: with SMTP id c84mr3177066wme.136.1600242029785; Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Received: from google.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id u66sm3770553wme.12.2020.09.16.00.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 00:40:29 -0700 (PDT) Date: Wed, 16 Sep 2020 07:40:27 +0000 From: George Popescu To: Marco Elver Subject: Re: [PATCH 06/14] Fix CFLAGS for UBSAN_BOUNDS on Clang Message-ID: <20200916074027.GA2946587@google.com> References: <20200914172750.852684-1-georgepope@google.com> <20200914172750.852684-7-georgepope@google.com> <202009141509.CDDC8C8@keescook> <20200915102458.GA1650630@google.com> <20200915120105.GA2294884@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_034033_055461_2D31DFAC X-CRM114-Status: GOOD ( 25.60 ) 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 , Will Deacon , kvmarm@lists.cs.columbia.edu, Fangrui Song , maz@kernel.org, Masahiro Yamada , suzuki.poulose@arm.com, clang-built-linux , Linux ARM , David Brazdil , julien.thierry.kdev@gmail.com, Kees Cook , Arnd Bergmann , Linux Kbuild mailing list , 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 Tue, Sep 15, 2020 at 07:32:28PM +0200, Marco Elver wrote: > On Tue, 15 Sep 2020 at 14:01, George Popescu wrote: > > > > On Tue, Sep 15, 2020 at 01:18:11PM +0200, Marco Elver wrote: > > > On Tue, 15 Sep 2020 at 12:25, George Popescu wrote: > > > > On Mon, Sep 14, 2020 at 03:13:14PM -0700, Kees Cook wrote: > > > > > 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 > > > > > > > > > This would mean losing the local-bounds coverage. I tried to test it without > > > > local-bounds and with a locally defined array on the stack and it works fine > > > > (the handler is called and the error reported). For me it feels like > > > > --array-bounds and --local-bounds are triggered for the same type of > > > > undefined_behaviours but they are handling them different. > > > > > > Does -fno-sanitize-trap=bounds help?> > > > > I tried replacing it with: > > ifdef CONFIG_CC_IS_CLANG > > CFLAGS_UBSAN += $(call cc-option, -fno-sanitize-trap=bounds) > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > else > > CFLAGS_UBSAN += $(call cc-option, -fsanitize=bounds) > > endif > > > > The code traps. > > What's your config? Do you have CONFIG_UBSAN_TRAP=y? If so, you have 2 > options: honor UBSAN_TRAP and crash the kernel, or have a > 'CFLAGS_REMOVE_... = -fsanitize-undefined-trap-on-error' for the files > where you can't deal with traps> I don't have CONFIG_UBSAN_TRAP=y. My .config is: CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y CONFIG_UBSAN=y # CONFIG_UBSAN_TRAP is not set CONFIG_UBSAN_KCOV_BROKEN=y CONFIG_UBSAN_MISC=y CONFIG_UBSAN_SANITIZE_ALL=y # CONFIG_UBSAN_ALIGNMENT is not set CONFIG_TEST_UBSAN=m Thanks, George _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel