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.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 67598C433E0 for ; Thu, 18 Mar 2021 21:45:03 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 DE5EE64F3B for ; Thu, 18 Mar 2021 21:45:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE5EE64F3B 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uQ2S4c9YcQhClQ7uOO1Osrp5guhXMgCjSsKVxnJp8eA=; b=aGiOC0IcTvmaadYEOd8FEp02l TXIb93/cmZLV5rNqxDa53p1LLzHx2l9nUoTx8VPMfvO2JAGstUh1JK/2PyNkSvZ6uqK57YANrvrIZ l4dYUrME7EcNT1BgGH2kbwEpuFVOjKMblmuOgaberHJBoJ2Js0l5mpssriciVTKwtn3QCHaPStoOp ZWASqpFLKJG88QwlMz4lB29ud3Alc29fwfgpAww321KtsmQuVCAl2uJ2w3XwF0aCXs9qnLSkbW0jt Vun4aF81mhZN1My7Ie32SBtaNqnUFalI8H8XDaaXmaR2EIyTgGjB4eeu3PxsH1BhGIVuBlSB4fSi7 lDfbmc24g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lN0QS-00648S-TW; Thu, 18 Mar 2021 21:43:29 +0000 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lN0QN-00647X-6R for linux-arm-kernel@lists.infradead.org; Thu, 18 Mar 2021 21:43:26 +0000 Received: by mail-vs1-xe29.google.com with SMTP id k14so2378883vsb.6 for ; Thu, 18 Mar 2021 14:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rfHwrQyYaFFNRaf/CvYeB2LRT6h3FeiX5O3UtAqnQiA=; b=D2ijjP5ePIfYIDEXrOl6SDjSdjWjga6MRV8x79wzTLPOVqUpfTJnY2QYInFiUQe300 7Wd0/IAuihmXXNGJNDqs9nk9heQzahphl4UNIcCz0UvOFNTtXMXihJAT4F3fY2MkU9tP anRJPdXyTpdcRVy1iVvr5R3m6pZbhB3eIjk8ak7rAUjS5dmaRT40Vve02NnL2PJ0bpOv vfy6ZmelVNhYlyWj1owJSp8hEW9w0mXHGHES9YqGKthabTM77JnbUtneR9a9qfjT+7l3 TvPo6wJhx8LTr1JrQPctmfiHr8yymDGcyklaDaW6+jKBDnPLjVNDVuW0ElWvM5MEXohP 81lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rfHwrQyYaFFNRaf/CvYeB2LRT6h3FeiX5O3UtAqnQiA=; b=osed8EkEuoj+rCGSmcSx5xErz6MCByqEirX/k183nDg2PxoqXEWaOfeZ2GhWoHfvIP MXD8PU9TygodMM9Wg6YjsDxyZmYB5YUidv0KUxLA7d0/mNrdZiPhgxJiy2kExoFDBBqo OOS+MzDMhh9/3HWpKHAHOL/6D4f+w8Hy9Jrm0GAK38Xz5Rzmiab6TtocUZBlyEYBFP1a nUZ1Pwt3xxEk/QK56QVOX8IaXKap4Nf8za/uiFZ3cO4gxJ1m2P6tcPULOfUcPy04lr82 fKLg3U/y+9y+OmMIN3MEUO/DepF7sNpcVCUOadWwb5qqMGQj2MSH9JWnLBc7/q8rW/pd 3hDg== X-Gm-Message-State: AOAM5307bKVPn7qGJJiD8LB/WbIdtD02iuurcfbJ2R0GrbeK3oDMuFvd EJUYyVAECI4nQnoAzkPxc4Vydu4aoWUzt0P9gEQIYA== X-Google-Smtp-Source: ABdhPJy9nS3adGHPZWSvJ9275dmkHoQl55Y6NziJFaephhWth/YdK5K0qI8noGx0c2z+S/anWDkygwUMfNbI12wJXp8= X-Received: by 2002:a05:6102:124e:: with SMTP id p14mr1004922vsg.14.1616103800982; Thu, 18 Mar 2021 14:43:20 -0700 (PDT) MIME-Version: 1.0 References: <20210318171111.706303-1-samitolvanen@google.com> <20210318171111.706303-5-samitolvanen@google.com> In-Reply-To: From: Sami Tolvanen Date: Thu, 18 Mar 2021 14:43:09 -0700 Message-ID: Subject: Re: [PATCH v2 04/17] module: ensure __cfi_check alignment To: Nick Desaulniers Cc: Kees Cook , Nathan Chancellor , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , bpf , linux-hardening@vger.kernel.org, linux-arch , Linux ARM , Linux Kbuild mailing list , PCI , LKML X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210318_214323_423933_704E884A X-CRM114-Status: GOOD ( 24.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Mar 18, 2021 at 12:27 PM Nick Desaulniers wrote: > > On Thu, Mar 18, 2021 at 10:11 AM Sami Tolvanen wrote: > > > > CONFIG_CFI_CLANG_SHADOW assumes the __cfi_check() function is page > > aligned and at the beginning of the .text section. While Clang would > > normally align the function correctly, it fails to do so for modules > > with no executable code. > > > > This change ensures the correct __cfi_check() location and > > alignment. It also discards the .eh_frame section, which Clang can > > generate with certain sanitizers, such as CFI. > > > > Link: https://bugs.llvm.org/show_bug.cgi?id=46293 > > Signed-off-by: Sami Tolvanen > > --- > > scripts/module.lds.S | 18 +++++++++++++++++- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/scripts/module.lds.S b/scripts/module.lds.S > > index 168cd27e6122..93518579cf5d 100644 > > --- a/scripts/module.lds.S > > +++ b/scripts/module.lds.S > > @@ -3,10 +3,19 @@ > > * Archs are free to supply their own linker scripts. ld will > > * combine them automatically. > > */ > > +#include > > + > > +#ifdef CONFIG_CFI_CLANG > > +# define ALIGN_CFI ALIGN(PAGE_SIZE) > > +#else > > +# define ALIGN_CFI > > +#endif > > + > > SECTIONS { > > /DISCARD/ : { > > *(.discard) > > *(.discard.*) > > + *(.eh_frame) > > Do we want to unconditionally discard this section from modules for > all arches/configs? I like how we conditionally do so on > SANITIZER_DISCARDS in include/asm-generic/vmlinux.lds.h for example. I think nothing should generate this section unless one of the sanitizers is enabled, but I'm fine with using the same logic as vmlinux.lds.h here. I'll change this in v3. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel