48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
|
|
From 28654c3906e23d26dd740a3a300832345c9e0325 Mon Sep 17 00:00:00 2001
|
||
|
|
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Wed, 13 Mar 2024 02:33:21 +0000
|
||
|
|
Subject: [PATCH] linux-user/flatload.c: Fix setting of image_info::end_code
|
||
|
|
mainline inclusion commit 734a659ad264ac080457167e845ffabbaaa66d0e category:
|
||
|
|
bugfix
|
||
|
|
|
||
|
|
---------------------------------------------------------------
|
||
|
|
|
||
|
|
The flatload loader sets the end_code field in the image_info struct
|
||
|
|
incorrectly, due to a typo.
|
||
|
|
|
||
|
|
This is a very long-standing bug (dating all the way back to when
|
||
|
|
the bFLT loader was added in 2006), but has gone unnoticed because
|
||
|
|
(a) most people don't use bFLT binaries
|
||
|
|
(b) we don't actually do anything with the end_code field, except
|
||
|
|
print it in debugging traces and pass it to TCG plugins
|
||
|
|
|
||
|
|
Fix the typo.
|
||
|
|
|
||
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1119
|
||
|
|
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||
|
|
Message-Id: <20220728151406.2262862-1-peter.maydell@linaro.org>
|
||
|
|
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||
|
|
|
||
|
|
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
linux-user/flatload.c | 2 +-
|
||
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
|
||
|
|
index e4c2f89a22..e99570ca18 100644
|
||
|
|
--- a/linux-user/flatload.c
|
||
|
|
+++ b/linux-user/flatload.c
|
||
|
|
@@ -808,7 +808,7 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info)
|
||
|
|
|
||
|
|
/* Stash our initial stack pointer into the mm structure */
|
||
|
|
info->start_code = libinfo[0].start_code;
|
||
|
|
- info->end_code = libinfo[0].start_code = libinfo[0].text_len;
|
||
|
|
+ info->end_code = libinfo[0].start_code + libinfo[0].text_len;
|
||
|
|
info->start_data = libinfo[0].start_data;
|
||
|
|
info->end_data = libinfo[0].end_data;
|
||
|
|
info->start_brk = libinfo[0].start_brk;
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|