From: Markus Armbruster <armbru@redhat.com>
To: Bin Guo <guobin@linux.alibaba.com>
Cc: "Dr . David Alan Gilbert" <dave@treblig.org>,
Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] monitor/hmp: detect signed integer overflow in expression evaluator
Date: Tue, 15 Sep 2026 13:14:26 +0200 [thread overview]
Message-ID: <87zexipy0d.fsf@pond.sub.org> (raw)
In-Reply-To: <20260915075312.50612-1-guobin@linux.alibaba.com> (Bin Guo's message of "Tue, 15 Sep 2026 15:53:12 +0800")
Bin Guo <guobin@linux.alibaba.com> writes:
> The HMP expression evaluator performed *, +, - and unary - on int64_t
> values without checking for overflow. A malformed expression such as
> "0x7fffffffffffffff + 1" would silently wrap around to INT64_MIN and
> could then be passed as a physical address to the "xp" command.
Isn't that a feature?
It wraps to (int64_t)0x8000000000000000, is put in the argument QDict,
passed to hmp_physical_memory_dump(), which implicitly converts to
uint64_t, then passes to memory_dump(). Such cavalier signedness
conversions are endemic in old C code like this.
The same conversions happen when you write the expression as
"0x8000000000000000" instead.
[...]
prev parent reply other threads:[~2026-09-15 11:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 7:53 [PATCH] monitor/hmp: detect signed integer overflow in expression evaluator Bin Guo
2026-09-15 10:55 ` Marc-André Lureau
2026-09-15 11:14 ` Markus Armbruster [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=87zexipy0d.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=farosas@suse.de \
--cc=guobin@linux.alibaba.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.