From: sashiko-bot@kernel.org
To: "Kameron Carr" <kameroncarr@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2 1/2] Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted()
Date: Fri, 31 Jul 2026 23:34:56 +0000 [thread overview]
Message-ID: <20260731233456.95BC71F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260730233359.3850612-2-kameroncarr@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] In `vmbus_teardown_gpadl()`, if `vmbus_post_msg()` fails, the resulting error code is unconditionally overwritten, causing the function to silently return success instead of propagating the failure.
--
--- Patch [1]: [PATCH v2 1/2] Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted() ---
commit aab401fb7e15b1b2168ba8341d7d172ef6d0525f
Author: Kameron Carr <kameroncarr@linux.microsoft.com>
Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted()
This commit introduces a new function for callers to establish a GPADL for a
buffer they have already decrypted themselves. It adds a new GPADL type
HV_GPADL_BUFFER_DECRYPTED to track this decryption status. Existing callers
are unaffected by this change.
> diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
> index 6821f225248b1..4782f5070bba9 100644
> --- a/drivers/hv/channel.c
> +++ b/drivers/hv/channel.c
[ ... ]
> @@ -460,7 +462,8 @@ static int __vmbus_establish_gpadl(struct vmbus_channel *channel,
> }
>
> gpadl->decrypted = !((channel->co_external_memory && type == HV_GPADL_BUFFER) ||
> - (channel->co_ring_buffer && type == HV_GPADL_RING));
> + (channel->co_ring_buffer && type == HV_GPADL_RING) ||
> + (type == HV_GPADL_BUFFER_DECRYPTED));
> if (gpadl->decrypted) {
> /*
> * The "decrypted" flag being true assumes that set_memory_decrypted() succeeds.
[Severity: High]
This is a pre-existing issue, but I noticed a potential regression in how
GPADL teardowns are handled.
Looking at drivers/hv/channel.c in vmbus_teardown_gpadl(), if the call to
vmbus_post_msg() fails (for example, returning -ENOBUFS due to transient
hypervisor resource exhaustion), the code jumps to the post_msg_err label.
However, the error code in ret is unconditionally overwritten at the end of
the function:
post_msg_err:
...
if (gpadl->decrypted)
ret = set_memory_encrypted((unsigned long)gpadl->buffer,
PFN_UP(gpadl->size));
else
ret = 0;
Can this mask the communication failure with the hypervisor?
Because the failure is masked, the caller incorrectly assumes the hypervisor
has successfully torn down the GPADL and frees the memory back to the guest
page allocator, but the hypervisor still retains the GPADL mapping and may
continue to write to it.
Could this lead to guest memory corruption or a use-after-free when the
hypervisor accesses the released memory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730233359.3850612-1-kameroncarr@linux.microsoft.com?part=1
next prev parent reply other threads:[~2026-07-31 23:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:33 [PATCH v2 0/2] Drivers: hv: decrypt netvsc buffers on contiguous direct-map addresses Kameron Carr
2026-07-30 23:33 ` [PATCH v2 1/2] Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted() Kameron Carr
2026-07-31 15:46 ` Michael Kelley
2026-07-31 23:34 ` sashiko-bot [this message]
2026-07-30 23:33 ` [PATCH v2 2/2] hv_netvsc: Allocate host-visible GPADL buffers as decrypted contiguous chunks Kameron Carr
2026-07-31 15:46 ` Michael Kelley
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=20260731233456.95BC71F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kameroncarr@linux.microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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).