From: Anthony PERARD <anthony.perard@vates.tech>
To: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: qemu-devel@nongnu.org, sstabellini@kernel.org, paul@xen.org,
edgar.iglesias@amd.com, xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1 2/2] xen: mapcache: Fix unmapping of first entries in buckets
Date: Thu, 04 Jul 2024 14:23:41 +0000 [thread overview]
Message-ID: <ZoawbAnukIBkYWCw@l14> (raw)
In-Reply-To: <20240701224421.1432654-3-edgar.iglesias@gmail.com>
On Tue, Jul 02, 2024 at 12:44:21AM +0200, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>
>
> This fixes the clobbering of the entry->next pointer when
> unmapping the first entry in a bucket of a mapcache.
>
> Fixes: 123acd816d ("xen: mapcache: Unmap first entries in buckets")
> Reported-by: Anthony PERARD <anthony.perard@vates.tech>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
> ---
> hw/xen/xen-mapcache.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xen/xen-mapcache.c b/hw/xen/xen-mapcache.c
> index 5f23b0adbe..18ba7b1d8f 100644
> --- a/hw/xen/xen-mapcache.c
> +++ b/hw/xen/xen-mapcache.c
> @@ -597,7 +597,17 @@ static void xen_invalidate_map_cache_entry_unlocked(MapCache *mc,
> pentry->next = entry->next;
> g_free(entry);
> } else {
> - memset(entry, 0, sizeof *entry);
> + /*
> + * Invalidate mapping but keep entry->next pointing to the rest
> + * of the list.
> + *
> + * Note that lock is already zero here, otherwise we don't unmap.
> + */
> + entry->paddr_index = 0;
> + entry->vaddr_base = NULL;
> + entry->valid_mapping = NULL;
> + entry->flags = 0;
> + entry->size = 0;
This kind of feels like mc->entry should be an array of pointer rather
than an array of MapCacheEntry but that seems to work well enough and
not the first time entries are been cleared like that.
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
next prev parent reply other threads:[~2024-07-04 14:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-01 22:44 [PATCH v1 0/2] xen: mapcache: Fix unmapping of first the entry in a bucket Edgar E. Iglesias
2024-07-01 22:44 ` [PATCH v1 1/2] physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs Edgar E. Iglesias
2024-07-04 10:26 ` Alex Bennée
2024-07-04 11:42 ` Edgar E. Iglesias
2024-07-04 12:33 ` Alex Bennée
2024-07-08 23:14 ` Stefano Stabellini
2024-07-01 22:44 ` [PATCH v1 2/2] xen: mapcache: Fix unmapping of first entries in buckets Edgar E. Iglesias
2024-07-04 14:23 ` Anthony PERARD [this message]
2024-07-04 16:44 ` Alex Bennée
2024-07-04 18:48 ` Edgar E. Iglesias via
2024-07-06 6:27 ` Edgar E. Iglesias
2024-07-07 8:45 ` Alex Bennée
2024-07-08 23:16 ` Stefano Stabellini
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=ZoawbAnukIBkYWCw@l14 \
--to=anthony.perard@vates.tech \
--cc=edgar.iglesias@amd.com \
--cc=edgar.iglesias@gmail.com \
--cc=paul@xen.org \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).