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=1796295887; b=wcRCMVviKRlQc/KvB+z0nEMy2WuG+3AjbMrv908+LrsQKd/WEEg4uU5BB6bdhqbZ08Yk gHUOzUSRS10Jb59RErYyF8xrGmHeLg9aUeMbCp01lIJ3S3kA2cAFgwBLB3iTKrCSzr/xu kvDSkbrv4h2PvqODUZjFV4Wz5dxrIVdjXhYWg2cUzvwCdsy1xYpnP4wBDGNa/ifk1Xoca xCnvl0lcEIP3H5D5R77xlR1HFeGdSUevZ/IvyFV9vah+nAUqssTQwOfTPvbWJv78Y9ZMY 6mlEmGX9qfGxO2DivuKYsiE1yiPJA/gmm1Vql+PkcaENRu4ZYMmgAG8ioFJ6Xbj5c9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295887; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=SKUdENSrPrcnkrgS63bkt4t32R97zQHWiZQpxCuJ4F4=; b=uDP6pKNYo5XfvcKSvguwrPqZUa0STK18czs2yHKor1Jak38l0C0zcjt1ebbCIr9v2pJo xSwYjdYweSe7ix31QW9COP/ZKM8Rsi8I6bPeh7K0N0aM8Zug8hcD6N7YenbrlQlfv8NK/ 6p7iPAm8CinQ0XMz8qP3bSKQUYDKUvKmPSmfYngVg6ut6KSKV0uZzdD+QpxHuMDGAup+z wN8VgTyq/rZpHw04kRcsFIQ9mTregJpYGLCc8dOz6ntUHjAvR8VwZiwlSldXb3g/t3GWN OwM78ZpHe50wGbNxsBAPxOdZQnn/X5fqzBpdxeq7tPdoDxDQ4rveTn+LKxuZsH0Eodg== 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=D3iYqpxQ; 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 8E873606A32C for ; Thu, 3 Dec 2026 11:04:47 +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=D3iYqpxQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 000741F00893; Thu, 3 Dec 2026 11:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796295887; bh=SKUdENSrPrcnkrgS63bkt4t32R97zQHWiZQpxCuJ4F4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=D3iYqpxQ4spMwnF1NKkREeapC3czlTFDyzQsWL+1U3WR8lS+/P5fTqey8TaPstSlL yTR9PdqHaH+hrYfd8P78TsH4wE5YxzCrhE2DAQBG0HsTpoBLNQln3k9PeGCPMxV/MK P288ye91jKZ4cpb1BBixihmmn3q9VCdPo3RyF+1CUSPPtr0My21zHGnjgfMzJtEfIv hT2TBizTTHKahQUdk1GKbODaE+KyvWy8dTrs74C5RBMciUMWVa93gzyr99ruZvdGZJ besNEm9iHnyCQKKmBTV900GHwyBjd4jZ5cc4rNj6kRu9ElFWafM9fF0Qam3vm/dxLf LOA7y5qAoHTyg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 16/17] s390/execmem: Add EXECMEM_FTRACE 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-17-hca@linux.ibm.com> References: <20261203103345.1206548-1-hca@linux.ibm.com> <20261203103345.1206548-17-hca@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 11:04:46 +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_FTRACE skips set_memory_rox() direct-map alias update -- commit a1342c4b90743d50be481c2d40f949a00ca93131 Author: Heiko Carstens s390/execmem: Add EXECMEM_FTRACE range This commit adds an EXECMEM_FTRACE range with PAGE_KERNEL_ROX protection in execmem_arch_setup() and removes the explicit set_memory_rox() call from module_alloc_ftrace_hotpatch_trampolines(). > diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c > index 8538d8b53a322..5ad84066aa11c 100644 > --- a/arch/s390/kernel/module.c > +++ b/arch/s390/kernel/module.c [ ... ] > @@ -473,20 +472,12 @@ static int module_alloc_ftrace_hotpatch_trampolines= (struct module *me, > const Elf_Shdr *s) > { > char *start, *end; > - int numpages; > size_t size; > - int rc; > =20 > size =3D FTRACE_HOTPATCH_TRAMPOLINES_SIZE(s->sh_size); > - numpages =3D DIV_ROUND_UP(size, PAGE_SIZE); > - start =3D execmem_alloc(EXECMEM_FTRACE, numpages * PAGE_SIZE); > + start =3D execmem_alloc(EXECMEM_FTRACE, PAGE_ALIGN(size)); > if (!start) > return -ENOMEM; > - rc =3D set_memory_rox((unsigned long)start, numpages); > - if (rc) { > - execmem_free(start); > - return rc; > - } > end =3D start + size; > =20 > me->arch.trampolines_start =3D (struct ftrace_hotpatch_trampoline *)sta= rt; > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > index 062b2b5325aff..0cac76ddb700b 100644 > --- a/arch/s390/mm/init.c > +++ b/arch/s390/mm/init.c > @@ -338,6 +338,13 @@ struct execmem_info __init *execmem_arch_setup(void) > .pgprot =3D PAGE_KERNEL_ROX, > .alignment =3D MODULE_ALIGN, > }, > + [EXECMEM_FTRACE] =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 removing set_memory_rox() leave the direct-map aliases of module ftrace hotpatch trampoline pages writable? When EXECMEM_ROX_CACHE is not set, execmem_alloc() calls execmem_vmalloc() -> __vmalloc_node_range() directly with PAGE_KERNEL_ROX and never invokes set_memory_rox(). On s390, direct-map aliases are only marked read-only in __set_memory() -> change_page_attr_alias(), so they remain writable. Commit "s390/execmem: Enable EXECMEM_ARCH_ROX" later enables EXECMEM_ROX_CACHE when cpu_has_edat1() is true, but systems without EDAT1 still omit EXECMEM_ROX_CACHE while keeping PAGE_KERNEL_ROX and retain this regression. At this commit, skipping set_memory_rox() also defers splitting 1M/2G direct-map mappings until module teardown in vfree() -> vm_reset_perms() -> set_area_direct_map(), where a page-table allocation failure can only trigger WARN_ON_ONCE() instead of failing module load cleanly. Calling set_memory_rox() when !execmem_is_rox(EXECMEM_FTRACE) would keep the direct-map aliases read-only when EXECMEM_ROX_CACHE is disabled. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203103345.1206= 548-1-hca@linux.ibm.com?part=3D16