From patchwork Mon Mar 7 11:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Doebel, Bjoern" X-Patchwork-Id: 12771624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80327C433EF for ; Mon, 7 Mar 2022 11:54:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.285880.485175 (Exim 4.92) (envelope-from ) id 1nRBwV-0004sM-Fi; Mon, 07 Mar 2022 11:54:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 285880.485175; Mon, 07 Mar 2022 11:54:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRBwV-0004s9-Cb; Mon, 07 Mar 2022 11:54:23 +0000 Received: by outflank-mailman (input) for mailman id 285880; Mon, 07 Mar 2022 11:54:21 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRBwT-0004Lv-Mp for xen-devel@lists.xenproject.org; Mon, 07 Mar 2022 11:54:21 +0000 Received: from smtp-fw-9102.amazon.com (smtp-fw-9102.amazon.com [207.171.184.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 51be7f8e-9e0d-11ec-8eba-a37418f5ba1a; Mon, 07 Mar 2022 12:54:20 +0100 (CET) Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-iad-1e-7dac3c4d.us-east-1.amazon.com) ([10.25.36.214]) by smtp-border-fw-9102.sea19.amazon.com with ESMTP; 07 Mar 2022 11:54:03 +0000 Received: from EX13D03EUA003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1e-7dac3c4d.us-east-1.amazon.com (Postfix) with ESMTPS id 8653E99B13; Mon, 7 Mar 2022 11:54:01 +0000 (UTC) Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D03EUA003.ant.amazon.com (10.43.165.89) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Mon, 7 Mar 2022 11:54:00 +0000 Received: from dev-dsk-doebel-1c-c6d5f274.eu-west-1.amazon.com (10.13.240.106) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.28 via Frontend Transport; Mon, 7 Mar 2022 11:53:59 +0000 Received: by dev-dsk-doebel-1c-c6d5f274.eu-west-1.amazon.com (Postfix, from userid 3160037) id 61D514F5E; Mon, 7 Mar 2022 11:53:59 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Inumbo-ID: 51be7f8e-9e0d-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1646654061; x=1678190061; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7eEisiDKKSHw1++xLYtfPHKS3ymk9DBq2ioO+9jWrTY=; b=lBKIm+cqWi3PpCyDIQtJaz+qO0O1a9HOHrtyfifZwJFUryjFTwa1Qm2A 2SOjFDyOA6YHtfbxRfiTD/so6hXxfT1ZOkTWfLzXdUT5ZbKd9ASqzQExu SEWGbblXeL2cCZ3VQHKPEKGTaHJcMesca7zQfEahBLdjjcFfWuS3+PVrb U=; X-IronPort-AV: E=Sophos;i="5.90,162,1643673600"; d="scan'208";a="200034811" From: Bjoern Doebel To: CC: Michael Kurth , Martin Pohlack , Roger Pau Monne , Andrew Cooper , Bjoern Doebel , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH 1/2] Livepatch: resolve old address before function verification Date: Mon, 7 Mar 2022 11:53:52 +0000 Message-ID: <15b092bb3af6e32f72ee8fca45317687d23b8be4.1646653825.git.doebel@amazon.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk When verifying that a livepatch can be applied, we may as well want to inspect the target function to be patched. To do so, we need to resolve this function's address before running the arch-specific livepatch_verify hook. Signed-off-by: Bjoern Doebel CC: Konrad Rzeszutek Wilk CC: Ross Lagerwall Reviewed-by: Ross Lagerwall --- xen/common/livepatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index ec301a9f12..be2cf75c2d 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -684,11 +684,11 @@ static int prepare_payload(struct payload *payload, return -EINVAL; } - rc = arch_livepatch_verify_func(f); + rc = resolve_old_address(f, elf); if ( rc ) return rc; - rc = resolve_old_address(f, elf); + rc = arch_livepatch_verify_func(f); if ( rc ) return rc;