From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6129BC79F82 for ; Sun, 6 Sep 2026 02:01:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Message-Id:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q7RH6lXmjYRMzi+3aJCuBrPmWibcJwSfisnDtiXXf5k=; b=FutlwOi3bc5RSl VC5CmKABPdtmGvQEiwyIrbQBEV05xdrvunjuxbyAUWRhyGwdBiVhpZbDX+SZ3+5YgwUKw9fOV90ou Mbt2edgmCQ7YhN6PoLuk35muBEuGvFB8Hhg4GqgcLfLa32wX44+zSTo1klTMh47B/OoTJ5uG8LAUf w0RZnnIRA/2YdMdB+uGJzg2LNaJOFtPeQLM6N6apqEpaUAsoo+1szHkwZK/2eAHDSaZLQHx/Wy3id ddKnOPZAfp2fClv51igmrifo7/xkHzH0K1am2+J1/n1uU7pT5StZtoXOpnxCiqgkiCDWid0DlC0Gr ABJHP9P5RBVkp2t4CbGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x32BZ-00000004Z2a-1wfK; Sun, 06 Sep 2026 02:00:45 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x32BN-00000004Z1s-2CFM; Sun, 06 Sep 2026 02:00:33 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 54CA343C12; Sun, 6 Sep 2026 02:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 131AD1F00A3A; Sun, 6 Sep 2026 02:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1788660032; bh=ohXcpCjF3E8Su2iGbnUTFcKH4Q5PX6bz9vn2jqgCP+c=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=onvqGLmcP1GLOxpEKfzU67JdQE7IDZGMsPO64h/0NSOK+RvFXdBCqD8+ofD1WBq2g i6cYyIHzjygejYh8PKFLzFY7Ac5zL8dW6mlFYoHExtDtLuDxudvpRUkwCZVnaHxKoG FWNotUDCuJBgzmpoHcxnORH4VODmerRMAERbMW3I= Date: Sat, 5 Sep 2026 19:00:30 -0700 From: Andrew Morton To: "Mike Rapoport (Microsoft)" Cc: Adrian =?UTF-8?Q?Barna=C5=9B?= , Albert Ou , Alexander Gordeev , Alexandre Ghiti , Andy Lutomirski , Borislav Petkov , Brendan Jackman , Catalin Marinas , Christian Borntraeger , Dave Hansen , David Hildenbrand , Gerald Schaefer , Heiko Carstens , Huacai Chen , Ingo Molnar , Len Brown , Palmer Dabbelt , Paul Walmsley , Pavel Machek , Peter Zijlstra , "H. Peter Anvin" , "Rafael J. Wysocki" , Ryan Roberts , Sven Schnelle , Thomas Gleixner , Uladzislau Rezki , Vasily Gorbik , WANG Xuerui , Will Deacon , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, loongarch@lists.linux.dev Subject: Re: [PATCH v3 0/6] arch, mm/execmem: resolve confusion about set_direct_map_valid_noflush() Message-Id: <20260905190030.adf2740822e211ddc028a24a@linux-foundation.org> In-Reply-To: <20260903-execmem-set-vm-perms-v0-2-v3-0-949b64a9f755@kernel.org> References: <20260903-execmem-set-vm-perms-v0-2-v3-0-949b64a9f755@kernel.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, 03 Sep 2026 12:28:26 +0300 "Mike Rapoport (Microsoft)" wrote: > Recent discussion about implementation of execmem's ROX caches on arm64 > revealed a confusion about how set_direct_map_valid_noflush() > implemented on different architectures. > > ... > > Implement these adjustments, make execmem always use VM_FLUSH_RESET_PERMS > and revert set_direct_map_valid_noflush() changes. > Thanks, I updated mm-unstable to this version. > > v3 changes: > * set VM_FLUSH_RESET_PERMS to allocated area just before flipping the > permissions rather than at allocation time > Here's how v3 altered mm.git: mm/execmem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/mm/execmem.c~b +++ a/mm/execmem.c @@ -36,7 +36,6 @@ static void *execmem_vmalloc(struct exec unsigned long end = range->end; void *p; - vm_flags |= VM_FLUSH_RESET_PERMS; if (kasan) vm_flags |= VM_DEFER_KMEMLEAK; @@ -277,6 +276,8 @@ static void *execmem_cache_populate_allo /* fill memory with instructions that will trap */ execmem_fill_trapping_insns(p, alloc_size); + set_vm_flush_reset_perms(p); + err = set_memory_rox((unsigned long)p, vm->nr_pages); if (err) goto err_free_mem; @@ -439,6 +440,7 @@ void *execmem_alloc(enum execmem_type ty { struct execmem_range *range = &execmem_info->ranges[type]; bool use_cache = range->flags & EXECMEM_ROX_CACHE; + unsigned long vm_flags = VM_FLUSH_RESET_PERMS; pgprot_t pgprot = range->pgprot; void *p = NULL; @@ -447,7 +449,7 @@ void *execmem_alloc(enum execmem_type ty if (use_cache) p = execmem_cache_alloc(range, size); else - p = execmem_vmalloc(range, size, pgprot, 0); + p = execmem_vmalloc(range, size, pgprot, vm_flags); return kasan_reset_tag(p); } _ _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv