From nobody Mon Feb 9 02:07:57 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=1712851766; cv=none; d=zohomail.com; s=zohoarc; b=iwLqwGC+JaZbzNlQHHB2brIIGxDHzuFRLMSw10la/EqiP5BcvnyO9ne5EesjfmMVUpt8fToHvQKA3eHECmHB6RDqk9QSNEMXbjniQvkukQMCf+lKGkAYk4x+wETuy9CcO9SJq3tiYfFC3Pf8c+zNKUjGCTaD1BnihuQfG9gA9bg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712851766; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cI7sdKD5FmgcXnDnQmTGZKEG+ARXSt1G7DPgTc+R7UM=; b=MzrKY5j5Iy6u4SRtLk8dllOW05GAGvdooDBFzl1FT81CxkkuzTleS7NQfNDNMB9Qh7Kp0018ji0AHuYIADMzgdcs4kEPvK6ykSXYUB6myp3jnryAio/cu1SxeZ5F199NPRZTcI84YlMpHTE9/zmVZ5HW6JTAxZwdJVSD6YMAAoU= 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 1712851766626337.4567347954237; Thu, 11 Apr 2024 09:09:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.704068.1100189 (Exim 4.92) (envelope-from ) id 1ruwz5-0007QA-2L; Thu, 11 Apr 2024 16:09:07 +0000 Received: by outflank-mailman (output) from mailman id 704068.1100189; Thu, 11 Apr 2024 16:09:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ruwz4-0007Q3-W9; Thu, 11 Apr 2024 16:09:06 +0000 Received: by outflank-mailman (input) for mailman id 704068; Thu, 11 Apr 2024 16:09:05 +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 1ruwz3-0007Px-Pp for xen-devel@lists.xenproject.org; Thu, 11 Apr 2024 16:09:05 +0000 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [2607:f8b0:4864:20::f29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d0fd20ae-f81d-11ee-b908-491648fe20b8; Thu, 11 Apr 2024 18:09:04 +0200 (CEST) Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-6962e6fbf60so320596d6.1 for ; Thu, 11 Apr 2024 09:09:04 -0700 (PDT) Received: from localhost ([85.31.135.62]) by smtp.gmail.com with ESMTPSA id k10-20020ad4450a000000b0069b4e14fc28sm762332qvu.9.2024.04.11.09.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:09:02 -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: d0fd20ae-f81d-11ee-b908-491648fe20b8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1712851743; x=1713456543; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cI7sdKD5FmgcXnDnQmTGZKEG+ARXSt1G7DPgTc+R7UM=; b=TH4vGKQ6P0J82vRZdz0e4QzQ3ImDkv6DerwEqvnQT0ox/DplbMx0kgbf3MCZRCNn3l yTuOokbuXJPhzL56QwhKmYRebeHGEEkMU3dbu2r3oHTumYwzjIwBuD1HNHm+AHEL8Zme WEyUdWlPRQrdOCvFRPmuyBYxJo08XD/B6mtHc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712851743; x=1713456543; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cI7sdKD5FmgcXnDnQmTGZKEG+ARXSt1G7DPgTc+R7UM=; b=qhnDXNQNRpLZjJ6mrAVRJkvW7vxTVIL6R/rikTXXuWomE2sQ2xj37Dzt0omNoLDEBv 2rC2b8S8u2+DvDGyum3JpBux1THM6HNhRh8FRuXzStoG9UzpGD0j7OJBp+uSU68vycFw my4gI9cY/JW5qoNGC27hape6iIMle/T7wBLNCDEAuA/yfFmA8r9Od+9pS2542qK680y2 nVAaMKUCSeuwhr9NTrAlUnqr0hC6EsRm8DMNnX0DIz1nMpWkdyJdO6NM1WOqB3F6Q1u3 XdBlO4eJ8MtXJK/b1AfZWqPkb1rz1NMQ8JtIcoZZVriRWeiIie9L+PSfAb54wz78LbBc qQuA== X-Gm-Message-State: AOJu0YwvB98J2/iqjDl6o3CfTM5eAFf2edCM7Nxjj1NUEbCy403ZzVVb tJWqv/+kQlZWAo+Vl6QowxaPoPR4lAVVjJqFZSMplOOfRCin+jBUI62wbJXeXrYTQojlULIMzMd k X-Google-Smtp-Source: AGHT+IE4cdrpQOpDfzPn5BM4uSDMQNn+4mp5YvbUITbTr1Ccho8ku83P57Xl7dqLO6gYu7ogcteayg== X-Received: by 2002:a05:6214:5097:b0:69b:4dac:19e9 with SMTP id kk23-20020a056214509700b0069b4dac19e9mr198551qvb.33.1712851742946; Thu, 11 Apr 2024 09:09:02 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v2] altcall: fix __alt_call_maybe_initdata so it's safe for livepatch Date: Thu, 11 Apr 2024 18:08:38 +0200 Message-ID: <20240411160838.73965-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.44.0 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: 1712851768510100001 Setting alternative call variables as __init is not safe for use with livepatch, as livepatches can rightfully introduce new alternative calls to structures marked as __alt_call_maybe_initdata (possibly just indirectly du= e to replacing existing functions that use those). Attempting to resolve those alternative calls then results in page faults as the variable that holds the function pointer address has been freed. When livepatch is supported use the __ro_after_init attribute instead of __initdata for __alt_call_maybe_initdata. Fixes: f26bb285949b ('xen: Implement xen/alternative-call.h for use in comm= on code') Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Andrew Cooper --- Changes since v1: - Use #ifdef instead of #ifndef. --- xen/include/xen/alternative-call.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xen/include/xen/alternative-call.h b/xen/include/xen/alternati= ve-call.h index 5c6b9a562b92..10f7d7637e1e 100644 --- a/xen/include/xen/alternative-call.h +++ b/xen/include/xen/alternative-call.h @@ -50,7 +50,12 @@ =20 #include =20 -#define __alt_call_maybe_initdata __initdata +#ifdef CONFIG_LIVEPATCH +/* Must keep for livepatches to resolve alternative calls. */ +# define __alt_call_maybe_initdata __ro_after_init +#else +# define __alt_call_maybe_initdata __initdata +#endif =20 #else =20 --=20 2.44.0