From nobody Wed Feb 11 08:12:20 2026 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 064F328641E for ; Wed, 28 May 2025 12:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748435769; cv=none; b=Ai1YCvhovFbvRrnVQizyrSOa7taD0Hi2OSM2dObx6GPH5IEMMn46ibg8BHNbY6vzbxgxO18WTsYM10cPIIXNBgbLOzJdbwbvssP9qVpIqxM0xhcWVlEav7sMcg+Jx7bO7geFdXHlI0B36mxWBvcZu+7N3CYz8rjpLpV5rbpoFzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748435769; c=relaxed/simple; bh=Ao6Yj7X14J3VPAgLaAb1nmrQ9mdqFFBKa+cv/pz23LM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jLaDa/RMd1z5UnCC8+vn48qHbSOH146U+aeVpjJMcnA1NDpV5Fzz+UloVdCsyToVhtnMtkZ/NLir8KKHFI52EULmEDRlD/4uVscQdSGmh20jSZW1g99ZviJsU/YcgyT/1v6DoARzeXydRCnEoS4dHr6MoYMMjV+NjavHPsChfD4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 35AD321BEA; Wed, 28 May 2025 12:36:06 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BFC36136E0; Wed, 28 May 2025 12:36:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Q2/nLDUDN2idKQAAD6G6ig (envelope-from ); Wed, 28 May 2025 12:36:05 +0000 From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: xin@zytor.com, Juergen Gross , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: [PATCH 1/3] x86/execmem: don't use PAGE_KERNEL protection for code pages Date: Wed, 28 May 2025 14:35:55 +0200 Message-ID: <20250528123557.12847-2-jgross@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250528123557.12847-1-jgross@suse.com> References: <20250528123557.12847-1-jgross@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Rspamd-Queue-Id: 35AD321BEA X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Level: X-Spam-Flag: NO X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: -4.00 Content-Type: text/plain; charset="utf-8" In case X86_FEATURE_PSE isn't available (e.g. when running as a Xen PV guest), execmem_arch_setup() will fall back to use PAGE_KERNEL protection for the EXECMEM_MODULE_TEXT range. This will result in attempts to execute code with the NX bit set in case of ITS mitigation being applied. Avoid this problem by using PAGE_KERNEL_EXEC protection instead, which will not set the NX bit. Cc: Reported-by: Xin Li Fixes: 5185e7f9f3bd ("x86/module: enable ROX caches for module text on 64 b= it") Signed-off-by: Juergen Gross --- arch/x86/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 7456df985d96..f5012ae31d8b 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -1089,7 +1089,7 @@ struct execmem_info __init *execmem_arch_setup(void) pgprot =3D PAGE_KERNEL_ROX; flags =3D EXECMEM_KASAN_SHADOW | EXECMEM_ROX_CACHE; } else { - pgprot =3D PAGE_KERNEL; + pgprot =3D PAGE_KERNEL_EXEC; flags =3D EXECMEM_KASAN_SHADOW; } =20 --=20 2.43.0