All of lore.kernel.org
 help / color / mirror / Atom feed
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] exec: Fix section_covers_addr() for sections with non-zero offset
Date: Wed, 15 Nov 2017 00:03:12 +0100 (CET)	[thread overview]
Message-ID: <alpine.BSF.2.21.1711142359490.42634@zero.eik.bme.hu> (raw)
In-Reply-To: <eba4f539-3474-57a2-a44c-6c60f55d90ac@redhat.com>

On Tue, 14 Nov 2017, Paolo Bonzini wrote:
> On 21/10/2017 13:24, BALATON Zoltan wrote:
>> diff --git a/exec.c b/exec.c
>> index db5ae23..a915817 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -370,7 +370,8 @@ static inline bool section_covers_addr(const MemoryRegionSection *section,
>>       * the section must cover the entire address space.
>>       */
>>      return int128_gethi(section->size) ||
>> -           range_covers_byte(section->offset_within_address_space,
>> +           range_covers_byte(section->offset_within_address_space +
>> +                             section->offset_within_region,
>>                               int128_getlo(section->size), addr);
>>  }
>
> Sorry, this is incorrect.  addr is an address in the address space, and
> range_covers_byte checks if it is between
> section->offset_within_address_space and
> section->offset_within_address_space + section->size.  I am not sure how
> things don't explode completely by adding section->offset_within_region
> (probably it's just because section->offset_within_region is usually 0).

I had a feeling this might not be correct but appeared to work, very 
likely because in most cases the offset is 0 (which is why the bug wasn't 
happening very often either). How about the alternative I've just sent 
according to your suggestion? That also appears to fix the problem and 
hopefully more correct.

Thank you,
BALATON Zoltan

      reply	other threads:[~2017-11-14 23:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-21 11:24 [Qemu-devel] [PATCH] exec: Fix section_covers_addr() for sections with non-zero offset BALATON Zoltan
2017-10-21 12:57 ` no-reply
2017-10-26 22:21 ` BALATON Zoltan
2017-11-14 17:36   ` BALATON Zoltan
2017-11-14 18:04 ` Paolo Bonzini
2017-11-14 23:03   ` BALATON Zoltan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.BSF.2.21.1711142359490.42634@zero.eik.bme.hu \
    --to=balaton@eik.bme.hu \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.