* [PATCH] mm: unhide get_dump_page() function
@ 2025-02-24 15:12 Arnd Bergmann
2025-02-24 18:40 ` Kees Cook
2025-02-24 18:42 ` Brian Mak
0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-02-24 15:12 UTC (permalink / raw)
To: Andrew Morton, Kees Cook, Brian Mak
Cc: Arnd Bergmann, David Hildenbrand, Peter Xu, Jason Gunthorpe,
John Hubbard, Steve Sistare, Vivek Kasireddy, Yang Shi,
Christophe Leroy, linux-mm, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The definition of get_dump_page() is guarded by CONFIG_ELF_CORE, but
the caller has now moved into a function that is built based on
CONFIG_COREDUMP, which leads to a possible link failure:
ld.lld-21: error: undefined symbol: get_dump_page
>>> referenced by coredump.c
>>> fs/coredump.o:(dump_vma_snapshot) in archive vmlinux.a
Change the #ifdef block around the definition to match the caller.
In practice there is very little difference, as setting COREDUMP
but not ELF_CORE is not useful.
Fixes: ff41385709f0 ("coredump: Only sort VMAs when truncating or core_sort_vma sysctl is set")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
mm/gup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index d846c0ce41d6..15d6d7b5df1d 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2266,7 +2266,7 @@ EXPORT_SYMBOL(fault_in_readable);
*
* Called without mmap_lock (takes and releases the mmap_lock by itself).
*/
-#ifdef CONFIG_ELF_CORE
+#ifdef CONFIG_COREDUMP
struct page *get_dump_page(unsigned long addr, int *locked)
{
struct page *page;
@@ -2276,7 +2276,7 @@ struct page *get_dump_page(unsigned long addr, int *locked)
FOLL_FORCE | FOLL_DUMP | FOLL_GET);
return (ret == 1) ? page : NULL;
}
-#endif /* CONFIG_ELF_CORE */
+#endif /* CONFIG_COREDUMP */
#ifdef CONFIG_MIGRATION
--
2.39.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: unhide get_dump_page() function
2025-02-24 15:12 [PATCH] mm: unhide get_dump_page() function Arnd Bergmann
@ 2025-02-24 18:40 ` Kees Cook
2025-02-24 18:42 ` Brian Mak
1 sibling, 0 replies; 4+ messages in thread
From: Kees Cook @ 2025-02-24 18:40 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, Brian Mak, Arnd Bergmann, David Hildenbrand,
Peter Xu, Jason Gunthorpe, John Hubbard, Steve Sistare,
Vivek Kasireddy, Yang Shi, Christophe Leroy, linux-mm,
linux-kernel
On Mon, Feb 24, 2025 at 04:12:21PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The definition of get_dump_page() is guarded by CONFIG_ELF_CORE, but
> the caller has now moved into a function that is built based on
> CONFIG_COREDUMP, which leads to a possible link failure:
>
> ld.lld-21: error: undefined symbol: get_dump_page
> >>> referenced by coredump.c
> >>> fs/coredump.o:(dump_vma_snapshot) in archive vmlinux.a
>
> Change the #ifdef block around the definition to match the caller.
> In practice there is very little difference, as setting COREDUMP
> but not ELF_CORE is not useful.
>
> Fixes: ff41385709f0 ("coredump: Only sort VMAs when truncating or core_sort_vma sysctl is set")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Thanks for this! I think I'm going to split up ff41385709f0 -- between
this #ifdef and the recent prototype changes, it's going to be not a
great backport, so I'll pick this up too. I expect I'll have a simple
sysctl fix for -rc5 and then the rest in -next.
-Kees
> ---
> mm/gup.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/gup.c b/mm/gup.c
> index d846c0ce41d6..15d6d7b5df1d 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -2266,7 +2266,7 @@ EXPORT_SYMBOL(fault_in_readable);
> *
> * Called without mmap_lock (takes and releases the mmap_lock by itself).
> */
> -#ifdef CONFIG_ELF_CORE
> +#ifdef CONFIG_COREDUMP
> struct page *get_dump_page(unsigned long addr, int *locked)
> {
> struct page *page;
> @@ -2276,7 +2276,7 @@ struct page *get_dump_page(unsigned long addr, int *locked)
> FOLL_FORCE | FOLL_DUMP | FOLL_GET);
> return (ret == 1) ? page : NULL;
> }
> -#endif /* CONFIG_ELF_CORE */
> +#endif /* CONFIG_COREDUMP */
>
> #ifdef CONFIG_MIGRATION
>
> --
> 2.39.5
>
--
Kees Cook
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: unhide get_dump_page() function
2025-02-24 15:12 [PATCH] mm: unhide get_dump_page() function Arnd Bergmann
2025-02-24 18:40 ` Kees Cook
@ 2025-02-24 18:42 ` Brian Mak
2025-02-24 19:06 ` Arnd Bergmann
1 sibling, 1 reply; 4+ messages in thread
From: Brian Mak @ 2025-02-24 18:42 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andrew Morton, Kees Cook, Arnd Bergmann, David Hildenbrand,
Peter Xu, Jason Gunthorpe, John Hubbard, Steve Sistare,
Vivek Kasireddy, Yang Shi, Christophe Leroy, linux-mm,
linux-kernel
On Feb 24, 2025, at 7:12 AM, Arnd Bergmann <arnd@kernel.org> wrote:
> The definition of get_dump_page() is guarded by CONFIG_ELF_CORE, but
> the caller has now moved into a function that is built based on
> CONFIG_COREDUMP, which leads to a possible link failure:
>
> ld.lld-21: error: undefined symbol: get_dump_page
>>>> referenced by coredump.c
>>>> fs/coredump.o:(dump_vma_snapshot) in archive vmlinux.a
Kernel test robot reported this issue yesterday here:
https://lore.kernel.org/oe-kbuild-all/202502231914.ROOVWMZN-lkp@intel.com/
https://lore.kernel.org/oe-kbuild-all/202502231818.fP8cuxmf-lkp@intel.com/
> Change the #ifdef block around the definition to match the caller.
> In practice there is very little difference, as setting COREDUMP
> but not ELF_CORE is not useful.
Good catch! I wonder if we should guard the sparse dump size calculation
logic from the get_dump_page() caller behind CONFIG_ELF_CORE instead
though. I guess the question becomes, will we ever have a non-ELF core
dump format that won't skip zero pages?
Anyway, I'm fine with this fix as-is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: unhide get_dump_page() function
2025-02-24 18:42 ` Brian Mak
@ 2025-02-24 19:06 ` Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2025-02-24 19:06 UTC (permalink / raw)
To: Brian Mak, Arnd Bergmann
Cc: Andrew Morton, Kees Cook, David Hildenbrand, peterx,
Jason Gunthorpe, John Hubbard, steven.sistare, Vivek Kasireddy,
Yang Shi, Christophe Leroy, linux-mm, linux-kernel
On Mon, Feb 24, 2025, at 19:42, Brian Mak wrote:
> On Feb 24, 2025, at 7:12 AM, Arnd Bergmann <arnd@kernel.org> wrote:
>
>> The definition of get_dump_page() is guarded by CONFIG_ELF_CORE, but
>> the caller has now moved into a function that is built based on
>> CONFIG_COREDUMP, which leads to a possible link failure:
>>
>> ld.lld-21: error: undefined symbol: get_dump_page
>>>>> referenced by coredump.c
>>>>> fs/coredump.o:(dump_vma_snapshot) in archive vmlinux.a
>
> Kernel test robot reported this issue yesterday here:
> https://lore.kernel.org/oe-kbuild-all/202502231914.ROOVWMZN-lkp@intel.com/
> https://lore.kernel.org/oe-kbuild-all/202502231818.fP8cuxmf-lkp@intel.com/
>
>> Change the #ifdef block around the definition to match the caller.
>> In practice there is very little difference, as setting COREDUMP
>> but not ELF_CORE is not useful.
>
> Good catch! I wonder if we should guard the sparse dump size calculation
> logic from the get_dump_page() caller behind CONFIG_ELF_CORE instead
> though. I guess the question becomes, will we ever have a non-ELF core
> dump format that won't skip zero pages?
>
> Anyway, I'm fine with this fix as-is.
The only other code that is guarded by CONFIG_COREDUMP now
is the powerpc spufs, but that is only used with ELF_CORE as
well.
The last non-ELF coredump support was removed in 2022, earlier
versions had some form of coredump for flat, a.out and som
binaries.
We can probably just combine ELF_CORE and COREDUMP into a
single Kconfig symbol.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-24 19:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-24 15:12 [PATCH] mm: unhide get_dump_page() function Arnd Bergmann
2025-02-24 18:40 ` Kees Cook
2025-02-24 18:42 ` Brian Mak
2025-02-24 19:06 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox