From nobody Mon Feb 9 22:19:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1714402899; cv=none; d=zohomail.com; s=zohoarc; b=Wd9sPvS6J4ztjmgstJcV1ATev3lt76QNxRu+m44nZ8tfBOkI3wZh+lqJqwW8i7oq+scFJLlu015zfzzObw+T3zF0iqDVqtUwOPSlA/uLY+YIOn1kx/hzSXZWkUe3/AXZ+d2WKE9INGNCY6hg5XswCjMv6M0EsWmhV6dSv5KRb0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1714402899; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ABIMao/S3hzX29QxYYcWMCOhcIr5YSs4nbEkZAC6ppk=; b=SC5TUpeiushv7R/wZB+hzhX8zh8KJ1980PMEI/WzXGjHDvB63tB1xbT24XuN1BaEMBCHOvebeiinkIWBbxN5lzn8SbUyCV1eRFuze5sCfuOU7cHApnChJN0XOFwyNNjEBVcbld/m3GLAZuQ4O7CBwL0RRxfTOxA4/lfrK2VbG/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1714402899667142.62491737651658; Mon, 29 Apr 2024 08:01:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.714136.1115232 (Exim 4.92) (envelope-from ) id 1s1SV4-0000NK-C1; Mon, 29 Apr 2024 15:01:02 +0000 Received: by outflank-mailman (output) from mailman id 714136.1115232; Mon, 29 Apr 2024 15:01: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 1s1SV4-0000MQ-6t; Mon, 29 Apr 2024 15:01:02 +0000 Received: by outflank-mailman (input) for mailman id 714136; Mon, 29 Apr 2024 15:01:00 +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 1s1SV2-00061u-O3 for xen-devel@lists.xenproject.org; Mon, 29 Apr 2024 15:01:00 +0000 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [2607:f8b0:4864:20::f30]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 499c070b-0639-11ef-909b-e314d9c70b13; Mon, 29 Apr 2024 17:00:59 +0200 (CEST) Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-69b6c2e9ed9so21091906d6.1 for ; Mon, 29 Apr 2024 08:00:59 -0700 (PDT) Received: from localhost ([213.195.114.223]) by smtp.gmail.com with ESMTPSA id t10-20020a0cef0a000000b006a040cdd805sm392396qvr.92.2024.04.29.08.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:00:57 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 499c070b-0639-11ef-909b-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1714402858; x=1715007658; 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=ABIMao/S3hzX29QxYYcWMCOhcIr5YSs4nbEkZAC6ppk=; b=ESvZdTEfYhOldho+Qeoi7BKH6MkOsqdG9R6iwAdt81dt6fE15zkk4wkga7Tuk3ZmlH H7j42bXg5Knvabwlscjiv9tMoeysK7pTWXQf0dAps1m6DyMpKur4zJ6BNtOV8yJESadF i1jdgMUX0oh+XFr5Q64pAfxNV5/9Ycn8LQk9g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714402858; x=1715007658; 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=ABIMao/S3hzX29QxYYcWMCOhcIr5YSs4nbEkZAC6ppk=; b=Q1oh/ouC/3WalvjBgDA1ar602mkQQrQaUuUz9pYgU1OXpJ9L8vzqfOgyoLntFTmnNu 5K6wbbkhVikh1fztaQ/kf5XhBU9OglrDYo/g4Jv2CgLNCXtQSjvMSv6amgh/RplZq7M7 UIIMVxo7yfqOUfkqBZ3TiQzf/5ZWde8yBFTSS9mqlrZAkbaTsPO/q0zwrYX2nxu/U5o7 8maAVd7hesYzLxpuf0+W9kJh79CPi0hJPC3vtnVP7CxrOgXuPue1S+Q6q/U/T/8d022z /2tgc8qlkBa8+BcfSoNNS9FQsxlyEF1VbuT9VR2dthxC5N+j1r6+W2bPoPPVgnEzpH7d BcPA== X-Gm-Message-State: AOJu0Yxjmg4mR7tzyL2jTcWc6bhFjE5QC30JMGENDVVuQYs5K6Yfph15 1jEggLOL8IqJQypoPBWa2VSGEAAdMnIluMpLUQa4mHbm8xM58kDD9cOwrX1sDmr6TfGqrF4pKNZ w X-Google-Smtp-Source: AGHT+IGxPcDT9IwGTWGDL4oYzCXrDmSIbNhuvzGMF891BclHIsi0n3Dih5B5TyYh4tZ1b0v0ecwWcg== X-Received: by 2002:a05:6214:130d:b0:6a0:5528:9594 with SMTP id pn13-20020a056214130d00b006a055289594mr11828763qvb.64.1714402858002; Mon, 29 Apr 2024 08:00:58 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: konrad.wilk@oracle.com, ross.lagerwall@citrix.com, Roger Pau Monne Subject: [PATCH 9/9] create-diff-object: account for special section changes Date: Mon, 29 Apr 2024 16:56:54 +0200 Message-ID: <20240429145654.71669-10-roger.pau@citrix.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240429145654.71669-1-roger.pau@citrix.com> References: <20240429145654.71669-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1714402900993100003 When deciding whether there's content to generate a payload also take into account whether special sections have changed. Initially account for chang= es to alternative related section to cause the generation of a livepatch. Note that accounting for hook sections is already done by kpatch_include_hook_elements() when deciding whether there's changed conten= t in the object file. .bugframe sections are also not accounted for since any section in a bugframe section will be accompanied by a change in the functi= on the bugframe references (the placement of the BUG_INSTR will change in the caller function). Signed-off-by: Roger Pau Monn=C3=A9 --- create-diff-object.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/create-diff-object.c b/create-diff-object.c index 8bfb6bf92a1b..957631097b8a 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1663,6 +1663,28 @@ static int kpatch_include_hook_elements(struct kpatc= h_elf *kelf) return num_new_functions; } =20 +static unsigned int include_special_sections(const struct kpatch_elf *kelf) +{ + const struct section *sec; + unsigned int nr =3D 0; + + /* + * Only account for changes in alternatives and exception table related + * sections. Hooks are already taken care of separately, and changes + * in bug_frame sections always go along with changes in the caller + * functions. + */ + list_for_each_entry(sec, &kelf->sections, list) + if (sec->status !=3D SAME && + (!strcmp(sec->name, ".altinstructions") || + !strcmp(sec->name, ".altinstr_replacement") || + !strcmp(sec->name, ".ex_table") || + !strcmp(sec->name, ".fixup"))) + nr++; + + return nr; +} + static int kpatch_include_new_globals(struct kpatch_elf *kelf) { struct symbol *sym; @@ -2469,6 +2491,8 @@ int main(int argc, char *argv[]) kpatch_include_debug_sections(kelf_patched); log_debug("Include hook elements\n"); num_changed +=3D kpatch_include_hook_elements(kelf_patched); + log_debug("Include special sections\n"); + num_changed +=3D include_special_sections(kelf_patched); log_debug("num_changed =3D %d\n", num_changed); log_debug("Include new globals\n"); new_globals_exist =3D kpatch_include_new_globals(kelf_patched); --=20 2.44.0