From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH] memory: Do not allow subregion out of the parent region range
Date: Mon, 16 Dec 2019 14:08:17 +0100 [thread overview]
Message-ID: <da81a3e7-62a8-f46e-c12f-4dead2a9091f@redhat.com> (raw)
In-Reply-To: <20191214160223.20012-1-philmd@redhat.com>
On 14/12/19 17:02, Philippe Mathieu-Daudé wrote:
> If a subregion is mapped out of the parent region range, it
> will never get accessed. Since this is a bug, abort to help
> the developer notice the mistake.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> memory.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/memory.c b/memory.c
> index 06484c2bff..61f355dcd5 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -2390,6 +2390,7 @@ static void memory_region_add_subregion_common(MemoryRegion *mr,
> {
> assert(!subregion->container);
> subregion->container = mr;
> + assert(offset + memory_region_size(subregion) <= memory_region_size(mr));
> subregion->addr = offset;
> memory_region_update_container_subregions(subregion);
> }
>
I think in some cases this could be intentional, for example if you have
different models with different BAR sizes and you organize this with the
same tree of MemoryRegion and different sizes for the parent. I'm not
saying this happens in the current devices we support, I'm just
wondering if it should be a reason not to apply the patch. I suppose
you did spend some time debugging something where the patch would have
been useful; what was that something?
Paolo
next prev parent reply other threads:[~2019-12-16 13:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-14 16:02 [PATCH] memory: Do not allow subregion out of the parent region range Philippe Mathieu-Daudé
2019-12-16 13:08 ` Paolo Bonzini [this message]
2019-12-16 17:46 ` Philippe Mathieu-Daudé
2019-12-17 10:51 ` Paolo Bonzini
2019-12-17 11:58 ` Christophe de Dinechin
2019-12-17 16:57 ` Richard Henderson
2019-12-17 18:17 ` Peter Maydell
2019-12-17 18:31 ` Paolo Bonzini
2019-12-17 18:52 ` Alex Williamson
2019-12-17 19:17 ` Philippe Mathieu-Daudé
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=da81a3e7-62a8-f46e-c12f-4dead2a9091f@redhat.com \
--to=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@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 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).