qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
@ 2019-06-18  8:34 Andrew Jones
  2019-06-18 11:02 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Jones @ 2019-06-18  8:34 UTC (permalink / raw)
  To: qemu-devel, qemu-arm; +Cc: peter.maydell

We need to check ram_end, not ram_size.

Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
DTB off the end of RAM")
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 hw/arm/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index b2f93f6beff6..8a280ab3ed49 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
                              info->initrd_filename);
                 exit(1);
             }
-            if (info->initrd_start + initrd_size > info->ram_size) {
+            if (info->initrd_start + initrd_size > ram_end) {
                 error_report("could not load initrd '%s': "
                              "too big to fit into RAM after the kernel",
                              info->initrd_filename);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18  8:34 [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup Andrew Jones
@ 2019-06-18 11:02 ` Peter Maydell
  2019-06-18 11:31   ` Philippe Mathieu-Daudé
  2019-06-18 11:55   ` Andrew Jones
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2019-06-18 11:02 UTC (permalink / raw)
  To: Andrew Jones; +Cc: qemu-arm, QEMU Developers

On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
>
> We need to check ram_end, not ram_size.
>
> Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
> DTB off the end of RAM")
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  hw/arm/boot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index b2f93f6beff6..8a280ab3ed49 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
>                               info->initrd_filename);
>                  exit(1);
>              }
> -            if (info->initrd_start + initrd_size > info->ram_size) {
> +            if (info->initrd_start + initrd_size > ram_end) {
>                  error_report("could not load initrd '%s': "
>                               "too big to fit into RAM after the kernel",
>                               info->initrd_filename);
> --
> 2.20.1

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

I think I missed this because my test case doesn't have an
initrd -- direct kernel boot works fine if all you're
passing to QEMU is the kernel... I think we could clarify
the commit message a little:

hw/arm/boot: fix direct kernel boot with initrd

Fix the condition used to check whether the initrd fits
into RAM; this meant we were spuriously refusing to do
a direct boot of a kernel in some cases if an initrd
was also passed on the command line.

?

(if you agree I can just fix up the commit message when I apply it.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 11:02 ` Peter Maydell
@ 2019-06-18 11:31   ` Philippe Mathieu-Daudé
  2019-06-18 11:55   ` Andrew Jones
  1 sibling, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-18 11:31 UTC (permalink / raw)
  To: Peter Maydell, Andrew Jones; +Cc: qemu-arm, QEMU Developers

On 6/18/19 1:02 PM, Peter Maydell wrote:
> On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
>>
>> We need to check ram_end, not ram_size.
>>
>> Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
>> DTB off the end of RAM")
>> Signed-off-by: Andrew Jones <drjones@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>> ---
>>  hw/arm/boot.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
>> index b2f93f6beff6..8a280ab3ed49 100644
>> --- a/hw/arm/boot.c
>> +++ b/hw/arm/boot.c
>> @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
>>                               info->initrd_filename);
>>                  exit(1);
>>              }
>> -            if (info->initrd_start + initrd_size > info->ram_size) {
>> +            if (info->initrd_start + initrd_size > ram_end) {
>>                  error_report("could not load initrd '%s': "
>>                               "too big to fit into RAM after the kernel",
>>                               info->initrd_filename);
>> --
>> 2.20.1
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> I think I missed this because my test case doesn't have an
> initrd -- direct kernel boot works fine if all you're
> passing to QEMU is the kernel... I think we could clarify
> the commit message a little:
> 
> hw/arm/boot: fix direct kernel boot with initrd
> 
> Fix the condition used to check whether the initrd fits
> into RAM; this meant we were spuriously refusing to do
> a direct boot of a kernel in some cases if an initrd
> was also passed on the command line.
> 
> ?
> 
> (if you agree I can just fix up the commit message when I apply it.)
> 
> thanks
> -- PMM
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 11:02 ` Peter Maydell
  2019-06-18 11:31   ` Philippe Mathieu-Daudé
@ 2019-06-18 11:55   ` Andrew Jones
  2019-06-18 11:58     ` Peter Maydell
  2019-06-18 12:08     ` Philippe Mathieu-Daudé
  1 sibling, 2 replies; 8+ messages in thread
From: Andrew Jones @ 2019-06-18 11:55 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, QEMU Developers

On Tue, Jun 18, 2019 at 12:02:37PM +0100, Peter Maydell wrote:
> On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
> >
> > We need to check ram_end, not ram_size.
> >
> > Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
> > DTB off the end of RAM")
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  hw/arm/boot.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> > index b2f93f6beff6..8a280ab3ed49 100644
> > --- a/hw/arm/boot.c
> > +++ b/hw/arm/boot.c
> > @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
> >                               info->initrd_filename);
> >                  exit(1);
> >              }
> > -            if (info->initrd_start + initrd_size > info->ram_size) {
> > +            if (info->initrd_start + initrd_size > ram_end) {
> >                  error_report("could not load initrd '%s': "
> >                               "too big to fit into RAM after the kernel",
> >                               info->initrd_filename);
> > --
> > 2.20.1
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> I think I missed this because my test case doesn't have an
> initrd -- direct kernel boot works fine if all you're
> passing to QEMU is the kernel... I think we could clarify
> the commit message a little:

I found it using kvm-unit-tests which uses a small initrd to
pass environment variables to the guest. All the tests started
to report FAIL.

> 
> hw/arm/boot: fix direct kernel boot with initrd
> 
> Fix the condition used to check whether the initrd fits
> into RAM; this meant we were spuriously refusing to do
> a direct boot of a kernel in some cases if an initrd
> was also passed on the command line.

Actually I think we need another fix for this error too. We
weren't actually refusing do direct boot the kernel, but we
should have been. We're missing the 'exit(1)' after the error
message.

> 
> ?
> 
> (if you agree I can just fix up the commit message when I apply it.)

I agree with the improved commit message if we also add the
'exit(1)', otherwise "refusing to boot" isn't the right thing
to say.

Thanks,
drew

> 
> thanks
> -- PMM
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 11:55   ` Andrew Jones
@ 2019-06-18 11:58     ` Peter Maydell
  2019-06-18 12:50       ` Andrew Jones
  2019-06-18 12:08     ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2019-06-18 11:58 UTC (permalink / raw)
  To: Andrew Jones; +Cc: qemu-arm, QEMU Developers

On Tue, 18 Jun 2019 at 12:56, Andrew Jones <drjones@redhat.com> wrote:
>
> On Tue, Jun 18, 2019 at 12:02:37PM +0100, Peter Maydell wrote:
> > On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
> > >
> > > We need to check ram_end, not ram_size.
> > >
> > > Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
> > > DTB off the end of RAM")
> > > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > > ---
> > >  hw/arm/boot.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> > > index b2f93f6beff6..8a280ab3ed49 100644
> > > --- a/hw/arm/boot.c
> > > +++ b/hw/arm/boot.c
> > > @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
> > >                               info->initrd_filename);
> > >                  exit(1);
> > >              }
> > > -            if (info->initrd_start + initrd_size > info->ram_size) {
> > > +            if (info->initrd_start + initrd_size > ram_end) {
> > >                  error_report("could not load initrd '%s': "
> > >                               "too big to fit into RAM after the kernel",
> > >                               info->initrd_filename);
> > > --
> > > 2.20.1
> >
> > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> >
> > I think I missed this because my test case doesn't have an
> > initrd -- direct kernel boot works fine if all you're
> > passing to QEMU is the kernel... I think we could clarify
> > the commit message a little:
>
> I found it using kvm-unit-tests which uses a small initrd to
> pass environment variables to the guest. All the tests started
> to report FAIL.
>
> >
> > hw/arm/boot: fix direct kernel boot with initrd
> >
> > Fix the condition used to check whether the initrd fits
> > into RAM; this meant we were spuriously refusing to do
> > a direct boot of a kernel in some cases if an initrd
> > was also passed on the command line.
>
> Actually I think we need another fix for this error too. We
> weren't actually refusing do direct boot the kernel, but we
> should have been. We're missing the 'exit(1)' after the error
> message.

Hmm, so we are. Do you want to send a v2 then, which fixes
that too and fixes up the commit message?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 11:55   ` Andrew Jones
  2019-06-18 11:58     ` Peter Maydell
@ 2019-06-18 12:08     ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-06-18 12:08 UTC (permalink / raw)
  To: Andrew Jones, Peter Maydell; +Cc: qemu-arm, QEMU Developers

On 6/18/19 1:55 PM, Andrew Jones wrote:
> On Tue, Jun 18, 2019 at 12:02:37PM +0100, Peter Maydell wrote:
>> On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
>>>
>>> We need to check ram_end, not ram_size.
>>>
>>> Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
>>> DTB off the end of RAM")
>>> Signed-off-by: Andrew Jones <drjones@redhat.com>
>>> ---
>>>  hw/arm/boot.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
>>> index b2f93f6beff6..8a280ab3ed49 100644
>>> --- a/hw/arm/boot.c
>>> +++ b/hw/arm/boot.c
>>> @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
>>>                               info->initrd_filename);
>>>                  exit(1);
>>>              }
>>> -            if (info->initrd_start + initrd_size > info->ram_size) {
>>> +            if (info->initrd_start + initrd_size > ram_end) {
>>>                  error_report("could not load initrd '%s': "
>>>                               "too big to fit into RAM after the kernel",
>>>                               info->initrd_filename);
>>> --
>>> 2.20.1
>>
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>>
>> I think I missed this because my test case doesn't have an
>> initrd -- direct kernel boot works fine if all you're
>> passing to QEMU is the kernel... I think we could clarify
>> the commit message a little:
> 
> I found it using kvm-unit-tests which uses a small initrd to
> pass environment variables to the guest. All the tests started
> to report FAIL.
> 
>>
>> hw/arm/boot: fix direct kernel boot with initrd
>>
>> Fix the condition used to check whether the initrd fits
>> into RAM; this meant we were spuriously refusing to do
>> a direct boot of a kernel in some cases if an initrd
>> was also passed on the command line.
> 
> Actually I think we need another fix for this error too. We
> weren't actually refusing do direct boot the kernel, but we
> should have been. We're missing the 'exit(1)' after the error
> message.
> 
>>
>> ?
>>
>> (if you agree I can just fix up the commit message when I apply it.)
> 
> I agree with the improved commit message if we also add the
> 'exit(1)', otherwise "refusing to boot" isn't the right thing
> to say.

Indeed. So for this patch + Peter comment + exit():

Fixes: 852dc64d665
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 11:58     ` Peter Maydell
@ 2019-06-18 12:50       ` Andrew Jones
  2019-06-18 13:00         ` Andrew Jones
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Jones @ 2019-06-18 12:50 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, QEMU Developers

On Tue, Jun 18, 2019 at 12:58:30PM +0100, Peter Maydell wrote:
> On Tue, 18 Jun 2019 at 12:56, Andrew Jones <drjones@redhat.com> wrote:
> >
> > On Tue, Jun 18, 2019 at 12:02:37PM +0100, Peter Maydell wrote:
> > > On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
> > > >
> > > > We need to check ram_end, not ram_size.
> > > >
> > > > Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
> > > > DTB off the end of RAM")
> > > > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > > > ---
> > > >  hw/arm/boot.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> > > > index b2f93f6beff6..8a280ab3ed49 100644
> > > > --- a/hw/arm/boot.c
> > > > +++ b/hw/arm/boot.c
> > > > @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
> > > >                               info->initrd_filename);
> > > >                  exit(1);
> > > >              }
> > > > -            if (info->initrd_start + initrd_size > info->ram_size) {
> > > > +            if (info->initrd_start + initrd_size > ram_end) {
> > > >                  error_report("could not load initrd '%s': "
> > > >                               "too big to fit into RAM after the kernel",
> > > >                               info->initrd_filename);
> > > > --
> > > > 2.20.1
> > >
> > > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> > >
> > > I think I missed this because my test case doesn't have an
> > > initrd -- direct kernel boot works fine if all you're
> > > passing to QEMU is the kernel... I think we could clarify
> > > the commit message a little:
> >
> > I found it using kvm-unit-tests which uses a small initrd to
> > pass environment variables to the guest. All the tests started
> > to report FAIL.
> >
> > >
> > > hw/arm/boot: fix direct kernel boot with initrd
> > >
> > > Fix the condition used to check whether the initrd fits
> > > into RAM; this meant we were spuriously refusing to do
> > > a direct boot of a kernel in some cases if an initrd
> > > was also passed on the command line.
> >
> > Actually I think we need another fix for this error too. We
> > weren't actually refusing do direct boot the kernel, but we
> > should have been. We're missing the 'exit(1)' after the error
> > message.
> 
> Hmm, so we are. Do you want to send a v2 then, which fixes
> that too and fixes up the commit message?

On it's way.

Thanks,
drew

> 
> thanks
> -- PMM


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup
  2019-06-18 12:50       ` Andrew Jones
@ 2019-06-18 13:00         ` Andrew Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jones @ 2019-06-18 13:00 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, QEMU Developers

On Tue, Jun 18, 2019 at 02:50:15PM +0200, Andrew Jones wrote:
> On Tue, Jun 18, 2019 at 12:58:30PM +0100, Peter Maydell wrote:
> > On Tue, 18 Jun 2019 at 12:56, Andrew Jones <drjones@redhat.com> wrote:
> > >
> > > On Tue, Jun 18, 2019 at 12:02:37PM +0100, Peter Maydell wrote:
> > > > On Tue, 18 Jun 2019 at 09:34, Andrew Jones <drjones@redhat.com> wrote:
> > > > >
> > > > > We need to check ram_end, not ram_size.
> > > > >
> > > > > Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
> > > > > DTB off the end of RAM")
> > > > > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > > > > ---
> > > > >  hw/arm/boot.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> > > > > index b2f93f6beff6..8a280ab3ed49 100644
> > > > > --- a/hw/arm/boot.c
> > > > > +++ b/hw/arm/boot.c
> > > > > @@ -1109,7 +1109,7 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
> > > > >                               info->initrd_filename);
> > > > >                  exit(1);
> > > > >              }
> > > > > -            if (info->initrd_start + initrd_size > info->ram_size) {
> > > > > +            if (info->initrd_start + initrd_size > ram_end) {
> > > > >                  error_report("could not load initrd '%s': "
> > > > >                               "too big to fit into RAM after the kernel",
> > > > >                               info->initrd_filename);
> > > > > --
> > > > > 2.20.1
> > > >
> > > > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> > > >
> > > > I think I missed this because my test case doesn't have an
> > > > initrd -- direct kernel boot works fine if all you're
> > > > passing to QEMU is the kernel... I think we could clarify
> > > > the commit message a little:
> > >
> > > I found it using kvm-unit-tests which uses a small initrd to
> > > pass environment variables to the guest. All the tests started
> > > to report FAIL.
> > >
> > > >
> > > > hw/arm/boot: fix direct kernel boot with initrd
> > > >
> > > > Fix the condition used to check whether the initrd fits
> > > > into RAM; this meant we were spuriously refusing to do
> > > > a direct boot of a kernel in some cases if an initrd
> > > > was also passed on the command line.
> > >
> > > Actually I think we need another fix for this error too. We
> > > weren't actually refusing do direct boot the kernel, but we
> > > should have been. We're missing the 'exit(1)' after the error
> > > message.
> > 
> > Hmm, so we are. Do you want to send a v2 then, which fixes
> > that too and fixes up the commit message?
> 
> On it's way.
>

Argh, just fired it off by forgot the '-v2' on my format-patch so
the subject tag won't be right. Sorry about that.

drew


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-06-18 13:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18  8:34 [Qemu-devel] [PATCH] hw/arm/boot: fix direct kernel boot setup Andrew Jones
2019-06-18 11:02 ` Peter Maydell
2019-06-18 11:31   ` Philippe Mathieu-Daudé
2019-06-18 11:55   ` Andrew Jones
2019-06-18 11:58     ` Peter Maydell
2019-06-18 12:50       ` Andrew Jones
2019-06-18 13:00         ` Andrew Jones
2019-06-18 12:08     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).