From patchwork Thu Nov 30 14:29:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13474463 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 C47DFC4167B for ; Thu, 30 Nov 2023 14:31:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.644745.1006173 (Exim 4.92) (envelope-from ) id 1r8i4C-0004d8-Aj; Thu, 30 Nov 2023 14:31:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 644745.1006173; Thu, 30 Nov 2023 14:31:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4C-0004c2-6O; Thu, 30 Nov 2023 14:31:00 +0000 Received: by outflank-mailman (input) for mailman id 644745; Thu, 30 Nov 2023 14:30:59 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4B-0004Xw-Hf for xen-devel@lists.xenproject.org; Thu, 30 Nov 2023 14:30:59 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1390815a-8f8d-11ee-9b0f-b553b5be7939; Thu, 30 Nov 2023 15:30:58 +0100 (CET) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50bc7706520so1480969e87.3 for ; Thu, 30 Nov 2023 06:30:58 -0800 (PST) Received: from localhost ([213.195.113.99]) by smtp.gmail.com with ESMTPSA id m40-20020a05600c3b2800b004042dbb8925sm5931131wms.38.2023.11.30.06.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:30:56 -0800 (PST) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1390815a-8f8d-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1701354657; x=1701959457; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=us5MRK85UaF1YkoiOqLuWe1/EFiuRH9wxTjWYuva1v4=; b=nfdtOu6K2LPFfMV9mQs5GKbUkMMYvSDa+qR0LQH5eL7+URjLnBx9aMnWtdgCFubDhI /k2EhDVE4Zq8wyDbaTlXVtMcvbkUK4JkY3PBeCyg1b9QHX+Eejkl2/6YOMh+ewzycobL 80VOxIMiujx9jN+EpVl543cUs1gn3rqE2CMaQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354657; x=1701959457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=us5MRK85UaF1YkoiOqLuWe1/EFiuRH9wxTjWYuva1v4=; b=oqq0Y/C/TznlN0mDvRqv0mT4PLQduiPyA0StIUdLmItLkrz6+QKV3Odgl3NR3nRhMD pmG/ZpLkA8jqIDzL5/zJnZhSV5xH3oRfSwl26KlPRoELzZlHShJOAl3HBnjMawlfTseZ P5wnviKl1O8od2mVQHi4rnWI6aW3Y67JJ5rmh2/fG2nd/p7vKSI1Ymj1TYz/qV/RpTDg DRef976HrEPl6GqRnrNXditL/dpZUNaWDhEDN3oTnlTXDDSqT9E5jq1VdoSzqe0MpUp5 DjWxpfjmB6kUCe88uk9y6pa+l3wNTdPdr6g/aynxpfHSsDc7udKziYzKJb4WcgsONI6N Uwrw== X-Gm-Message-State: AOJu0YyFOMCEqmZHcXEFp4/tA2XJ7zbMo6nI/IxdXwl9U4dqpixsuHk+ P5CUuRnjpflfbbZP+qBbJkS3hKyUNNqhg6bJrMw= X-Google-Smtp-Source: AGHT+IHX9mQXwQI70TCAgfsOvIZgxCkfzZx6FLSpP6X1ZlxZNCNPhwvqTzRoHRynHEITwxTynST/4w== X-Received: by 2002:a2e:a175:0:b0:2c9:bb85:8d45 with SMTP id u21-20020a2ea175000000b002c9bb858d45mr4586305ljl.25.1701354656993; Thu, 30 Nov 2023 06:30:56 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH 1/5] xen/livepatch: register livepatch regions when loaded Date: Thu, 30 Nov 2023 15:29:40 +0100 Message-ID: <20231130142944.46322-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130142944.46322-1-roger.pau@citrix.com> References: <20231130142944.46322-1-roger.pau@citrix.com> MIME-Version: 1.0 Currently livepatch regions are registered as virtual regions only after the livepatch has been applied. This can lead to issues when using the pre-apply or post-revert hooks, as at the point the livepatch is not in the virtual regions list. If a livepatch pre-apply hook contains a WARN() it would trigger an hypervisor crash, as the code to handle the bug frame won't be able to find the instruction pointer that triggered the #UD in any of the registered virtual regions, and hence crash. Fix this by adding the livepatch payloads as virtual regions as soon as loaded, and only remove them once the payload is unloaded. This requires some changes to the virtual regions code, as the removal of the virtual regions is no longer done in stop machine context, and hence an RCU barrier is added in order to make sure there are no users of the virtual region after it's been removed from the list. Fixes: 8313c864fa95 ('livepatch: Implement pre-|post- apply|revert hooks') Signed-off-by: Roger Pau Monné --- xen/common/livepatch.c | 5 +++-- xen/common/virtual_region.c | 40 +++++++++++-------------------------- 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 1209fea2566c..3199432f11f5 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -942,6 +942,8 @@ static int prepare_payload(struct payload *payload, } } + register_virtual_region(region); + return 0; } @@ -1071,6 +1073,7 @@ static int build_symbol_table(struct payload *payload, static void free_payload(struct payload *data) { ASSERT(spin_is_locked(&payload_lock)); + unregister_virtual_region(&data->region); list_del(&data->list); payload_cnt--; payload_version++; @@ -1386,7 +1389,6 @@ static inline void apply_payload_tail(struct payload *data) * The applied_list is iterated by the trap code. */ list_add_tail_rcu(&data->applied_list, &applied_list); - register_virtual_region(&data->region); data->state = LIVEPATCH_STATE_APPLIED; } @@ -1432,7 +1434,6 @@ static inline void revert_payload_tail(struct payload *data) * The applied_list is iterated by the trap code. */ list_del_rcu(&data->applied_list); - unregister_virtual_region(&data->region); data->reverted = true; data->state = LIVEPATCH_STATE_CHECKED; diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c index 5f89703f513b..b444253848cf 100644 --- a/xen/common/virtual_region.c +++ b/xen/common/virtual_region.c @@ -23,14 +23,8 @@ static struct virtual_region core_init __initdata = { }; /* - * RCU locking. Additions are done either at startup (when there is only - * one CPU) or when all CPUs are running without IRQs. - * - * Deletions are bit tricky. We do it when Live Patch (all CPUs running - * without IRQs) or during bootup (when clearing the init). - * - * Hence we use list_del_rcu (which sports an memory fence) and a spinlock - * on deletion. + * RCU locking. Modifications to the list must be done in exclusive mode, and + * hence need to hold the spinlock. * * All readers of virtual_region_list MUST use list_for_each_entry_rcu. */ @@ -58,38 +52,28 @@ const struct virtual_region *find_text_region(unsigned long addr) void register_virtual_region(struct virtual_region *r) { - ASSERT(!local_irq_is_enabled()); + unsigned long flags; + spin_lock_irqsave(&virtual_region_lock, flags); list_add_tail_rcu(&r->list, &virtual_region_list); + spin_unlock_irqrestore(&virtual_region_lock, flags); } static void remove_virtual_region(struct virtual_region *r) { - unsigned long flags; + unsigned long flags; - spin_lock_irqsave(&virtual_region_lock, flags); - list_del_rcu(&r->list); - spin_unlock_irqrestore(&virtual_region_lock, flags); - /* - * We do not need to invoke call_rcu. - * - * This is due to the fact that on the deletion we have made sure - * to use spinlocks (to guard against somebody else calling - * unregister_virtual_region) and list_deletion spiced with - * memory barrier. - * - * That protects us from corrupting the list as the readers all - * use list_for_each_entry_rcu which is safe against concurrent - * deletions. - */ + spin_lock_irqsave(&virtual_region_lock, flags); + list_del_rcu(&r->list); + spin_unlock_irqrestore(&virtual_region_lock, flags); } void unregister_virtual_region(struct virtual_region *r) { - /* Expected to be called from Live Patch - which has IRQs disabled. */ - ASSERT(!local_irq_is_enabled()); - remove_virtual_region(r); + + /* Assert that no CPU might be using the removed region. */ + rcu_barrier(); } #if defined(CONFIG_LIVEPATCH) && defined(CONFIG_X86) From patchwork Thu Nov 30 14:29:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13474468 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 89C25C10DAA for ; Thu, 30 Nov 2023 14:31:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.644746.1006179 (Exim 4.92) (envelope-from ) id 1r8i4C-0004kC-Jc; Thu, 30 Nov 2023 14:31:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 644746.1006179; Thu, 30 Nov 2023 14:31:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4C-0004go-Ex; Thu, 30 Nov 2023 14:31:00 +0000 Received: by outflank-mailman (input) for mailman id 644746; Thu, 30 Nov 2023 14:30:59 +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 1r8i4B-0004ZQ-Kg for xen-devel@lists.xenproject.org; Thu, 30 Nov 2023 14:30:59 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1427b2f2-8f8d-11ee-98e4-6d05b1d4d9a1; Thu, 30 Nov 2023 15:30:58 +0100 (CET) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2c9b8aa4fc7so13200381fa.1 for ; Thu, 30 Nov 2023 06:30:58 -0800 (PST) Received: from localhost ([213.195.113.99]) by smtp.gmail.com with ESMTPSA id l6-20020a05600c4f0600b0040b3829eb50sm2147422wmq.20.2023.11.30.06.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:30:57 -0800 (PST) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1427b2f2-8f8d-11ee-98e4-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1701354658; x=1701959458; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fQRBfy8mxD2fxhjluFNHS4DopwBarTdVQ7BkPng8IXA=; b=fLpvoDYL2GeqVCJfPWD6BV5HubfDTFZ/eX1e5FI51hjWxrOjcy2IQ7d4Xr7twO75uv Rm69GXTpdgTT9r5WgCpDUBjGWTiva5FzhuK5+BK39kuLzpTdxb81rCq4JxKg37SsmpRp eUCrJamRlYPzcMaTuwvVxq5rwGfTWQQScYmcs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354658; x=1701959458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fQRBfy8mxD2fxhjluFNHS4DopwBarTdVQ7BkPng8IXA=; b=p5qHIeZZaY1zY1sS+HnF/xROFwxwMVcFQZnI8EJaheMdTYJZSDw4y2rjp6HSfmpgFh hGJKcKSx4zgr6B+E327QFRwBiT4T9HQSuZDJBDNZ2wKZC+lB2+1tFtIm19t1z1OXm9tA DkRvwSbZJ0d/vNVIcK3AwXwDFVAm9tvQM6XrLYzaf77pW69GvyXxKM8oZm8bqYrWIj8M MU7dXutkWLMia6wBCEFStS4iENjJQBstWjp38eOhXkZegdcNJekYLzWd6TpwN9yiTL1y bQ757U9PtpTF5mrnYC/f53J0RC7pk9Wn7zGBhuanFBNiWrXxwEXGa8Nw15bUjxaZp8r7 Hl/w== X-Gm-Message-State: AOJu0Yxu0D2O1qte+3d9iIuYLAsm0cC6XluhnghSOXRfTjpqh5D3tvMY CQkw7mhJ9WBOsloIkBMB23m3L7reJcBmWH4pAZ8= X-Google-Smtp-Source: AGHT+IHE30j/1wq34RhYhglOCCZK2jwlEJyT0jRNofnQ19p5C9uTjAO/znofEM90kRWHMPbDis9o0w== X-Received: by 2002:a2e:7804:0:b0:2c9:af4f:4ca9 with SMTP id t4-20020a2e7804000000b002c9af4f4ca9mr6677816ljc.13.1701354657965; Thu, 30 Nov 2023 06:30:57 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH 2/5] xen/livepatch: search for symbols in all loaded payloads Date: Thu, 30 Nov 2023 15:29:41 +0100 Message-ID: <20231130142944.46322-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130142944.46322-1-roger.pau@citrix.com> References: <20231130142944.46322-1-roger.pau@citrix.com> MIME-Version: 1.0 When checking if an address belongs to a patch, or when resolving a symbol, take into account all loaded livepatch payloads, even if not applied. This is required in order for the pre-apply and post-revert hooks to work properly, or else Xen won't detect the intruction pointer belonging to those hooks as being part of the currently active text. Move the RCU handling to be used for payload_list instead of applied_list, as now the calls from trap code will iterate over the payload_list. Fixes: 8313c864fa95 ('livepatch: Implement pre-|post- apply|revert hooks') Signed-off-by: Roger Pau Monné Reviewed-by: Ross Lagerwall --- xen/common/livepatch.c | 49 +++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 3199432f11f5..4e775be66571 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -36,13 +36,14 @@ * caller in schedule_work. */ static DEFINE_SPINLOCK(payload_lock); -static LIST_HEAD(payload_list); - /* - * Patches which have been applied. Need RCU in case we crash (and then - * traps code would iterate via applied_list) when adding entries on the list. + * Need RCU in case we crash (and then traps code would iterate via + * payload_list) when adding entries on the list. */ -static DEFINE_RCU_READ_LOCK(rcu_applied_lock); +static DEFINE_RCU_READ_LOCK(rcu_payload_lock); +static LIST_HEAD(payload_list); + +/* Patches which have been applied. Only modified from stop machine context. */ static LIST_HEAD(applied_list); static unsigned int payload_cnt; @@ -111,12 +112,8 @@ bool is_patch(const void *ptr) const struct payload *data; bool r = false; - /* - * Only RCU locking since this list is only ever changed during apply - * or revert context. And in case it dies there we need an safe list. - */ - rcu_read_lock(&rcu_applied_lock); - list_for_each_entry_rcu ( data, &applied_list, applied_list ) + rcu_read_lock(&rcu_payload_lock); + list_for_each_entry_rcu ( data, &payload_list, list ) { if ( (ptr >= data->rw_addr && ptr < (data->rw_addr + data->rw_size)) || @@ -130,7 +127,7 @@ bool is_patch(const void *ptr) } } - rcu_read_unlock(&rcu_applied_lock); + rcu_read_unlock(&rcu_payload_lock); return r; } @@ -166,12 +163,8 @@ static const char *cf_check livepatch_symbols_lookup( const void *va = (const void *)addr; const char *n = NULL; - /* - * Only RCU locking since this list is only ever changed during apply - * or revert context. And in case it dies there we need an safe list. - */ - rcu_read_lock(&rcu_applied_lock); - list_for_each_entry_rcu ( data, &applied_list, applied_list ) + rcu_read_lock(&rcu_payload_lock); + list_for_each_entry_rcu ( data, &payload_list, list ) { if ( va < data->text_addr || va >= (data->text_addr + data->text_size) ) @@ -200,7 +193,7 @@ static const char *cf_check livepatch_symbols_lookup( n = data->symtab[best].name; break; } - rcu_read_unlock(&rcu_applied_lock); + rcu_read_unlock(&rcu_payload_lock); return n; } @@ -1074,7 +1067,8 @@ static void free_payload(struct payload *data) { ASSERT(spin_is_locked(&payload_lock)); unregister_virtual_region(&data->region); - list_del(&data->list); + list_del_rcu(&data->list); + rcu_barrier(); payload_cnt--; payload_version++; free_payload_data(data); @@ -1173,7 +1167,7 @@ static int livepatch_upload(struct xen_sysctl_livepatch_upload *upload) INIT_LIST_HEAD(&data->list); INIT_LIST_HEAD(&data->applied_list); - list_add_tail(&data->list, &payload_list); + list_add_tail_rcu(&data->list, &payload_list); payload_cnt++; payload_version++; } @@ -1384,11 +1378,7 @@ static int apply_payload(struct payload *data) static inline void apply_payload_tail(struct payload *data) { - /* - * We need RCU variant (which has barriers) in case we crash here. - * The applied_list is iterated by the trap code. - */ - list_add_tail_rcu(&data->applied_list, &applied_list); + list_add_tail(&data->applied_list, &applied_list); data->state = LIVEPATCH_STATE_APPLIED; } @@ -1428,12 +1418,7 @@ static int revert_payload(struct payload *data) static inline void revert_payload_tail(struct payload *data) { - - /* - * We need RCU variant (which has barriers) in case we crash here. - * The applied_list is iterated by the trap code. - */ - list_del_rcu(&data->applied_list); + list_del(&data->applied_list); data->reverted = true; data->state = LIVEPATCH_STATE_CHECKED; From patchwork Thu Nov 30 14:29:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13474465 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 0D857C4167B for ; Thu, 30 Nov 2023 14:31:20 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.644747.1006198 (Exim 4.92) (envelope-from ) id 1r8i4E-0005J5-St; Thu, 30 Nov 2023 14:31:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 644747.1006198; Thu, 30 Nov 2023 14:31:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4E-0005Iw-Ph; Thu, 30 Nov 2023 14:31:02 +0000 Received: by outflank-mailman (input) for mailman id 644747; Thu, 30 Nov 2023 14:31:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4D-0004Xw-T7 for xen-devel@lists.xenproject.org; Thu, 30 Nov 2023 14:31:01 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 15128e0c-8f8d-11ee-9b0f-b553b5be7939; Thu, 30 Nov 2023 15:31:00 +0100 (CET) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40b27b498c3so9579515e9.0 for ; Thu, 30 Nov 2023 06:31:00 -0800 (PST) Received: from localhost ([213.195.113.99]) by smtp.gmail.com with ESMTPSA id bg36-20020a05600c3ca400b003fe1fe56202sm2226753wmb.33.2023.11.30.06.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:30:58 -0800 (PST) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 15128e0c-8f8d-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1701354659; x=1701959459; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CUZtNykyKvrHHFaeVoASWNDGSUHrb0gwHyinLU+xjEQ=; b=XTFQUqEnHUxUKHXVzlorajYqYBpDdkveaZSWLJeQwUSzyrVDqxHDVVmFlfZtGIkp7m gqn0ovNu+2Ss6rIE+GnosGlqVqW7c2AecTeiorqJWuvvJHUMpg2/cArFLMHJoHbV1uJm xmQJhHyrhluGCv3W3A9YetlT5kY6TACnyNSe4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354659; x=1701959459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CUZtNykyKvrHHFaeVoASWNDGSUHrb0gwHyinLU+xjEQ=; b=CUf4tbD82JbFHadRdg2IT0LyWBeB/hRscC4Auqp6xhaYgMz4z03zOW/raLRr9GDkXX fUq2QJxCB0IA4v1aBlpREHAfRxRizxsW6XM+YfFX9+rWcHRqVnM+47NNts04cJIQQH6q vqFE3tqCc2sl5T9tqaIany3XB3JpG/gg2BaGLVjPMQ58clzJtKDPkInkUOsy29poQ9Ru o1wyV4cj6mROcmJbBj15EHnoNVN9pa0wCSd2rT83vH052LOU2MebmhfL7GpTUQ4xUX1j ZcO1BRT6g0bAr4nSyT2XiMo68+oRGiZ/TrUqwre7GHHoFNJf4BEtQewfuYxXVej8uQ7Q OUqg== X-Gm-Message-State: AOJu0YyTW0lGRoOAA6Yu1v8i7mp++XMR0nv3xmcMnlmz9WP4BlW3kGuy uiLgKNZ+DC3U+Zuw8a8QJ5dEKOhIrabHPkzdovs= X-Google-Smtp-Source: AGHT+IGAVFqkVLj5bVZ4+QcNWWYXd2BLQa0cqBXLGFoth88i5xyK5H6M1+aGiy8iRj2AyeI5qo4C9Q== X-Received: by 2002:a05:600c:354e:b0:40b:51c2:6910 with SMTP id i14-20020a05600c354e00b0040b51c26910mr4366825wmq.29.1701354658965; Thu, 30 Nov 2023 06:30:58 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH 3/5] xen/livepatch: fix norevert test attempt to open-code revert Date: Thu, 30 Nov 2023 15:29:42 +0100 Message-ID: <20231130142944.46322-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130142944.46322-1-roger.pau@citrix.com> References: <20231130142944.46322-1-roger.pau@citrix.com> MIME-Version: 1.0 The purpose of the norevert test is to install a dummy handler that replaces the internal Xen revert code, and then perform the revert in the post-revert hook. For that purpose the usage of the previous common_livepatch_revert() is not enough, as that just reverts specific functions, but not the whole state of the payload. Remove both common_livepatch_{apply,revert}() and instead expose revert_payload{,_tail}() in order to perform the patch revert from the post-revert hook. Fixes: 6047104c3ccc ('livepatch: Add per-function applied/reverted state tracking marker') Signed-off-by: Roger Pau Monné --- xen/common/livepatch.c | 41 +++++++++++++++++-- xen/include/xen/livepatch.h | 32 ++------------- .../livepatch/xen_action_hooks_norevert.c | 22 +++------- 3 files changed, 46 insertions(+), 49 deletions(-) diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c index 4e775be66571..d81f3d11d655 100644 --- a/xen/common/livepatch.c +++ b/xen/common/livepatch.c @@ -1367,7 +1367,22 @@ static int apply_payload(struct payload *data) ASSERT(!local_irq_is_enabled()); for ( i = 0; i < data->nfuncs; i++ ) - common_livepatch_apply(&data->funcs[i], &data->fstate[i]); + { + const struct livepatch_func *func = &data->funcs[i]; + struct livepatch_fstate *state = &data->fstate[i]; + + /* If the action has been already executed on this function, do nothing. */ + if ( state->applied == LIVEPATCH_FUNC_APPLIED ) + { + printk(XENLOG_WARNING LIVEPATCH + "%s: %s has been already applied before\n", + __func__, func->name); + continue; + } + + arch_livepatch_apply(func, state); + state->applied = LIVEPATCH_FUNC_APPLIED; + } arch_livepatch_revive(); @@ -1383,7 +1398,7 @@ static inline void apply_payload_tail(struct payload *data) data->state = LIVEPATCH_STATE_APPLIED; } -static int revert_payload(struct payload *data) +int revert_payload(struct payload *data) { unsigned int i; int rc; @@ -1398,7 +1413,25 @@ static int revert_payload(struct payload *data) } for ( i = 0; i < data->nfuncs; i++ ) - common_livepatch_revert(&data->funcs[i], &data->fstate[i]); + { + const struct livepatch_func *func = &data->funcs[i]; + struct livepatch_fstate *state = &data->fstate[i]; + + /* + * If the apply action hasn't been executed on this function, do + * nothing. + */ + if ( !func->old_addr || state->applied == LIVEPATCH_FUNC_NOT_APPLIED ) + { + printk(XENLOG_WARNING LIVEPATCH + "%s: %s has not been applied before\n", + __func__, func->name); + continue; + } + + arch_livepatch_revert(func, state); + state->applied = LIVEPATCH_FUNC_NOT_APPLIED; + } /* * Since we are running with IRQs disabled and the hooks may call common @@ -1416,7 +1449,7 @@ static int revert_payload(struct payload *data) return 0; } -static inline void revert_payload_tail(struct payload *data) +void revert_payload_tail(struct payload *data) { list_del(&data->applied_list); diff --git a/xen/include/xen/livepatch.h b/xen/include/xen/livepatch.h index df339a134e40..9da8b6939878 100644 --- a/xen/include/xen/livepatch.h +++ b/xen/include/xen/livepatch.h @@ -136,35 +136,11 @@ void arch_livepatch_post_action(void); void arch_livepatch_mask(void); void arch_livepatch_unmask(void); -static inline void common_livepatch_apply(const struct livepatch_func *func, - struct livepatch_fstate *state) -{ - /* If the action has been already executed on this function, do nothing. */ - if ( state->applied == LIVEPATCH_FUNC_APPLIED ) - { - printk(XENLOG_WARNING LIVEPATCH "%s: %s has been already applied before\n", - __func__, func->name); - return; - } - - arch_livepatch_apply(func, state); - state->applied = LIVEPATCH_FUNC_APPLIED; -} +/* Only for testing purposes. */ +struct payload; +int revert_payload(struct payload *data); +void revert_payload_tail(struct payload *data); -static inline void common_livepatch_revert(const struct livepatch_func *func, - struct livepatch_fstate *state) -{ - /* If the apply action hasn't been executed on this function, do nothing. */ - if ( !func->old_addr || state->applied == LIVEPATCH_FUNC_NOT_APPLIED ) - { - printk(XENLOG_WARNING LIVEPATCH "%s: %s has not been applied before\n", - __func__, func->name); - return; - } - - arch_livepatch_revert(func, state); - state->applied = LIVEPATCH_FUNC_NOT_APPLIED; -} #else /* diff --git a/xen/test/livepatch/xen_action_hooks_norevert.c b/xen/test/livepatch/xen_action_hooks_norevert.c index 3e21ade6abfc..074f8e1d56ce 100644 --- a/xen/test/livepatch/xen_action_hooks_norevert.c +++ b/xen/test/livepatch/xen_action_hooks_norevert.c @@ -96,26 +96,14 @@ static int revert_hook(livepatch_payload_t *payload) static void post_revert_hook(livepatch_payload_t *payload) { - int i; + unsigned long flags; printk(KERN_DEBUG "%s: Hook starting.\n", __func__); - for (i = 0; i < payload->nfuncs; i++) - { - const struct livepatch_func *func = &payload->funcs[i]; - struct livepatch_fstate *fstate = &payload->fstate[i]; - - BUG_ON(revert_cnt != 1); - BUG_ON(fstate->applied != LIVEPATCH_FUNC_APPLIED); - - /* Outside of quiesce zone: MAY TRIGGER HOST CRASH/UNDEFINED BEHAVIOR */ - arch_livepatch_quiesce(); - common_livepatch_revert(payload); - arch_livepatch_revive(); - BUG_ON(fstate->applied == LIVEPATCH_FUNC_APPLIED); - - printk(KERN_DEBUG "%s: post reverted: %s\n", __func__, func->name); - } + local_irq_save(flags); + revert_payload(payload); + revert_payload_tail(payload); + local_irq_restore(flags); printk(KERN_DEBUG "%s: Hook done.\n", __func__); } From patchwork Thu Nov 30 14:29:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13474464 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 C8598C10DAA for ; Thu, 30 Nov 2023 14:31:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.644749.1006213 (Exim 4.92) (envelope-from ) id 1r8i4H-0005em-Kd; Thu, 30 Nov 2023 14:31:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 644749.1006213; Thu, 30 Nov 2023 14:31:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4H-0005dy-EG; Thu, 30 Nov 2023 14:31:05 +0000 Received: by outflank-mailman (input) for mailman id 644749; Thu, 30 Nov 2023 14:31:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4F-0004Xw-Pj for xen-devel@lists.xenproject.org; Thu, 30 Nov 2023 14:31:03 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1649b7e4-8f8d-11ee-9b0f-b553b5be7939; Thu, 30 Nov 2023 15:31:02 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40b2ad4953cso13322635e9.0 for ; Thu, 30 Nov 2023 06:31:02 -0800 (PST) Received: from localhost ([213.195.113.99]) by smtp.gmail.com with ESMTPSA id bg28-20020a05600c3c9c00b00405718cbeadsm1482913wmb.1.2023.11.30.06.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:30:59 -0800 (PST) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1649b7e4-8f8d-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1701354661; x=1701959461; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AnrYiuXdzp9zPzX6PeTg0GoA8oRf3Fko4S7XBz0W3tM=; b=TnUAVvWjbMtnk40/CgFjq0pxdPH8/BTNfKqTyN2aWuvKY/K5rHOqh9ceVt6HDgYQZ5 X1cUcqQYyuRGhNZNKvr+Lj1awKhmASiAg6XDL1h3M/q3+qsL9xNuiEN+lrQ/4+dM9CDa oZawnSAcl2nEdvptLvZE7cEZtnuIFJZCLOSOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354661; x=1701959461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AnrYiuXdzp9zPzX6PeTg0GoA8oRf3Fko4S7XBz0W3tM=; b=q9XKRyF6UZmSwgH8+xTVev+bnJ2s0IZh2YNzH3ahJSuyZ6lYYFiJ4Ezf19AXwexjKW fbLHDOd8yyPFMoBdb7DK32DmdQd+HTts3pH2zjfTvqHftKFDzYXKnJgjehOG9SnxHe32 5vs+azzTlf9oDYMP9LgC9F6sluVf4GdgE5gYZXw/nSlzGT7r6AD5J5pEbmK5GDxtZUIB NIdQP4lPg9uuilRkS3S7UkEs7zjbMoh1+6H94G2iyhraoeb7MjbA9Spus3D27uZ4DmEy eY6rpImxBCEiPabzZtSqbU7468CzXlBNGTOkg7geJZFzXQRF86VyXLZCotgvG1nyBWqq b2Tg== X-Gm-Message-State: AOJu0Yy5Lm5B9FIc5VF0+eWVfk+QicQDmLvMQTYugs7F4yENo5aucMqF nkXUf/kCFVVYsy1w4M53FS9nB9rs8kGNZHbIeKQ= X-Google-Smtp-Source: AGHT+IHSqHoWGMyyFhY4dd88FAFJqw51AoRcIA8ADJNGbUx7FEI1BOjSuGkCimy+AFGNLtTICL1n8g== X-Received: by 2002:a05:600c:3550:b0:40b:4072:54de with SMTP id i16-20020a05600c355000b0040b407254demr13196172wmq.13.1701354660293; Thu, 30 Nov 2023 06:31:00 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH 4/5] xen/livepatch: fix norevert test hook setup typo Date: Thu, 30 Nov 2023 15:29:43 +0100 Message-ID: <20231130142944.46322-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130142944.46322-1-roger.pau@citrix.com> References: <20231130142944.46322-1-roger.pau@citrix.com> MIME-Version: 1.0 The test code has a typo in using LIVEPATCH_APPLY_HOOK() instead of LIVEPATCH_REVERT_HOOK(). Fixes: 6047104c3ccc ('livepatch: Add per-function applied/reverted state tracking marker') Signed-off-by: Roger Pau Monné Reviewed-by: Ross Lagerwall --- xen/test/livepatch/xen_action_hooks_norevert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/test/livepatch/xen_action_hooks_norevert.c b/xen/test/livepatch/xen_action_hooks_norevert.c index 074f8e1d56ce..cdfff156cede 100644 --- a/xen/test/livepatch/xen_action_hooks_norevert.c +++ b/xen/test/livepatch/xen_action_hooks_norevert.c @@ -108,7 +108,7 @@ static void post_revert_hook(livepatch_payload_t *payload) printk(KERN_DEBUG "%s: Hook done.\n", __func__); } -LIVEPATCH_APPLY_HOOK(revert_hook); +LIVEPATCH_REVERT_HOOK(revert_hook); LIVEPATCH_PREAPPLY_HOOK(pre_apply_hook); LIVEPATCH_POSTAPPLY_HOOK(post_apply_hook); From patchwork Thu Nov 30 14:29:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 13474466 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 67AACC4167B for ; Thu, 30 Nov 2023 14:31:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.644748.1006208 (Exim 4.92) (envelope-from ) id 1r8i4H-0005bd-AC; Thu, 30 Nov 2023 14:31:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 644748.1006208; Thu, 30 Nov 2023 14:31:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r8i4H-0005bW-6W; Thu, 30 Nov 2023 14:31:05 +0000 Received: by outflank-mailman (input) for mailman id 644748; Thu, 30 Nov 2023 14:31:03 +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 1r8i4F-0004ZQ-1o for xen-devel@lists.xenproject.org; Thu, 30 Nov 2023 14:31:03 +0000 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [2a00:1450:4864:20::431]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 16677a52-8f8d-11ee-98e4-6d05b1d4d9a1; Thu, 30 Nov 2023 15:31:02 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-332ed02ccd9so679754f8f.0 for ; Thu, 30 Nov 2023 06:31:02 -0800 (PST) Received: from localhost ([213.195.113.99]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b00327b5ca093dsm1673593wrm.117.2023.11.30.06.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:31:01 -0800 (PST) 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 Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 16677a52-8f8d-11ee-98e4-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1701354661; x=1701959461; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=itD9aYJVZiQmj7BEzrk6sR1Ahs79xsAwrmOZilzma4o=; b=YK/6MP/o6zCpa2ZcakEhlFN/zNVyoYa0fSvvmGfKgIJs3+goZaPgRo5atLmjAyufFo 0NyKJ8hMlONKP+1pRT9XyEIdu7rOLZKdFOAosIu4+zhRCUHam6iMcYaXCRU8fSQWQq1W o4cokhEQ/InG9ddPxJrU6dEv3YjX2/lI2+yAw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701354661; x=1701959461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=itD9aYJVZiQmj7BEzrk6sR1Ahs79xsAwrmOZilzma4o=; b=l4HxwOmmYv/px2HYpzduSadbtZhHdk3ZHeK9zkBkXrt/2JDXueUDxa2IjQQB20ZrOG LaTi29v2RYeHEZYDjoFU2S159KGob6smiCYwE75XBvK/EBF+XHA+hfqsvKTuru9gAzwO 6jwxjXBXH+SQOTEOvBzK74QkI4MCuG8sHyn91yuZFMmUdTRu4Dy57mJz8ZCKyBger1sT dMuO0hjYMHR7+NAv3q6bKyTCoP5oxWbLz4syY8dr3RYaXn9OfkPAFFVbozy7crQcA4Ni oS89cBoqgDp+a60HgvlerehzUVLhN/qTP/goUJrI9b+SwrtjBmkeFp4YjXuDvRNpcBtQ B0AA== X-Gm-Message-State: AOJu0Yy8zBR9Mm7XLtGSpt8hqelqcKIO3j2b43y4/z+yQV2uWz9O6Hzg YsReq2jOozBbJTbw3nw7hC2hDDPbr+SFeWo8G/g= X-Google-Smtp-Source: AGHT+IHgwHhQ/n+cUe7PQsDuJSfWpr81r0/7KpbRdw1/ChIpwgV2QO6OkX+Gd5x4Zbrhdyew0wcZHA== X-Received: by 2002:a5d:624f:0:b0:333:57:9552 with SMTP id m15-20020a5d624f000000b0033300579552mr8512025wrv.63.1701354661350; Thu, 30 Nov 2023 06:31:01 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Konrad Rzeszutek Wilk , Ross Lagerwall Subject: [PATCH 5/5] xen/livepatch: properly build the noapply and norevert tests Date: Thu, 30 Nov 2023 15:29:44 +0100 Message-ID: <20231130142944.46322-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130142944.46322-1-roger.pau@citrix.com> References: <20231130142944.46322-1-roger.pau@citrix.com> MIME-Version: 1.0 It seems the build variables for those tests where copy-pasted from xen_action_hooks_marker-objs and not adjusted to use the correct source files. Fixes: 6047104c3ccc ('livepatch: Add per-function applied/reverted state tracking marker') Signed-off-by: Roger Pau Monné Reviewed-by: Ross Lagerwall --- xen/test/livepatch/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile index c258ab0b5940..d987a8367f15 100644 --- a/xen/test/livepatch/Makefile +++ b/xen/test/livepatch/Makefile @@ -118,12 +118,12 @@ xen_action_hooks_marker-objs := xen_action_hooks_marker.o xen_hello_world_func.o $(obj)/xen_action_hooks_noapply.o: $(obj)/config.h extra-y += xen_action_hooks_noapply.livepatch -xen_action_hooks_noapply-objs := xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o +xen_action_hooks_noapply-objs := xen_action_hooks_noapply.o xen_hello_world_func.o note.o xen_note.o $(obj)/xen_action_hooks_norevert.o: $(obj)/config.h extra-y += xen_action_hooks_norevert.livepatch -xen_action_hooks_norevert-objs := xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o +xen_action_hooks_norevert-objs := xen_action_hooks_norevert.o xen_hello_world_func.o note.o xen_note.o EXPECT_BYTES_COUNT := 8 CODE_GET_EXPECT=$(shell $(OBJDUMP) -d --insn-width=1 $(1) | sed -n -e '/<'$(2)'>:$$/,/^$$/ p' | tail -n +2 | head -n $(EXPECT_BYTES_COUNT) | awk '{$$0=$$2; printf "%s", substr($$0,length-1)}' | sed 's/.\{2\}/0x&,/g' | sed 's/^/{/;s/,$$/}/g')