From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C2721EB5E5 for ; Mon, 11 Aug 2025 08:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754899316; cv=none; b=Db9A5mROvrJci9jWYEFr2GLNgrA9OLElfzDSOY26hHOXBsQhqaznXnT29sseI1QzyrSZtRT1erS5vEt7vJXTSNlrl/x6gHK5oc0Sjuw5oEfuvRBd6tg7BFOOtmNoD89Cl5Da89ujxJ2mz23rAe7sVxjeTArckF7uT5cV3clv8Wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754899316; c=relaxed/simple; bh=3zjxHaLpUP/1N5vDu4/CLBPdW2fHJh4DCd4GBrDkKi4=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=WhvknjszcpRAwjCaKyqldP1PMgOJ2bZkj2k75rYyFnoNOozA87tFvkgIFzYRcEdCnv7O9ZlNz6a6EJaC4zi5fPydkSmRmUCatLKdQzC4YBlj/kfw0fFMKOHWZeTXITSE12/N5/NLqIqnJd1F2o5K5ATAJg68bZvEVAR2mbdNBbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M6iNkdgF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M6iNkdgF" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.