代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/qemu 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From ccca5618025567c4168630459b90bf11bf96cca4 Mon Sep 17 00:00:00 2001
From: hanliyang <hanliyang@hygon.cn>
Date: Wed, 31 Jan 2024 07:26:57 +0800
Subject: [PATCH] target/i386: sev: Return 0 if sev_send_get_packet_len() fails
The send_packet_hdr_len of struct SEVState is of type size_t
which is an unsigned class type. If the send_packet_hdr_len
is assigned as -1, then it will be a huge number and the QEMU
process will crash when allocating packet buffer with the
huge size.
For example, the following code could cause crash described
above.
```
static int
sev_send_update_data(SEVState *s, QEMUFile *f, uint8_t *ptr, uint32_t size,
uint64_t *bytes_sent)
{
......
if (!s->send_packet_hdr) {
s->send_packet_hdr_len = sev_send_get_packet_len(&fw_error);
if (s->send_packet_hdr_len < 1) {
error_report("%s: SEND_UPDATE fw_error=%d '%s'",
__func__, fw_error, fw_error_to_str(fw_error));
return 1;
}
s->send_packet_hdr = g_new(gchar, s->send_packet_hdr_len);
}
......
}
```
Signed-off-by: hanliyang <hanliyang@hygon.cn>
---
target/i386/sev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 98b0d3937a..6ccb22c00a 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -1492,7 +1492,7 @@ sev_send_get_packet_len(int *fw_err)
ret = sev_ioctl(sev_guest->sev_fd, KVM_SEV_SEND_UPDATE_DATA,
&update, fw_err);
if (*fw_err != SEV_RET_INVALID_LEN) {
- ret = -1;
+ ret = 0;
error_report("%s: failed to get session length ret=%d fw_error=%d '%s'",
__func__, ret, *fw_err, fw_error_to_str(*fw_err));
goto err;
--
2.41.0.windows.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。