diff mbox series

[v4,36/36] linux-user: Remove pgb_dynamic alignment assertion

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

Commit Message

Richard Henderson Feb. 15, 2024, 6:20 a.m. UTC
The assertion was never correct, because the alignment is a composite
of the image alignment and SHMLBA.  Even if the alignment didn't match
the image an assertion would not be correct -- more appropriate would
be an error message about an ill formed image.  But the image cannot
be held to SHMLBA under any circumstances.

Fixes: ee94743034b ("linux-user: completely re-write init_guest_space")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2157
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 15, 2024, 7:07 a.m. UTC | #1
On 15/2/24 07:20, Richard Henderson wrote:
> The assertion was never correct, because the alignment is a composite
> of the image alignment and SHMLBA.  Even if the alignment didn't match
> the image an assertion would not be correct -- more appropriate would
> be an error message about an ill formed image.  But the image cannot
> be held to SHMLBA under any circumstances.
> 
> Fixes: ee94743034b ("linux-user: completely re-write init_guest_space")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2157
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/elfload.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index f3f1ab4f69..d92d66ca1e 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -3022,8 +3022,6 @@ static void pgb_dynamic(const char *image_name, uintptr_t guest_loaddr,
>       uintptr_t brk, ret;
>       PGBAddrs ga;
>   
> -    assert(QEMU_IS_ALIGNED(guest_loaddr, align));
> -
>       /* Try the identity map first. */
>       if (pgb_addr_set(&ga, guest_loaddr, guest_hiaddr, true)) {
>           brk = (uintptr_t)sbrk(0);

I suppose this isn't part of this series since posted as
https://lore.kernel.org/qemu-devel/20240214045413.541677-1-richard.henderson@linaro.org/

Still:
Reported-by: Alexey Sheplyakov <asheplyakov@yandex.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Richard Henderson Feb. 15, 2024, 7:23 a.m. UTC | #2
On 2/14/24 21:07, Philippe Mathieu-Daudé wrote:
> On 15/2/24 07:20, Richard Henderson wrote:
>> The assertion was never correct, because the alignment is a composite
>> of the image alignment and SHMLBA.  Even if the alignment didn't match
>> the image an assertion would not be correct -- more appropriate would
>> be an error message about an ill formed image.  But the image cannot
>> be held to SHMLBA under any circumstances.
>>
>> Fixes: ee94743034b ("linux-user: completely re-write init_guest_space")
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2157
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   linux-user/elfload.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
>> index f3f1ab4f69..d92d66ca1e 100644
>> --- a/linux-user/elfload.c
>> +++ b/linux-user/elfload.c
>> @@ -3022,8 +3022,6 @@ static void pgb_dynamic(const char *image_name, uintptr_t 
>> guest_loaddr,
>>       uintptr_t brk, ret;
>>       PGBAddrs ga;
>> -    assert(QEMU_IS_ALIGNED(guest_loaddr, align));
>> -
>>       /* Try the identity map first. */
>>       if (pgb_addr_set(&ga, guest_loaddr, guest_hiaddr, true)) {
>>           brk = (uintptr_t)sbrk(0);
> 
> I suppose this isn't part of this series since posted as
> https://lore.kernel.org/qemu-devel/20240214045413.541677-1-richard.henderson@linaro.org/
> 
> Still:
> Reported-by: Alexey Sheplyakov <asheplyakov@yandex.ru>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Whoops, no.  But I did need it for testing on ppc64 64k page host.


r~
diff mbox series

Patch

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index f3f1ab4f69..d92d66ca1e 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3022,8 +3022,6 @@  static void pgb_dynamic(const char *image_name, uintptr_t guest_loaddr,
     uintptr_t brk, ret;
     PGBAddrs ga;
 
-    assert(QEMU_IS_ALIGNED(guest_loaddr, align));
-
     /* Try the identity map first. */
     if (pgb_addr_set(&ga, guest_loaddr, guest_hiaddr, true)) {
         brk = (uintptr_t)sbrk(0);