From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, pmg-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/4] qmp client: encode JSON as UTF-8 to fix PBS backup when password contains multi-byte UTF-8
Date: Wed, 1 Oct 2025 12:47:10 +0200 [thread overview]
Message-ID: <20251001104729.70314-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20251001104729.70314-1-f.ebner@proxmox.com>
As reported in the community forum, PBS backup of VMs would not work
when the password contained a multi-byte UTF-8 character [0].
The reason is that when writing a string in Perl's internal
representation with character values >= 128 to the QMP socket, QEMU
seems to have a bug where it reads too few characters (one less for
each char value >= 128). In such a case, the QMP client will just time
out, as the command is never completely read on the QEMU side.
Stuffing with additional characters would actually lead to QEMU
reading enough characters and executing the command, but Perl's
internal representation should not be submitted to QMP in the first
place. Encode the JSON properly as UTF-8 to avoid the issue.
In particular, this makes backing up a VM to PBS possible when the PBS
password contains multi-byte UTF-8 characters.
This also fixes future similar issues, for example when a QMP command
is passed a filesystem path with multi-byte UTF-8 characters.
[0]: https://forum.proxmox.com/threads/172871/post-804921
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Unfortunately, doing the same for QGA is not yet enough to fix issue
#6609.
src/PVE/QMPClient.pm | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/PVE/QMPClient.pm b/src/PVE/QMPClient.pm
index 7b19be9d..46d8b299 100644
--- a/src/PVE/QMPClient.pm
+++ b/src/PVE/QMPClient.pm
@@ -291,12 +291,14 @@ my $check_queue = sub {
. "\n";
} else {
-
- $qmpcmd = to_json({
- execute => $cmd->{execute},
- arguments => $cmd->{arguments},
- id => $cmd->{id},
- });
+ $qmpcmd = to_json(
+ {
+ execute => $cmd->{execute},
+ arguments => $cmd->{arguments},
+ id => $cmd->{id},
+ },
+ { utf8 => 1 },
+ );
}
if ($fd >= 0) {
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-10-01 10:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 10:47 [pve-devel] [PATCH-SERIES qemu-server/storage/common 0/4] fix UTF-8 handling for PBS_PASSWORD Fiona Ebner
2025-10-01 10:47 ` Fiona Ebner [this message]
2025-10-01 10:47 ` [pve-devel] [PATCH qemu-server 2/4] pbs: properly encode PBS password as UTF-8 when setting the environment variable Fiona Ebner
2025-10-01 10:47 ` [pve-devel] [PATCH storage 3/4] pbs plugin: raw client command: " Fiona Ebner
2025-10-01 10:47 ` [pve-devel] [PATCH common 4/4] pbs client: allow using password that would be auto-encoded as neither ASCII nor UTF-8 Fiona Ebner
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=20251001104729.70314-2-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.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