From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A97B5C87FD2 for ; Mon, 11 Aug 2025 08:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VWDWpDke88/vvu/v/e38Prfcq0acrNYYjtoVpO4hnOk=; b=h80zmpdAYavD8WFM6LcIHeStd1 w8tHkzBnjlqywwaN0nYWDQUw9qrxsVWZ/jN7qwbFSls1ttFYX/ll/g/XPcuoq53GPQJnmkKKwwxlQ 8Zg3IoBXGVieluFma2FssNItj6n1LLBZOfHvE8wW78RejeJZACWhPWAILiOHoe8HAar8HrkxCoMvT /zT1BI3k1nRjxTRI8bGc63G3RxwRqgrO6aGjtV4PjcEX8ZjW3OKiDY5BQsX42n4Wwmp5khTqyiCiv lzdeubwhZ9bcmvMkSShcrrePEHqsdEXgsGmjafIcA6kRP5IgAYd78j0FXAse+oVkfXATAF48kzVa9 YMS8LsTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulNwr-00000006rWh-2R1y; Mon, 11 Aug 2025 08:32:05 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulNTf-00000006mvo-25UE for linux-arm-kernel@lists.infradead.org; Mon, 11 Aug 2025 08:01:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id CF6FA43C9A; Mon, 11 Aug 2025 08:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA28C4CEED; Mon, 11 Aug 2025 08:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754899314; bh=3zjxHaLpUP/1N5vDu4/CLBPdW2fHJh4DCd4GBrDkKi4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=M6iNkdgF2yDK/X4EpQLR2pm1jRhHnZB/BV13O26MN3OVC+gkOas+EJsuMP7x+hITI /MAVR/XRDqImRF7GhWAQgsPd3+6UmiGeq+P+/zXBxdZxj1SbcFa8ZTwwQNYjaxu7hD AOSdrHVU8HxSnqXmN4B1GoBpiNe63cpUHFXK1yn/P1pNTsdHuF2gZlArQu01jlty1z YWio/+nHLliq39/tyIiJEnbnIOGl6LLbl3u/0fV2+u1IwIVOxj5nlbsbgK1OpwyHbM TLNQslwXCPLcAk/qOAz6kOChi0oISs/AsrRisfMAeWhBD6/v1qSwZA5T53YIM+B72w 7zC0+HPx5zb2w== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ulNTT-0066wt-W7; Mon, 11 Aug 2025 09:01:44 +0100 Date: Mon, 11 Aug 2025 09:01:43 +0100 Message-ID: <86zfc68exk.wl-maz@kernel.org> From: Marc Zyngier To: fanqincui Cc: "Will Deacon" , catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Fanqin Cui" , hanht2@chinatelecom.cn Subject: Re: [PATCH] arm64/module: Support for patching modules during runtime In-Reply-To: <3d4011c0.6aaa.198981027d7.Coremail.fanqincui@163.com> References: <20250807072700.348514-1-fanqincui@163.com> <3d4011c0.6aaa.198981027d7.Coremail.fanqincui@163.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: fanqincui@163.com, will@kernel.org, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, cuifq1@chinatelecom.cn, hanht2@chinatelecom.cn X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250811_010155_554426_ACFD8D79 X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 11 Aug 2025 08:37:32 +0100, fanqincui wrote: > > Hi will, > Yes, you are right. The alternative callback function lives inside the module. > This callback function is actually similar to kvm_update_va_mask in KVM; > > The module's callback function calculates some values based on > the current CPU features and then performs the replacement. > > The .text.alternative_cb section is actually marked as SHF_EXECINSTR | SHF_ALLOC > during compilation, so intersections() includes this section and sets it as executable later. I'm worried there is a chicken-and-egg problem here. What if the callback itself requires patching via some other alternative? Is there a guarantee that this always performed in the correct order? M. -- Without deviation from the norm, progress is not possible.