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=-9.8 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,URIBL_BLOCKED autolearn=unavailable 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 35002C433DF for ; Wed, 14 Oct 2020 22:59:45 +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 B50F420776 for ; Wed, 14 Oct 2020 22:59:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WIUPSUxs"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="R63EBTH6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B50F420776 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=qNLu296SVVscU1bitGXi4LWV0bpoqcDITw4Io7zmrUc=; b=WIUPSUxs7dnkjEUSWVASolAw3 tkTsXS9OuYf70+NsHHH8nViCMWXuev2AtxOO2rz2XuIuBwO6YPI4cBqayPDH22TZEn6Cgjzd+pGdP aDikSkEudcyUPEDKBbgDCnC3SsQfywseEn8H57O7gQSTR4WXtDU1bHLjhKG1orJXXHFN8y/ralgYC R8KNtzyCstIEu5spBR5V5LFSZ7B3b/TFnKXQZep1gM6FPtTtKqFWSMtoFdNCSJZVJXPC+3Mv8q2ge vQh1l6J+jmCiFBLCSv93j5pP9DmOoubUIJ2WkeFNSOg+8Fln71NBpWJryagrtMTArgbLmER3byXZ2 hILTwS/xQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSpis-0005kH-JD; Wed, 14 Oct 2020 22:58:18 +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 1kSpip-0005j5-RX for linux-arm-kernel@lists.infradead.org; Wed, 14 Oct 2020 22:58:17 +0000 Received: by mail-pj1-x1042.google.com with SMTP id g16so590239pjv.3 for ; Wed, 14 Oct 2020 15:58:15 -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=WUVth3Yi/0Gf6s7eybXLKtt4uMjJ4xi70yGGSwDkLw0=; b=R63EBTH6+0dTkzS267+O24BYdxnurWecDwGpDuhGH5wyKY0Pg8ynHUH/iEecP4Gnho RfNGPWH3YDit4Wmb0luYZWOyRplddz6hFIgmHH4CLhIZt4IyCFh8a/BvWIZDZQnBcGoK FZBeYg7LPlk+kUu4N8sYcxncY/8J8OqwbusLI= 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=WUVth3Yi/0Gf6s7eybXLKtt4uMjJ4xi70yGGSwDkLw0=; b=RRali57FcdhZsyWeW9BxaD9lcBoAXePVmnqG6xTnx3I6TEx5OCc18sprsI9g46vp/b XpH7J/BbPRBxTtqMlwqnDzL/dzKgHWqknCXunij41+KgbXVob1ARPR6O+VSf/I0VKmVt R0mijwwgbkbc6fngWwUkj9EjU75wHmq6HcMuSA5Mi7Uk5Il/E8SFqmCSH/nCD/wmnV7A Yj/0kXsaO0Yim/xplxL0DEKPghcOto7Xz0upnbC3VyDFataUfm+3ZUSKveU7dHuGMxDz aD7F9McGuytI1EyLZE0OEcNDp6Qti6RBH32fc12nGShFwbrcQUiL/k0Z7JfbQxLY0r7K BiFw== X-Gm-Message-State: AOAM532+rAOtTazI995KLiYEwlHVPdKUGSgktDw08xErxGcF2FG13xWZ g1I6xER6mC0ZYQ0ntvPvopLvZw== X-Google-Smtp-Source: ABdhPJzHdqdE46WrFZlw8R7S7F1x+3bND/WLRTw47I4euXQao8J+1ZC4KoSJiwuZcz/FXnt7OEBn6A== X-Received: by 2002:a17:902:59da:b029:d4:c71a:357a with SMTP id d26-20020a17090259dab02900d4c71a357amr1496188plj.38.1602716293981; Wed, 14 Oct 2020 15:58:13 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g14sm715510pfo.17.2020.10.14.15.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 15:58:13 -0700 (PDT) Date: Wed, 14 Oct 2020 15:58:12 -0700 From: Kees Cook To: Bjorn Helgaas Subject: Re: [PATCH v6 17/25] PCI: Fix PREL32 relocations for LTO Message-ID: <202010141556.DC58D913@keescook> References: <20201013003203.4168817-1-samitolvanen@google.com> <20201013003203.4168817-18-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201013003203.4168817-18-samitolvanen@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201014_185815_913648_BC32F2E5 X-CRM114-Status: GOOD ( 21.33 ) 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: linux-arch@vger.kernel.org, x86@kernel.org, "Paul E. McKenney" , kernel-hardening@lists.openwall.com, Peter Zijlstra , Greg Kroah-Hartman , Masahiro Yamada , linux-kbuild@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Steven Rostedt , clang-built-linux@googlegroups.com, Sami Tolvanen , linux-pci@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.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, Oct 12, 2020 at 05:31:55PM -0700, Sami Tolvanen wrote: > With Clang's Link Time Optimization (LTO), the compiler can rename > static functions to avoid global naming collisions. As PCI fixup > functions are typically static, renaming can break references > to them in inline assembly. This change adds a global stub to > DECLARE_PCI_FIXUP_SECTION to fix the issue when PREL32 relocations > are used. > > Signed-off-by: Sami Tolvanen > Acked-by: Bjorn Helgaas > Reviewed-by: Kees Cook Another independent patch! :) Bjorn, since you've already Acked this patch, would be be willing to pick it up for your tree? -Kees > --- > include/linux/pci.h | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 835530605c0d..4e64421981c7 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1909,19 +1909,28 @@ enum pci_fixup_pass { > }; > > #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS > -#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > - class_shift, hook) \ > - __ADDRESSABLE(hook) \ > +#define ___DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > + class_shift, hook, stub) \ > + void stub(struct pci_dev *dev); \ > + void stub(struct pci_dev *dev) \ > + { \ > + hook(dev); \ > + } \ > asm(".section " #sec ", \"a\" \n" \ > ".balign 16 \n" \ > ".short " #vendor ", " #device " \n" \ > ".long " #class ", " #class_shift " \n" \ > - ".long " #hook " - . \n" \ > + ".long " #stub " - . \n" \ > ".previous \n"); > + > +#define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > + class_shift, hook, stub) \ > + ___DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > + class_shift, hook, stub) > #define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > class_shift, hook) \ > __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ > - class_shift, hook) > + class_shift, hook, __UNIQUE_ID(hook)) > #else > /* Anonymous variables would be nice... */ > #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ > -- > 2.28.0.1011.ga647a8990f-goog > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel