diff mbox series

[v3,04/33] linux-user: Remove qemu_host_page_size from create_elf_tables

Message ID 20240102015808.132373-5-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user: Improve host and guest page size handling | expand

Commit Message

Richard Henderson Jan. 2, 2024, 1:57 a.m. UTC
AT_PAGESZ is supposed to advertise the guest page size.
The random adjustment made here using qemu_host_page_size
does not match anything else within linux-user.

The idea here is good, but should be done more systemically
via adjustment to TARGET_PAGE_SIZE.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Pierrick Bouvier Jan. 8, 2024, 8:55 a.m. UTC | #1
On 1/2/24 05:57, Richard Henderson wrote:
> AT_PAGESZ is supposed to advertise the guest page size.
> The random adjustment made here using qemu_host_page_size
> does not match anything else within linux-user.
> 
> The idea here is good, but should be done more systemically
> via adjustment to TARGET_PAGE_SIZE.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/elfload.c | 8 +-------
>   1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4df565d64b..c166faabab 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2678,13 +2678,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
>       NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
>       NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
>       NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
> -    if ((info->alignment & ~qemu_host_page_mask) != 0) {
> -        /* Target doesn't support host page size alignment */
> -        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
> -    } else {
> -        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE,
> -                                               qemu_host_page_size)));
> -    }
> +    NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
>       NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0));
>       NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
>       NEW_AUX_ENT(AT_ENTRY, info->entry);

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Ilya Leoshkevich Jan. 29, 2024, 10:18 a.m. UTC | #2
On Tue, Jan 02, 2024 at 12:57:39PM +1100, Richard Henderson wrote:
> AT_PAGESZ is supposed to advertise the guest page size.
> The random adjustment made here using qemu_host_page_size
> does not match anything else within linux-user.
> 
> The idea here is good, but should be done more systemically
> via adjustment to TARGET_PAGE_SIZE.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/elfload.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4df565d64b..c166faabab 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2678,13 +2678,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
>      NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
>      NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
>      NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
> -    if ((info->alignment & ~qemu_host_page_mask) != 0) {
> -        /* Target doesn't support host page size alignment */
> -        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
> -    } else {
> -        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE,
> -                                               qemu_host_page_size)));
> -    }
> +    NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
>      NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0));
>      NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
>      NEW_AUX_ENT(AT_ENTRY, info->entry);
> -- 
> 2.34.1

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
diff mbox series

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4df565d64b..c166faabab 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2678,13 +2678,7 @@  static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
     NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
     NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
-    if ((info->alignment & ~qemu_host_page_mask) != 0) {
-        /* Target doesn't support host page size alignment */
-        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
-    } else {
-        NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(MAX(TARGET_PAGE_SIZE,
-                                               qemu_host_page_size)));
-    }
+    NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
     NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info ? interp_info->load_addr : 0));
     NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0);
     NEW_AUX_ENT(AT_ENTRY, info->entry);