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=1796296150; b=QsRoMECcHamDo9Q+qYxoFPidY9YLIF6KIvYv4VD3a/G2TA9ci3ulVgJuygvMEDbtXf0W kaMKLv1K/kEnNV4UPOn9nPI3IRKr/TCSSc05Z56F8FBDtDdmY4zcKI0eHerAIIb1b5PcT 1d9KHIzdaDl75Ncd3rk23dbo3IkfStMz7tceUvPAnoosGAXy2f4DW45tA3nkORFnldypp V48n7lVcvFxLEosJSxrFxjlf8MwRHPhrgFeXiHU1Ynk1qLlHbY/eCwWdvIB5Jwl36h7DT iLWMzFoarGVZGJxCmTil4Dilm7P3sjkSqr1dVIj6+ANalJ1YO9wSjcELHHlzW3pt4qw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796296150; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Hnfny1ZqdRXraUBH4qoc0zJ6Ha7h+M+dSgUi8+x+ygs=; b=1MxqxNqDNORvs/NH9UmjKh0Crnyd+q71oC1fyrCycASphd5KlyJ306D/LilktHNN74JP meuSIoogkUx4ZVuG3TI1Fk3CopePlHwnEGKG+46LPpHMCsBWkeqcpqxf12JmwbifyNKzQ UdzpIhTRCgD7qHvrOIqbHcYADlkaKAFpTINDpRMmcQX+LsHNcz70O5Hhrl5b8hare7zn/ ZNmkso/hGFS2nkBZCy0Xc/sUha/ntHgJXk9hQlso9DLBuDAlWkla2gt0o158DoxDwRsaU GKqAUpt4Z0/0+olpDuHRXeXezb2Me6yH4SuWCr46BslUe59TJfR5dewIzgOdcqa2CiA== 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=KBR6zNkg; 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 AD58D606A322 for ; Thu, 3 Dec 2026 11:09:10 +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=KBR6zNkg Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0E151F000C1; Thu, 3 Dec 2026 11:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796296150; bh=Hnfny1ZqdRXraUBH4qoc0zJ6Ha7h+M+dSgUi8+x+ygs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=KBR6zNkgEGiHHHO+Hbmy4eFVsrOwoLLhpEk5JfAoaW5/igtqKcJ0HVzav5hDHa2J4 Ze5IIqgC3iRuTzy8eK712T5Iqg1fBVW/2shcwEgLwIhSvB+UO+wNOwxAdYMFkprBkA yEDd/mdiyu3X2ayXD5Zu8QNtAFZuBLD3MAGPrhYqtAfnxmE+Y13Re3ZKmDM2qrPgkE zcsQcICV7zsxgL96wDPsjUedtIbO+K6BeHVmXKGtcHgLTa1JlhWT9Mx616ocPysHW8 VWJMmOWpSmxVLzjmSSxhaEyC5Q0uExZtqSChatCxYNghpt966zy/ZmboO7qIQffzhu etOO45OwLft/Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 17/17] s390/execmem: Enable EXECMEM_ARCH_ROX 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-18-hca@linux.ibm.com> References: <20261203103345.1206548-1-hca@linux.ibm.com> <20261203103345.1206548-18-hca@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 11:09:09 +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 3 potential issues to consider: - [High] s390/execmem: zero-sized EXECMEM_FTRACE alloc corrupts ROX cache maple trees - [Medium] s390/mm: change_page_attr_alias() shatters direct-map PMDs on ROX cache refill - [Low] s390/execmem: commit subject references nonexistent EXECMEM_ARCH_ROX -- commit 6a59e81aa86e998734bf155ab53f0430bb991904 Author: Heiko Carstens s390/execmem: Enable EXECMEM_ARCH_ROX This commit selects ARCH_HAS_EXECMEM_ROX on s390, adds execmem_fill_trapping_insns(), and enables EXECMEM_ROX_CACHE for EXECMEM_DEFAULT, EXECMEM_KPROBES, and EXECMEM_FTRACE when EDAT1 is available, while defining EXECMEM_BPF and EXECMEM_MODULE_DATA as writable. > s390/execmem: Enable EXECMEM_ARCH_ROX [Severity: Low] This isn't a bug, but the subject names EXECMEM_ARCH_ROX instead of ARCH_HAS_EXECMEM_ROX. > diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c > index 0cac76ddb700b..139ca6461fc81 100644 > --- a/arch/s390/mm/init.c > +++ b/arch/s390/mm/init.c > @@ -312,39 +312,70 @@ void arch_remove_memory(u64 start, u64 size, struct= vmem_altmap *altmap) [ ... ] > + if (IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) && cpu_has_edat1()) { > + pgprot =3D PAGE_KERNEL_ROX; > + flags =3D EXECMEM_KASAN_SHADOW | EXECMEM_ROX_CACHE; > + } else { > + pgprot =3D PAGE_KERNEL; > + flags =3D EXECMEM_KASAN_SHADOW; > + } [Severity: Medium] Does enabling EXECMEM_ROX_CACHE shatter 1MB direct-map PMDs on every cache refill? Each refill in execmem_vmalloc_rox() allocates a 1MB huge vmalloc block and calls set_memory_rox() on the 256-page range. change_page_attr_alias() ignores vm_area_page_order(area) and updates the direct-map alias one 4KB page at a time. On the first page, walk_pmd_level() splits the 1MB direct-map PMD into 256 4KB PTEs, causing 256 global crdte/cspg shootdowns under mmap_write_lock(&init_mm). The PMD is never collapsed back, so a later vfree() in execmem_cache_clean() triggers another 512 per-page shootdowns. Updating contiguous direct-map spans at PMD granularity in change_page_attr_alias() would avoid both the split and the shootdowns. [ ... ] > [EXECMEM_FTRACE] =3D { > - .flags =3D EXECMEM_KASAN_SHADOW, > + .flags =3D flags, > .start =3D start, > .end =3D MODULES_END, > .pgprot =3D PAGE_KERNEL_ROX, > .alignment =3D MODULE_ALIGN, > }, [Severity: High] Can a zero-sized EXECMEM_FTRACE allocation corrupt the ROX cache maple trees and cause a use-after-free? When loading a module with an empty __mcount_loc section (s->sh_size =3D=3D= 0), module_finalize() -> module_alloc_ftrace_hotpatch_trampolines() calls execmem_alloc(EXECMEM_FTRACE, 0). Previously __vmalloc_node_range() rejected size 0 and returned NULL. With EXECMEM_ROX_CACHE enabled, execmem_alloc() passes size 0 into execmem_cache_alloc_locked(), where addr + size - 1 underflows to addr - 1. That stores an inverted [addr, addr - 1] range in busy_areas while re-inserting [addr, last] into free_areas and returning addr. A subsequent allocation then reuses addr, and unloading the first module calls execmem_free(mod->arch.trampolines_start), overwriting live code with trapping zeroes via execmem_fill_trapping_insns(). Rejecting size =3D=3D 0 in execmem_alloc() or skipping empty sections in module_alloc_ftrace_hotpatch_trampolines() would prevent this regression. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203103345.1206= 548-1-hca@linux.ibm.com?part=3D17