linux-user/flatload.c: Fix setting of image_info::end_code
PATCH 1/1 linux-user/flatload.c: Fix setting of image_info::end_code
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
--- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/flatload.c +1 -1
@@ -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;
Signature · 1 line
2.25.1
Quoted 9 lines · Peter Maydell
The flatload loader sets the
end_codefield in theimage_infostruct 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 theend_codefield, except print it in debugging traces and pass it to TCG plugins
Quoted 7 lines
Fix the typo.
Resolves:https://gitlab.com/qemu-project/qemu/-/issues/1119
Signed-off-by Peter Maydell<[email protected]>--- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Laurent Vivier
AppliedLe 28/07/2022 à 17:14, Peter Maydell a écrit :
Quoted 22 lines
The flatload loader sets the
end_codefield in theimage_infostruct 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 theend_codefield, except print it in debugging traces and pass it to TCG pluginsFix the typo.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1119
Signed-off-by Peter Maydell <[email protected]>--- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/flatload.c +0
-0
linux-user/flatload.c int load_flt_binary(struct linux_binprm *bprm, struct image_info *info) · line 814
Quoted 8 lines
linux-user/flatload.c +1
-1@@ -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;
Applied to my linux-user-for-7.1 branch.
Thanks,
Laurent