From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796295808; b=EbvrvC9tA/iq67J1sDoEyL+iOJUJtyk2zkvco16SIQSjJnG+1/76fwND52d1wY/TNqhA L6kJMFirVNYZsyR7K3nOXI6ennRCmsy2ALo3655486pXq0V2cSCzOirKRZAwIJhACtjRo /Tuzukmc6JtamMAUNRu/sjzFgojeEblQl3iE85t64/2rA3OHLzYDjW98xZ6c0ucBTZ4JP a8xQSQ2/2KG6sv7SN/qEDjtRmC+nW/0TCNj4iVI/ebAsjkQ2mBGch9J/t1g02sdiZcNcd n7JmWFK6YD6GognG2pVvt8+fuLladWXHESPLxm71lDDclqeTYCv4NBWCngz6ni/h7cA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295808; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=JbrM6vuJZgkV0uiO9FYipMwVFcXWb6CaE4AxqaM8fUI=; b=Ok/pT+olEFLq69emzDEJ4e8hdpTr1Ddkkzby4YBDGTL4B8kcmDxwTbyw4vR/SW5sfYAy LojK90z+btlgot565b0QCjxVD3ZP4Rhoe3GpblyaUjKZAj8MapAn+bEPjWccrPZA96At5 fhaGicSS7LKNFNPAyX0vxeumJbGIlyt0zWQpJNT09e/xzDwAsGtl79lHPhpRNF0CfFzLy M3nNTENxNXFNkOn+E4Zkks8OUeXcTKCGUi+dhyd/eSMSggOjhvztR7iaIdnhFhGvDktj7 TvdRnpQk9ZjT8q9HGT1MzbdGbK4kg7UsKM1hCn066eoj+SQfT1WhEP0Q88IxGqMydTQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eek0u3Pk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F87B606A322 for ; Thu, 3 Dec 2026 11:03:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eek0u3Pk Received: by smtp.kernel.org (Postfix) with ESMTPSA id A97A21F000C1; Thu, 3 Dec 2026 11:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796295807; bh=JbrM6vuJZgkV0uiO9FYipMwVFcXWb6CaE4AxqaM8fUI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=eek0u3PkrWZhN4GiiVEwr+Gz83IwIyqHkRUFqQpSKNPuQTMnJOtUcz37zCtdz6BJK sKnbJYo1ZokAUgnLhNvPf5QMt7lwvLU9geokUcsF2IwqWMiI8TStjC1Bq1uSpaQf3R 0MqCMyrLcbdfkxbaQ6EeyZ2WrvtxfWxJa5veK5RJhikd75oohRXOtmZRTtlhClDF9a GEb3NGtmsSfScSwoRd3OAKoJZTtISeul1I3dS0G4V0Z4/t5oOvr+IHVea9wKnRDcLV lER+5ZQTcMD4oErLuOihcKtnkI76KOWlpPNDdRzlc10zdWAPx503wLCy1S9d6GcTo2 D9GcfAtqHmGYQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 15/17] s390/execmem: Add EXECMEM_KPROBES range Reply-To: sashiko-reviews@lists.linux.dev To: "Heiko Carstens" Cc: linux-s390@vger.kernel.org, "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203103345.1206548-16-hca@linux.ibm.com> References: <20261203103345.1206548-1-hca@linux.ibm.com> <20261203103345.1206548-16-hca@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 11:03:27 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] s390/execmem: EXECMEM_KPROBES skips set_memory_rox() direct-map protection -- commit 67943fd0e30c5ced8f7dc99734b2146fc3684f54 Author: Heiko Carstens s390/execmem: Add EXECMEM_KPROBES range This commit adds an EXECMEM_KPROBES range with PAGE_KERNEL_ROX protection and removes the s390-specific alloc_insn_page() implementation in favor of the generic one. > diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c > index 9bfff628c9bf1..d97fd3b9e3dbb 100644 > --- a/arch/s390/kernel/kprobes.c > +++ b/arch/s390/kernel/kprobes.c [ ... ] > @@ -33,20 +31,6 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); > =20 > struct kretprobe_blackpoint kretprobe_blacklist[] =3D { }; > =20 > -void *alloc_insn_page(void) > -{ > - void *page; > - > - page =3D execmem_alloc(EXECMEM_KPROBES, PAGE_SIZE); > - if (!page) > - return NULL; > - if (set_memory_rox((unsigned long)page, 1)) { > - execmem_free(page); > - return NULL; > - } > - return page; > -} > - > static void copy_instruction(struct kprobe *p) > { > kprobe_opcode_t insn[MAX_INSN_SIZE]; > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > index b9fd795cf788e..062b2b5325aff 100644 > --- a/arch/s390/mm/init.c > +++ b/arch/s390/mm/init.c > @@ -331,6 +331,13 @@ struct execmem_info __init *execmem_arch_setup(void) > .pgprot =3D PAGE_KERNEL, > .alignment =3D MODULE_ALIGN, > }, > + [EXECMEM_KPROBES] =3D { > + .flags =3D EXECMEM_KASAN_SHADOW, > + .start =3D start, > + .end =3D MODULES_END, > + .pgprot =3D PAGE_KERNEL_ROX, > + .alignment =3D MODULE_ALIGN, > + }, > }, > }; [Severity: Medium] Does this leave kprobe instruction pages writable through the kernel direct mapping? Without EXECMEM_ROX_CACHE, execmem_alloc() calls execmem_vmalloc() directly with PAGE_KERNEL_ROX, which updates only the vmalloc PTE. Because alloc_insn_page() no longer calls set_memory_rox() -> change_page_attr_alias(), the backing page's direct-map alias stays writabl= e. At this commit, large direct-map mappings on EDAT1 systems are also not spl= it at allocation time, deferring splitting to free_insn_page() -> vfree() -> vm_reset_perms() -> set_area_direct_map(), where -ENOMEM triggers WARN_ON_ONCE() and skips direct-map invalidation. Commit "s390/execmem: Enable EXECMEM_ARCH_ROX" later enables EXECMEM_ROX_CACHE when cpu_has_edat1() is true, but systems without EDAT1 (for example with facilities=3D!8) still omit EXECMEM_ROX_CACHE while keepi= ng PAGE_KERNEL_ROX, leaving the direct-map alias writable there. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203103345.1206= 548-1-hca@linux.ibm.com?part=3D15