From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org,
"Dr. David Alan Gilbert" <dave@treblig.org>,
Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>,
Zhao Liu <zhao1.liu@intel.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
"open list:X86 KVM CPUs" <kvm@vger.kernel.org>
Subject: Re: [PATCH] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers
Date: Thu, 23 Jul 2026 10:33:36 +0200 [thread overview]
Message-ID: <e7d3e9dc-be97-40f3-b426-3e93a242410a@oss.qualcomm.com> (raw)
In-Reply-To: <20260521145451.1831984-1-marcandre.lureau@redhat.com>
Hi,
On 21/5/26 16:54, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> gpa2hva() returns a referenced MemoryRegion via its p_mr out-parameter
> (inherited from memory_region_find()), but both SEV callers were failing
> to release it.
Comment orthogonal to your fix; odd to have a non-monitor code
call an undocumented monitor method. Should the method be moved
out of monitor/hmp-cmds.c somewhere into system/ and documented
(likely in system/physmem.c, also moving the declaration to
"system/memory.h")? Besides some day we should be able to build
without monitor.
> Fixes: c7f7e6970d3b ("sev: add sev-inject-launch-secret")
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> include/system/memory.h | 2 ++
> target/i386/sev.c | 4 ++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/system/memory.h b/include/system/memory.h
> index 1417132f6d9..53f65a224bb 100644
> --- a/include/system/memory.h
> +++ b/include/system/memory.h
> @@ -1343,6 +1343,8 @@ void memory_region_ref(MemoryRegion *mr);
> */
> void memory_region_unref(MemoryRegion *mr);
>
> +G_DEFINE_AUTOPTR_CLEANUP_FUNC(MemoryRegion, memory_region_unref)
> +
> /**
> * memory_region_init_io: Initialize an I/O memory region.
> *
prev parent reply other threads:[~2026-07-23 8:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 14:54 [PATCH] target/i386/sev: fix MemoryRegion reference leaks in gpa2hva callers marcandre.lureau
2026-05-21 16:25 ` Peter Xu
2026-07-22 11:10 ` Marc-André Lureau
2026-07-23 2:42 ` Zhao Liu
2026-07-23 8:33 ` Philippe Mathieu-Daudé [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=e7d3e9dc-be97-40f3-b426-3e93a242410a@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=kvm@vger.kernel.org \
--cc=marcandre.lureau@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhao1.liu@intel.com \
/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