* [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code
@ 2022-07-28 15:14 Peter Maydell
2022-07-28 17:11 ` Richard Henderson
2022-07-28 17:17 ` Laurent Vivier
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2022-07-28 15:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier
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>
---
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 e4c2f89a226..e99570ca182 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.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code
2022-07-28 15:14 [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code Peter Maydell
@ 2022-07-28 17:11 ` Richard Henderson
2022-07-28 17:17 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-07-28 17:11 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Laurent Vivier
On 7/28/22 08:14, Peter Maydell wrote:
> 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>
> ---
> linux-user/flatload.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code
2022-07-28 15:14 [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code Peter Maydell
2022-07-28 17:11 ` Richard Henderson
@ 2022-07-28 17:17 ` Laurent Vivier
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2022-07-28 17:17 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Le 28/07/2022 à 17:14, Peter Maydell a écrit :
> 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>
> ---
> 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 e4c2f89a226..e99570ca182 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;
Applied to my linux-user-for-7.1 branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-28 17:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-28 15:14 [PATCH for-7.1] linux-user/flatload.c: Fix setting of image_info::end_code Peter Maydell
2022-07-28 17:11 ` Richard Henderson
2022-07-28 17:17 ` Laurent Vivier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).