Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp792678rwb; Thu, 6 Oct 2022 04:44:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4A5obphkreWzLQz73lOaip7Yt3OjAvG+buqulOiZq+nzWgl1116x6WO2/JXTAr+RTK9iYN X-Received: by 2002:a17:90b:4d07:b0:1ef:521c:f051 with SMTP id mw7-20020a17090b4d0700b001ef521cf051mr10472483pjb.164.1665056675778; Thu, 06 Oct 2022 04:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665056675; cv=none; d=google.com; s=arc-20160816; b=bj7Dy80ZdfMBpjdq0dIKWx80wGeSmJyekYG7SbU2oFFsL+iY1MlIkhCkyeX5bXFtWQ xomBcUWgeUjnkQdNIgXcTH+TxqG/0ieVO5V2F5n3vzSUJ6LbnzRU53JAIcDn80d5/zsv lDhQdoVKxtjkijl07shYNTdLsjleiQXTJpDTNVQKkT7sL/aNC0VNn9D9Lp9rkV+04YEM htNboBzmePF1y5SFVQIN5gCTmUC1o5DQEFyUABDWwZzWc+1tuqpqJZM7Xcq7XLAEz5JH LXpnJneeT9bHLnedhwFtKR/7IxGyJoWnMw9NASlxYj7v0x/NPaK2sLtnwaI/CfAUdkwF 2DWA== 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:dkim-signature; bh=okIIDtMox7za1/6DOQ1iRZehRlXMXl+Mt82R2yuiF9A=; b=WbU28wM0kbMRU4uDsFFs35Gl7Ss67mVrDjVn/h32vBk02YhJ8UuzamNxPZKtZ8+SNj 2oXi9sDYcmYC2VQ87Mkc8fxY7+uGZpIo5GR1XZ3xDMF7HsEyctdK6n1bL2c8HDG7+zKh b5undeioirVnowTXrICLibgfG0zlsAdhyneCRPaLmsf1s74AG6F5bjj/Zhh7Ugiv0iOu D3essDWyUK0p5DSBTk9wMQ28eWHxiNm/woxlzkyC2Gx2HLpjn6pAl+Et+HWQ874+bHsE YKaV7cn4eZch50O85lCg7m6GLoshnl5PLtuY6eVKw0IDyazTNKB03gZS2OZjOSk++x10 294Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=hD22CKpJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a056a001a1100b0053e757130c3si20017772pfv.378.2022.10.06.04.44.18; Thu, 06 Oct 2022 04:44:35 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=hD22CKpJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbiJFLOF (ORCPT + 99 others); Thu, 6 Oct 2022 07:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbiJFLNy (ORCPT ); Thu, 6 Oct 2022 07:13:54 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9448D10B7; Thu, 6 Oct 2022 04:13:53 -0700 (PDT) Received: from zn.tnic (p200300ea9733e732329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e732:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 3AA481EC0409; Thu, 6 Oct 2022 13:13:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1665054828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=okIIDtMox7za1/6DOQ1iRZehRlXMXl+Mt82R2yuiF9A=; b=hD22CKpJ0U1ZI76fh0TEtoRWfz4/yIiaSixCIEOpFPmGDO4c10CdqUplMJhrNDaOsxNUwX XYnWwKYupZhpWZXPaqyYdlfHO4NxJw1TN6DTE+rVp/sAyxdjGtyVmC2BGyJJXr3mO3Hukf gAzGAvMcXgk3rlaWrM9wq7fKr2ME7lQ= Date: Thu, 6 Oct 2022 13:13:44 +0200 From: Borislav Petkov To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , Michael Roth Subject: Re: [PATCH v2 02/16] x86/compressed: efi-mixed: move 32-bit entrypoint code into .text section Message-ID: References: <20220921145422.437618-1-ardb@kernel.org> <20220921145422.437618-3-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Thu, Oct 06, 2022 at 12:56:09PM +0200, Ard Biesheuvel wrote: > efi32_pe_entry() preserves and restores the caller's value of %ebx, > because from there, we might actually return control to the firmware. > The value it keeps in %ebx itself is not live when it jumps to > efi32_entry - it stores its value into image_offset, which is reloaded > from memory at a later point. Hmm, might be prudent to have a comment there because it is using %ebx a couple of insns before the JMP: subl %esi, %ebx ^^^^ movl %ebx, rva(image_offset)(%ebp) // save image_offset <--- I think you mean that after this, %ebx is not needed anymore? xorl %esi, %esi jmp efi32_entry 2: popl %edi // restore callee-save registers popl %ebx and this restores its original value ofc. > efi32_stub_entry() is the 'EFI handover protocol' entry point, which > cannot return to the firmware (and we discard the return address > already) so %ebx can be clobbered. That info would be good to have in a comment above it. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette