From patchwork Thu Nov 7 15:15:06 2024 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: 13866624 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 278DDD4336F for ; Thu, 7 Nov 2024 15:15:50 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.831983.1247361 (Exim 4.92) (envelope-from ) id 1t94EZ-0003pe-3g; Thu, 07 Nov 2024 15:15:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 831983.1247361; Thu, 07 Nov 2024 15:15:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t94EZ-0003pX-0G; Thu, 07 Nov 2024 15:15:43 +0000 Received: by outflank-mailman (input) for mailman id 831983; Thu, 07 Nov 2024 15:15:41 +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 1t94EW-0002r4-Up for xen-devel@lists.xenproject.org; Thu, 07 Nov 2024 15:15:40 +0000 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [2a00:1450:4864:20::235]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 244944b6-9d1b-11ef-99a3-01e77a169b0f; Thu, 07 Nov 2024 16:15:37 +0100 (CET) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2fb587d0436so11680141fa.2 for ; Thu, 07 Nov 2024 07:15:37 -0800 (PST) Received: from localhost ([213.195.124.162]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03b7f2b8sm897146a12.32.2024.11.07.07.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 07:15:35 -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: 244944b6-9d1b-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjoyMzUiLCJoZWxvIjoibWFpbC1sajEteDIzNS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjI0NDk0NGI2LTlkMWItMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwOTkyNTM3LjE2NTA2NSwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730992536; x=1731597336; 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=+wQGyOib1tQTUTkaoHf6X8ibGsUQOPP4unQmWIurJ8s=; b=RegTc60iWuBCbA054XGBNIj4WHyY0UaVvVSaeyzg6pcst/zDasNeeZ7zkNjSNDd87u nfYExE2YgksgIzUo4NyYJhKSDo5+1/1yzXPe1uo9ZcmfQzTDiKXY+MMkej8st12GVc/l kxR1S4Ep1MwE+naUM8EiavI5ztq7hVWexs3q4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730992536; x=1731597336; 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=+wQGyOib1tQTUTkaoHf6X8ibGsUQOPP4unQmWIurJ8s=; b=Qk2/XJHtOY6aY5Z6xPH8l/B/RdD6VTN7FMXevETE6De8Y+0UxXCdPhRXiMIptz4Ytw gBCS8jdd2CPAAWRIMad1QPcSE7eaJMutRUsg4H62lXXGBnIL8hxSY+ehJ1C5VRHTWhXW O9YOIu2Fk4y7asTeKdfU0S+oMhsyXy5sX2G7Aoe48Cg1RAyBEFIb2zkYOvKBIRE4diBh 9cTRvEmY/HIg/oJbOwepNc8PrsaCPNGKXzuJLynRMX2Dtf7Lg8TPSKRRXBFy+hXH2Qxn nw885Y6eGpbpE4iUrqZSW6IOX4mHhMvczImwwfkhrW5eUWR35t03M/2VVLXWOKT4s0OU LefA== X-Gm-Message-State: AOJu0Yxzt5vjm56AXXlgKCDaspjUUk9pZwwhcDVNDRkBRlALyskskTPu Wwl9xJWyHDNzWS0c8ZaqiPQq2YSuhDWgQioK8zP90C0DDs9Wc24JBa37VnCa+ns9tECMFvA6ZuE Q X-Google-Smtp-Source: AGHT+IFDvWRuY+wFU1pUnNG9Wy15ukLVuf8w4hxEiiOJfzS7M7ZxSt6woPtnTQFsyngilw7x3Q9Bqw== X-Received: by 2002:a05:651c:247:b0:2fa:ccae:d1d3 with SMTP id 38308e7fff4ca-2fedb7a218amr135454981fa.11.1730992536245; Thu, 07 Nov 2024 07:15:36 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Roger Pau Monne Subject: [PATCH 1/4] livepatch-build: allow patch file name sizes up to 127 characters Date: Thu, 7 Nov 2024 16:15:06 +0100 Message-ID: <20241107151509.73621-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241107151509.73621-1-roger.pau@citrix.com> References: <20241107151509.73621-1-roger.pau@citrix.com> MIME-Version: 1.0 XenServer uses quite long Xen version names, and encode such in the livepatch filename, and it's currently running out of space in the file name. Bump max filename size to 127, so it also matches the patch name length in the hypervisor interface. Note the size of the buffer is 128 characters, and the last one is reserved for the null terminator. Signed-off-by: Roger Pau Monné --- Changes since v1: - Take into account the null terminator. --- livepatch-build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/livepatch-build b/livepatch-build index 948b2acfc2f6..f3ca9399d149 100755 --- a/livepatch-build +++ b/livepatch-build @@ -72,8 +72,9 @@ function make_patch_name() fi # Only allow alphanumerics and '_' and '-' in the patch name. Everything - # else is replaced with '-'. Truncate to 48 chars. - echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c 1-48 + # else is replaced with '-'. Truncate to 127 chars + # (XEN_LIVEPATCH_NAME_SIZE - 1). + echo ${PATCHNAME//[^a-zA-Z0-9_-]/-} |cut -c -127 } # Do a full normal build From patchwork Thu Nov 7 15:15:07 2024 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: 13866625 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 7C39AD4336D for ; Thu, 7 Nov 2024 15:15:51 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.831986.1247371 (Exim 4.92) (envelope-from ) id 1t94Ea-00044b-Av; Thu, 07 Nov 2024 15:15:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 831986.1247371; Thu, 07 Nov 2024 15:15:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t94Ea-00044S-7U; Thu, 07 Nov 2024 15:15:44 +0000 Received: by outflank-mailman (input) for mailman id 831986; Thu, 07 Nov 2024 15:15:43 +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 1t94EZ-0002r4-E6 for xen-devel@lists.xenproject.org; Thu, 07 Nov 2024 15:15:43 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 262c7c07-9d1b-11ef-99a3-01e77a169b0f; Thu, 07 Nov 2024 16:15:40 +0100 (CET) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a9ed7d8c86cso182766766b.2 for ; Thu, 07 Nov 2024 07:15:40 -0800 (PST) Received: from localhost ([213.195.124.162]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9ee0dc577fsm105065666b.93.2024.11.07.07.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 07:15:38 -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: 262c7c07-9d1b-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MzAiLCJoZWxvIjoibWFpbC1lajEteDYzMC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjI2MmM3YzA3LTlkMWItMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwOTkyNTQwLjM1MDg4OCwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730992539; x=1731597339; 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=esNbhQqTrLxjjeO/Fjv64wjBfsHTSsTnJcFIKd2KO/E=; b=VMiUTWH+lh6tqfdVMEdob1F4dG4u1/b4hYWYHefBz5OMWR5fWZMiRNiM8QyTRpu7fB oOsKDsaYU27LtuVLOXaS3uVfDwuwSqVyBjP5f9htfw+wzDk9de9p63g+Y7uQCQHBzFfm JqDKfVFwNahxn/6UvD6SImIVpKIAh9xianLFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730992539; x=1731597339; 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=esNbhQqTrLxjjeO/Fjv64wjBfsHTSsTnJcFIKd2KO/E=; b=jlrzrTBa6XMUdGLXSsaTs2tFKUjo8u5/Jc+UAKWSWffwtDM4/v9N3S2aGhTUXpLBJQ qNfmGdVT/HGO8f4r6BmJddsTwRRwbDsdVTPCLT6bPtZLluW8tTOQA5t4+euTg2dypNhf u3piPtLsUHwCAQx8eLWormIXLzD313nOHjvkNIhSOWrDNcGrsPt1FfR1wJgNTMMUxUEA LkAkVU+ymza1vOlUtKARlkBdkajDnXt07kjnS6X8GDJnD1LbgmrtSH1aK3zqlJoqpO0r sNd+XIJxMZGp67IlbtaqOJv+p83C1UDEXTyiqoDzn1nexbtmiBJbC8GgjsDWF3lXc16o 8pvw== X-Gm-Message-State: AOJu0YwOQ/j5BNbRAIFrXUgqq/nUiMC1mFokBzkANMm3v0M1bCn8w8H4 6r60LAfn7hwE97gIP//dWJmssCSeFZze/xFPvlEoejzYuDlFuwwbdPS0OEEj+zSlO0udTpCPFnv 1 X-Google-Smtp-Source: AGHT+IFGGHxjWVRiTS9h+iQ0FBRCyQVa00MB3gGIgAdh3O6Ttgjh4FyWdGEZbf9AErzCWO2quu11jw== X-Received: by 2002:a17:907:ea6:b0:a9a:3ca0:d55a with SMTP id a640c23a62f3a-a9eeb51b547mr26028366b.57.1730992538574; Thu, 07 Nov 2024 07:15:38 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Roger Pau Monne Subject: [PATCH 2/4] create-diff-object: update default alt_instr size Date: Thu, 7 Nov 2024 16:15:07 +0100 Message-ID: <20241107151509.73621-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241107151509.73621-1-roger.pau@citrix.com> References: <20241107151509.73621-1-roger.pau@citrix.com> MIME-Version: 1.0 The size of the alt_instr structure in Xen is 14 instead of 12 bytes, adjust it. Signed-off-by: Roger Pau Monné --- create-diff-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-diff-object.c b/create-diff-object.c index fed360a9aa68..d8a2afbf2774 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1000,7 +1000,7 @@ static int altinstructions_group_size(struct kpatch_elf *kelf, int offset) char *str; if (!size) { str = getenv("ALT_STRUCT_SIZE"); - size = str ? atoi(str) : 12; + size = str ? atoi(str) : 14; } log_debug("altinstr_size=%d\n", size); From patchwork Thu Nov 7 15:15:08 2024 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: 13866626 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 993C6D4336F for ; Thu, 7 Nov 2024 15:15:52 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.831987.1247375 (Exim 4.92) (envelope-from ) id 1t94Ea-00046v-Li; Thu, 07 Nov 2024 15:15:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 831987.1247375; Thu, 07 Nov 2024 15:15:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t94Ea-00046M-Fl; Thu, 07 Nov 2024 15:15:44 +0000 Received: by outflank-mailman (input) for mailman id 831987; Thu, 07 Nov 2024 15:15:43 +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 1t94EZ-0002r4-PR for xen-devel@lists.xenproject.org; Thu, 07 Nov 2024 15:15:43 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 267592fd-9d1b-11ef-99a3-01e77a169b0f; Thu, 07 Nov 2024 16:15:40 +0100 (CET) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c9693dc739so1544972a12.3 for ; Thu, 07 Nov 2024 07:15:40 -0800 (PST) Received: from localhost ([213.195.124.162]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf03b7f680sm892182a12.35.2024.11.07.07.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 07:15:39 -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: 267592fd-9d1b-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MmIiLCJoZWxvIjoibWFpbC1lZDEteDUyYi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjI2NzU5MmZkLTlkMWItMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwOTkyNTQwLjgzMzg4Mywic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730992540; x=1731597340; 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=isWwW9X0NWcagZExhydjq1zaUhOWH5R4bKfYKSQjzPQ=; b=cwBXLG9/4LpTjizgBSX3Bc4xCDELIeke9QnzusbXcEhLh3xCjJ4I39TNJIZo8H4BIZ kTRPnVR8Ipq0KSzZAwSk2JC3iZ81SMRhSmKfdoL9V6kkuzFzuBfyKa3Ck/GqlRuPdcFR UZEgnY0UgHhFBCzamZORZSw/XLYGcQ5RhqgZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730992540; x=1731597340; 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=isWwW9X0NWcagZExhydjq1zaUhOWH5R4bKfYKSQjzPQ=; b=O1BaIZuDZ+QVs1dPFCdZLTWEwtZtDxForZ3JU3+9aPUkZMRYres5+8Gv5U2RHLn/pj WMPXaqidRZ4cJO+//704C8xiwpPp+G+ft9IWNtu0ZpNPhwVSiZjl5Qfk2IMhzeUaegVR GrkwLR8HsFGWnI/DG6HiMMaWgJltkv0yRm6Fe8cmOTZjWxQo3WIS6opVbGZxoDT+nSsH Z8yRpUAsqLb3vgvWQ4Q3tdAI3XhbTuG6EuQyR8DSUf+tdenfIy/geyBajx3PiEd4/6is AFr3vo/F0AodUxs9rNXrkhBVFEpET3edlwt/BseE2hSowHEufnZUBUE/r6k0e5KWSQAK dM6w== X-Gm-Message-State: AOJu0YxFV5ahh2to77h/LT5YGcQIFK23JjJFjN0mjmCEYrcAz6evyaQB 48MvDmb/ar/+K+9XU4uS0S2Hs9dZPwyOw1HvpExYcyKHUiyzKalI979hphiMQbFCTKpIeT5LXzD v X-Google-Smtp-Source: AGHT+IH3O6PHb8bjkcu93G7LpE9tkqRjpgm2ayxjyhVT6hkJH/Mmc8BYk0hy1OIqDB1+t1MocQHAIg== X-Received: by 2002:a05:6402:2814:b0:5cf:757:f493 with SMTP id 4fb4d7f45d1cf-5cf0757f53dmr836498a12.24.1730992539925; Thu, 07 Nov 2024 07:15:39 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Roger Pau Monne Subject: [PATCH 3/4] create-diff-object: don't include symbols for .livepatch.hooks.* sections Date: Thu, 7 Nov 2024 16:15:08 +0100 Message-ID: <20241107151509.73621-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241107151509.73621-1-roger.pau@citrix.com> References: <20241107151509.73621-1-roger.pau@citrix.com> MIME-Version: 1.0 Not all toolchains generate symbols for the .livepatch.hooks.* sections, neither those symbols are required by the livepatch loading logic in Xen to find and process the hooks. Hooks in livepatch payloads are found and processed based exclusively on section data. The unconditional attempt to expect each hook serction to have a matching symbol leads to a segmentation fault in create-diff-object when such symbol is not present, as the code references a NULL pointer. Fix this by not attempting to include symbols associated with hook sections. Signed-off-by: Roger Pau Monné --- create-diff-object.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/create-diff-object.c b/create-diff-object.c index d8a2afbf2774..924059a1842b 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1555,8 +1555,6 @@ static int kpatch_include_hook_elements(struct kpatch_elf *kelf) sym->sec->sym = NULL; /* use section symbol instead */ rela->sym = sym->sec->secsym; - } else { - sec->secsym->include = 1; } } } From patchwork Thu Nov 7 15:15:09 2024 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: 13866627 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 2965DD4336D for ; Thu, 7 Nov 2024 15:15:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.831989.1247391 (Exim 4.92) (envelope-from ) id 1t94Ec-0004ao-Se; Thu, 07 Nov 2024 15:15:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 831989.1247391; Thu, 07 Nov 2024 15:15:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t94Ec-0004aU-Oq; Thu, 07 Nov 2024 15:15:46 +0000 Received: by outflank-mailman (input) for mailman id 831989; Thu, 07 Nov 2024 15:15:45 +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 1t94Eb-0003oI-Ct for xen-devel@lists.xenproject.org; Thu, 07 Nov 2024 15:15:45 +0000 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [2a00:1450:4864:20::534]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 27b7f558-9d1b-11ef-a0c6-8be0dac302b0; Thu, 07 Nov 2024 16:15:43 +0100 (CET) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5cedf5fe237so1288439a12.3 for ; Thu, 07 Nov 2024 07:15:43 -0800 (PST) Received: from localhost ([213.195.124.162]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9ee0a17678sm105578466b.10.2024.11.07.07.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 07:15:41 -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: 27b7f558-9d1b-11ef-a0c6-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MzQiLCJoZWxvIjoibWFpbC1lZDEteDUzNC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjI3YjdmNTU4LTlkMWItMTFlZi1hMGM2LThiZTBkYWMzMDJiMCIsInRzIjoxNzMwOTkyNTQzLjA3NTE0Miwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730992542; x=1731597342; 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=XoiNjgms/M7CWzojeRA9q51b8yyw2BKqNf2L0rfvMh8=; b=NWUGG7m/RIDce28t98IW3bFqSGLgsKfgFkLmRB4Yrmp2zU8MvlDWVIZD61m0+xyCZ6 NRhWTHO3KgKOx4xT30zkdfAMax4+cTYbUcxkSwK1BnPG7TVSlDOABZd28VrTA04Qn3jD 0933BNToepSfojI4uUDP2lYljrqVafeYPnSig= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730992542; x=1731597342; 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=XoiNjgms/M7CWzojeRA9q51b8yyw2BKqNf2L0rfvMh8=; b=tYeOf6Xyvu6ZTB7x6hm1D0/AWRD+L62yE4N0zn9awV1FvxyNkC2DM9htdOwEOvL7tL VXGs8I3bvHW3ZAL+zbGp9VXq9XCPNrRis2qpOz/SeEg9FVhhI05dy5CTx1/Atx13rcm0 jJXQFDWR2qLLNcK8rERk5MiyaTucDxYpUOr2q/p6g0yRNzDwouZOXN0qLjPW07KiQVEo 4waI4ncyDfVNUfrYt6zIFAm2/qwS8gZ5gmIKuvscZvw34WPDiQBPqGpuX4wl2xFDUPwX AnLxEoS2xK5mPkgNftZVppSXNJsoTokPA4eTLm9A/jqHnJnDq+t/30Vh6vIyEB8kZxPj CMmw== X-Gm-Message-State: AOJu0Yw5CLqiyGOviJN88JJO7v+bNhVV+rFLaILApgc+pKQGXLP958Ab 9XhRlh/iaGp7rO3MvrAHAYmFlxPQiEShNjYdroPw3nTMUIUIsy5CXk3SvxfyuKhRTa/C0wG6IbS p X-Google-Smtp-Source: AGHT+IEnh9Qz4SbUeRjvVHrxBsM7u1e/LqXNY5W2RAoK1Lmokyfoh+I1mSpvdEeZOf1+y0Jdl2IJdA== X-Received: by 2002:a17:907:97d6:b0:a9a:673f:4dcc with SMTP id a640c23a62f3a-a9e6557d76amr2279855066b.22.1730992542131; Thu, 07 Nov 2024 07:15:42 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Roger Pau Monne Subject: [PATCH 4/4] create-diff-object: also include relas that point to changed sections Date: Thu, 7 Nov 2024 16:15:09 +0100 Message-ID: <20241107151509.73621-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241107151509.73621-1-roger.pau@citrix.com> References: <20241107151509.73621-1-roger.pau@citrix.com> MIME-Version: 1.0 create-diff-object has a special handling for some specific sections, like .altinstructions or .livepatch.hooks.*. The contents of those sections are in the form of array elements, where each element can be processed independently of the rest. For example an element in .altinstructions is a set of replacement coordinates, with the layout specified by the alt_instr struct. In the case of .livepatch.hooks.* each element is a pointer to a hook function to call. The contents of this array is processed element wise, so that create-diff-object can decide whether the element relates to the content in the livepatch and thus needs keeping. Such relation is driven based on the contents of the relocations for the special sections. If a relocation to be applied to a special section element depends on any symbol to be included in the livepatch then the special element is also considered required and thus added to the livepatch contents. However relocations don't always reference function type symbols, they can also reference sections type symbols, and that's usually the case with hook symbols that have relocations based on section symbols, as an example: RELOCATION RECORDS FOR [.livepatch.hooks.load]: OFFSET TYPE VALUE 0000000000000000 R_X86_64_64 .text.foobar Symbol information for .text.foobar: 0000000000000000 l d .text.foobar 0000000000000000 .text.foobar As seen above, the .livepatch.hooks.load relocation uses a non-function symbol, which given the current code in should_keep_rela_group() would mean it's not considered for inclusion in the livepatch. Fix this by allowing should_keep_rela_group() to also keep relocations if they either point to function or section symbols. Signed-off-by: Roger Pau Monné --- create-diff-object.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/create-diff-object.c b/create-diff-object.c index 924059a1842b..c21cc576052a 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1158,11 +1158,17 @@ static int should_keep_rela_group(struct section *sec, int start, int size) struct rela *rela; int found = 0; - /* check if any relas in the group reference any changed functions */ + /* + * Check if any relas in the group reference any changed functions or + * sections. As seen by hook related relocations (.livepatch.hooks.*), + * it's possible they use the section symbol as a reference rather than + * the function symbol. + */ list_for_each_entry(rela, &sec->relas, list) { if (rela->offset >= start && rela->offset < start + size && - rela->sym->type == STT_FUNC && + (rela->sym->type == STT_FUNC || + rela->sym->type == STT_SECTION) && rela->sym->sec->include) { found = 1; log_debug("new/changed symbol %s found in special section %s\n",