Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3689081rwb; Tue, 20 Sep 2022 03:20:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58UHI1AGDck7LVR4gXmC0QxjgenXGmFc/NyYJU6GakmHy8/njWF4KduLOi26jF21tt5Xpi X-Received: by 2002:a17:906:5d05:b0:781:be1b:f4cd with SMTP id g5-20020a1709065d0500b00781be1bf4cdmr2037120ejt.408.1663669254530; Tue, 20 Sep 2022 03:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663669254; cv=none; d=google.com; s=arc-20160816; b=x9J9452++9nufeKquRjbEquOyt7j1fGIcDWUfmSxEr66DGWp8FiX1bZlGNu8YY7fAz 1HuuDDZxd0UPJ6dT5Kqjeu8pkLnfRUrKjh42WDy9V+qxaW7hith7TISlL91VCAxWmnkN 7c2/+PsTCuad5+2qt+izRGhYwp/xCaX83gf7mNtUxEmN3CHQ8i/Vjb4k4VFxwUv+Vbu9 khBMiRTBKs2x2b/OQ1i2TcQ3AvNuwXaDSpFYp49D7MIZ3huWbE4PrrejWT4SWTPirpKi kH0ra2qEQ2HBi4+E4gzrjoO0uArTfgiYP9p733yNrZq8nkso8V9redGQmvad+qinC/tn wEGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rLWpqOYNydDytWTiq3JZL+M+eJS0fYcaKiR0PkT/0AE=; b=OL7Is+iXMGRKWpB/RKyIwvHaqsAtdQc7jib0qH75EPom86+IDdEfceWmzq2/OvgB3A HkeOtKLb//DuYSTOmhpSQ0QDBU9l89tjX4g5KCUocDvyhu8+0DYWSvNi7lRjSqCnvNLH Wl+zwnzSnOpDew0f3RwmJ1KEfjCxsME7Lx2jVeEqHnrkAOyw3l2ffndeEi/nxqbZkI0N L8fPCqdtsDiF61RQUlUPChNlgBAsxXUbRODv+T3SHCoOJ6mhQV3b0KK219dnS0anvcEF GuV8ic2Q3sFpkkyOL/P5gK6GxmP9KAxLP4yhz7M5igYFDGqJTJp9uaiS1y+twu1blMS5 vjlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he43-20020a1709073dab00b00781bc50abefsi1030851ejc.387.2022.09.20.03.20.28; Tue, 20 Sep 2022 03:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbiITJye (ORCPT + 99 others); Tue, 20 Sep 2022 05:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbiITJya (ORCPT ); Tue, 20 Sep 2022 05:54:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05A61D9D; Tue, 20 Sep 2022 02:54:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D1FD6287A; Tue, 20 Sep 2022 09:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7684BC433C1; Tue, 20 Sep 2022 09:54:24 +0000 (UTC) Date: Tue, 20 Sep 2022 10:54:21 +0100 From: Catalin Marinas To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "James E.J. Bottomley" , Matthew Garrett , Peter Jones , Ilias Apalodimas , Heinrich Schuchardt , AKASHI Takahiro , Palmer Dabbelt , Atish Patra , Arnd Bergmann , Huacai Chen , Xi Ruoyao , Lennart Poettering , Jeremy Linton , Will Deacon Subject: Re: [PATCH v5 3/8] efi/libstub: use EFI provided memcpy/memset routines Message-ID: References: <20220910081152.2238369-1-ardb@kernel.org> <20220910081152.2238369-4-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220910081152.2238369-4-ardb@kernel.org> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 10, 2022 at 10:11:47AM +0200, Ard Biesheuvel wrote: > The stub is used in different execution environments, but on arm64, > RISC-V and LoongArch, we still use the core kernel's implementation of > memcpy and memset, as they are just a branch instruction away, and can > generally be reused even from code such as the EFI stub that runs in a > completely different address space. > > KAsan complicates this slightly, resulting in the need for some hacks to > expose the uninstrumented, __ prefixed versions as the normal ones, as > the latter are instrumented to include the KAsan checks, which only work > in the core kernel. > > Unfortunately, #define'ing memcpy to __memcpy when building C code does > not guarantee that no explicit memcpy() calls will be emitted. And with > the upcoming zboot support, which consists of a separate binary which > therefore needs its own implementation of memcpy/memset anyway, it's > better to provide one explicitly instead of linking to the existing one. > > Given that EFI exposes implementations of memmove() and memset() via the > boot services table, let's wire those up in the appropriate way, and > drop the references to the core kernel ones. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/kernel/image-vars.h | 13 --------- Acked-by: Catalin Marinas