Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp792669rwb; Thu, 6 Oct 2022 04:44:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5L7t3YQwg+L6huIaoHXZkenx3zZa3szWk2w9uHJYMtJ8OlkYth5UWY6Okt+Gw/uFKnCLXs X-Received: by 2002:a17:902:e88d:b0:17f:42f0:8d60 with SMTP id w13-20020a170902e88d00b0017f42f08d60mr4242362plg.169.1665056675185; 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=HZ4BBOPYPKVLfND2UqjSVllEJLDSA/vK/sZzM2sGvWPF0NOmSZH/lQNbDmb0Z/ZwiF vyJ7Llktrrne1Idyu5aXnwuQuw6jtB1X0Jnup4s8MNoAeTxp0AYSj/XHBj/qR6Kg7C0c CbeRCECy3aEbKhOAgLRKIhDgJj6ywzCAjmpdu3UWORvekB0NvwxucCT4QPl/YK+5jMjI +X6U+IywBBmnhoVkw6h6EKc2hdaNVLDZoXUdCbXTxH9fU1849qsvOjeOxRayKxZxsOYw vw8zbddKpe/tfRgyWnaaRgOkXISA0fxW6Y8DJeyhuzSZ9GPJUB2J4zNu5yFwlFM7cZBh yrwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zPXCOxcPgVPoYtYzPHtPZBehn5xqbYCRItY6xdjnQhI=; b=LSPrkEV8vbW7qLIAyCnnj4FM5BDZlzd+OlYXEFcZ3H4NS2zuS8w6jU7kDD9CGTW1O8 A8cgKQHg3v25u+lCHtDdXgAtSBRippMkvzvvdCwVefZ81LCL2tkqp5tSYFORozhU4l+i 4cLzbpU3/YlG5xyv1amppdN0ZPj6aUMLimMhaXyRo0hp4qJIw5a73OdUwpFIUfEiklGo 1fmWMIn7a4xu+gxNdMsBhmchIeUSEjmRJ7bDkMu6kFp6PgJfod43+XUPg8ohcFuVRvUE vjw4c7xuOhCLlCBJCYxZpL1bHk/0vpyexEQ6gCz+PoOiYA5qVNGg50o/VmX4W078r7bE WHEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="c/v5yIHS"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a631e42000000b0041bd0985ea9si19580435pgm.671.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=@kernel.org header.s=k20201202 header.b="c/v5yIHS"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbiJFLTt (ORCPT + 99 others); Thu, 6 Oct 2022 07:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231544AbiJFLTs (ORCPT ); Thu, 6 Oct 2022 07:19:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D2B6441; Thu, 6 Oct 2022 04:19:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 36BBDB8206B; Thu, 6 Oct 2022 11:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E589DC433C1; Thu, 6 Oct 2022 11:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665055183; bh=wh50eBbhJL8z0DHYoyJWlOF+qCE6ZsExUHD9mgoDXFA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c/v5yIHSXwksjYfnKUD7sBFkbUadn0hhSxfmHmIw8sva69GYCwFPuaw8uWmQNKhAz 87Mnc3+U3Fgg+gnJ4XukXezzVg7ldP1FS4bWxBcluavbdHLsTsA6Lix/y0BdluS9Gl UoxNMrbtjE27XJ6PYgis9ptONkvq2GtO1K9seDuFlFpobarogRoYWacMy5eFgO8Dcw N/GIZB2xUXaW3Um6LtwWcv6nsT2+R1r5sh9EB9WTMrd02Cf9cUubdMVyqPXt1aTwsM hyE0ngeZSHx5kvktZVcnEfofGqtaoFERO0KLMuw/voT/HIe/vBgNYRWpreq6MQp+fj yHtfISHGQUKEQ== Received: by mail-lj1-f178.google.com with SMTP id bn8so1847944ljb.6; Thu, 06 Oct 2022 04:19:43 -0700 (PDT) X-Gm-Message-State: ACrzQf2//FIZ2ObSzJbK2mxwlCCpO0wu6c0mN+4ilaiy0IdH/VnpB5m0 aWqHYfyIdcR/PZ6JceqsRpqG4BVr+ExKMToeEG4= X-Received: by 2002:a05:651c:1590:b0:26c:4311:9b84 with SMTP id h16-20020a05651c159000b0026c43119b84mr1661348ljq.152.1665055181979; Thu, 06 Oct 2022 04:19:41 -0700 (PDT) MIME-Version: 1.0 References: <20220921145422.437618-1-ardb@kernel.org> <20220921145422.437618-3-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Thu, 6 Oct 2022 13:19:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 02/16] x86/compressed: efi-mixed: move 32-bit entrypoint code into .text section To: Borislav Petkov Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , Michael Roth Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Thu, 6 Oct 2022 at 13:13, Borislav Petkov wrote: > > 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? > Exactly. > 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. > Fair enough.