From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3B3AA199D8 for ; Sun, 19 Jul 2026 08:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784449533; cv=none; b=A3xchHGD6BdxTfrhlXXBGiIwy8cn711FKepEw1y4hOfhNWKXIXT7a+erybINe/IJj6iphN7iP641lc0Z3EhBtIgd7qnPrCEWo+4P/dRyW5+0j3/DYMo4dioe9ZmQNjpXbAVBO2IQJEjL8IP+iKE/kAdsedcbiuThgIEk1QWYYDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784449533; c=relaxed/simple; bh=2pllZr7x64CY8qeuIUqKlpJR6mSXUk5r8Zw6e62hZ2U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=rhbURzHlCifDFn/WuJ7BrQ4U73STUvE7yLRgq3nw41Mkhy9Ko24PkgxeHemp5EFn3vXetarA+B2y8rkF3c6Eu0KtreiHNHoCgiRvuFmTH50CTuvtzx86dUkGPJp6n4KG7VjLd+O38qG1J3IaAEQ+UJfrjQFo0jONoAcjDEuayS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=SHUft1Gh; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sKwsVbAU; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="SHUft1Gh"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sKwsVbAU" From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1784449530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rEnW/e+RKzLt9EfbGK/0wxdDq4P4WKLWbwpchEhe1mE=; b=SHUft1GhCVHdMbIR3QWfvD3qSxt72PCmV/komRq2ou/7Vj8FR+GRe3yGwPBfrle0zL/PNU I2U2AXEiC8U+Uv5+gDWbG/+a1bqrIZHPmPKlXE6OF8msM8R9ndDfLhh0SPHZotXR6IEugD VrgkHaACWxUfSYwRbdVp3Ns5bdisJx9cGf1oEflyVQ4YEzEkRth9bH+CpNG0XN8ADXrukV LcnC6P0PRGGnMnWTvS6GFu4BGnURlKeBgP3NrkElElYndwf7TvGj0vyoDylzY2gZoRVLE4 iJDlC0l0UfpsusZaIzNCgsO+oD/cxo2+2xf1WGu/+ZoOSU2ytgvMAfp31skWiA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1784449530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rEnW/e+RKzLt9EfbGK/0wxdDq4P4WKLWbwpchEhe1mE=; b=sKwsVbAUjaiyENqnR7mtr1tris7IgHx4mW2UTTom0ul0aVS+iw7am6sJRE46xj5Wrqu/7H GWC2gzS+NLDnbbDw== To: Xiaofeng Yuan , pjw@kernel.org Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, broonie@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Xiaofeng Yuan Subject: Re: [PATCH v2 2/2] riscv: patch: skip fixmap mapping when kernel text is already writable In-Reply-To: <20260719081037.5749-3-xiaofengmian@163.com> References: <20260719081037.5749-1-xiaofengmian@163.com> <20260719081037.5749-3-xiaofengmian@163.com> Date: Sun, 19 Jul 2026 10:25:28 +0200 Message-ID: <87h5lv75dz.fsf@yellow.woof> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Xiaofeng Yuan writes: > ... > > Signed-off-by: Xiaofeng Yuan Also missing commit description. > --- > arch/riscv/kernel/patch.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c > index 16b243376f..b6e8e1e83e 100644 > --- a/arch/riscv/kernel/patch.c > +++ b/arch/riscv/kernel/patch.c > @@ -44,7 +44,8 @@ static __always_inline void *patch_map(void *addr, const unsigned int fixmap) > uintptr_t uintaddr = (uintptr_t) addr; > phys_addr_t phys; > > - if (core_kernel_text(uintaddr) || is_kernel_exittext(uintaddr)) { > + if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX) && > + (core_kernel_text(uintaddr) || is_kernel_exittext(uintaddr))) { > phys = __pa_symbol(addr); > } else if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) { > struct page *page = vmalloc_to_page(addr); Probably cleaner to have if (!IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) return addr; at the beginning of this function. And get rid of CONFIG_STRICT_MODULE_RWX for the rest. But looks functionally correct to me. Nam