Re: git: e85eaa930862 - main - Have rtld query the page size from the kernel

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 13 Nov 2024 19:44:24 UTC
On 4/7/22 07:38, Andrew Turner wrote:
> The branch main has been updated by andrew:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=e85eaa930862d5b4dc917bc31e8d7254a693635d
> 
> commit e85eaa930862d5b4dc917bc31e8d7254a693635d
> Author:     Andrew Turner <andrew@FreeBSD.org>
> AuthorDate: 2022-04-04 15:05:40 +0000
> Commit:     Andrew Turner <andrew@FreeBSD.org>
> CommitDate: 2022-04-07 14:37:37 +0000
> 
>      Have rtld query the page size from the kernel
>      
>      To allow for a dynamic page size on arm64 have the runtime linker
>      query the kernel for the currentl page size.
>      
>      Reviewed by:    kib
>      Sponsored by:   The FreeBSD Foundation
>      Differential Revision: https://reviews.freebsd.org/D34765

This broke relro handling for rtld.  The reason is that init_pagesizes() is
called after parsing the program headers for rltd in init_rtld().  As a result,
page_size is 0 when rtld_round_page() is called so the relro_size is 0.  The
RTLD_INIT_EARLY_PAGESIZES case was for ia64, and in the early case it's probably
not safe to call sysctl?  If it is safe to call sysctl, we could just always
init pagesizes early?

-- 
John Baldwin