[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd3c4a6a-abc5-4f4f-b829-72f86cfb5bde@redhat.com>
Date: Thu, 21 Aug 2025 14:52:06 +0200
From: David Hildenbrand <david@...hat.com>
To: John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>,
Anthony Yznaga <anthony.yznaga@...cle.com>, sparclinux@...r.kernel.org,
davem@...emloft.net, andreas@...sler.com
Cc: linux-kernel@...r.kernel.org, agordeev@...ux.ibm.com, will@...nel.org,
ryan.roberts@....com, osalvador@...e.de, Meelis Roos <mroos@...ux.ee>,
Rick Edgecombe <rick.p.edgecombe@...el.com>
Subject: Re: Found it - was: Re: [PATCH] sparc64: fix hugetlb for sun4u
>>
>> @Anthony: Can you see any suspicious in the disassembled code that Meelis (CC'ed) posted?
>
> OK, bisecting has lead me to the following commit:
CCing Rick.
Hm, but that's bpf-only code. Are you sure that it's this exact commit
or rather ....
>
> d53d2f78ceadba081fc7785570798c3c8d50a718 is the first bad commit
> commit d53d2f78ceadba081fc7785570798c3c8d50a718 (HEAD)
> Author: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Date: Thu Apr 25 17:11:38 2019 -0700
>
> bpf: Use vmalloc special flag
>
> Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special
> permissioned memory in vmalloc and remove places where memory was set RW
> before freeing which is no longer needed. Don't track if the memory is RO
> anymore because it is now tracked in vmalloc.
>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Cc: <akpm@...ux-foundation.org>
> Cc: <ard.biesheuvel@...aro.org>
> Cc: <deneen.t.dock@...el.com>
> Cc: <kernel-hardening@...ts.openwall.com>
> Cc: <kristen@...ux.intel.com>
> Cc: <linux_dti@...oud.com>
> Cc: <will.deacon@....com>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: H. Peter Anvin <hpa@...or.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Nadav Amit <nadav.amit@...il.com>
> Cc: Rik van Riel <riel@...riel.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Link: https://lkml.kernel.org/r/20190426001143.4983-19-namit@vmware.com
> Signed-off-by: Ingo Molnar <mingo@...nel.org>
>
> include/linux/filter.h | 17 +++--------------
> kernel/bpf/core.c | 1 -
> 2 files changed, 3 insertions(+), 15 deletions(-)
>
> I assume it's also related to this change:
... this one?
>
> commit 868b104d7379e28013e9d48bdd2db25e0bdcf751
> Author: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Date: Thu Apr 25 17:11:36 2019 -0700
>
> mm/vmalloc: Add flag for freeing of special permsissions
>
> Add a new flag VM_FLUSH_RESET_PERMS, for enabling vfree operations to
> immediately clear executable TLB entries before freeing pages, and handle
> resetting permissions on the directmap. This flag is useful for any kind
> of memory with elevated permissions, or where there can be related
> permissions changes on the directmap. Today this is RO+X and RO memory.
>
> Although this enables directly vfreeing non-writeable memory now,
> non-writable memory cannot be freed in an interrupt because the allocation
> itself is used as a node on deferred free list. So when RO memory needs to
> be freed in an interrupt the code doing the vfree needs to have its own
> work queue, as was the case before the deferred vfree list was added to
> vmalloc.
>
> For architectures with set_direct_map_ implementations this whole operation
> can be done with one TLB flush when centralized like this. For others with
> directmap permissions, currently only arm64, a backup method using
> set_memory functions is used to reset the directmap. When arm64 adds
> set_direct_map_ functions, this backup can be removed.
>
> When the TLB is flushed to both remove TLB entries for the vmalloc range
> mapping and the direct map permissions, the lazy purge operation could be
> done to try to save a TLB flush later. However today vm_unmap_aliases
> could flush a TLB range that does not include the directmap. So a helper
> is added with extra parameters that can allow both the vmalloc address and
> the direct mapping to be flushed during this operation. The behavior of the
> normal vm_unmap_aliases function is unchanged.
>
> Suggested-by: Dave Hansen <dave.hansen@...el.com>
> Suggested-by: Andy Lutomirski <luto@...nel.org>
> Suggested-by: Will Deacon <will.deacon@....com>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@...el.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Cc: <akpm@...ux-foundation.org>
> Cc: <ard.biesheuvel@...aro.org>
> Cc: <deneen.t.dock@...el.com>
> Cc: <kernel-hardening@...ts.openwall.com>
> Cc: <kristen@...ux.intel.com>
> Cc: <linux_dti@...oud.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: H. Peter Anvin <hpa@...or.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Nadav Amit <nadav.amit@...il.com>
> Cc: Rik van Riel <riel@...riel.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Link: https://lkml.kernel.org/r/20190426001143.4983-17-namit@vmware.com
> Signed-off-by: Ingo Molnar <mingo@...nel.org>
>
> Adrian
>
--
Cheers
David / dhildenb
Powered by blists - more mailing lists