All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
To: qemu-devel@nongnu.org
Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com,
	arikalo@wavecomp.com, daniel.santos@pobox.com,
	amarkovic@wavecomp.com, nchen@wavecomp.com, philmd@redhat.com,
	aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH v6 5/6] linux-user: Sanitize interp_info and, for mips only, init field fp_abi
Date: Sun, 19 May 2019 18:15:26 +0200	[thread overview]
Message-ID: <1558282527-22183-6-git-send-email-aleksandar.markovic@rt-rk.com> (raw)
In-Reply-To: <1558282527-22183-1-git-send-email-aleksandar.markovic@rt-rk.com>

From: Daniel Santos <daniel.santos@pobox.com>

Sanitize interp_info structure in load_elf_binary() and, for MIPS only,
init its field fp_abi to MIPS_ABI_FP_UNKNOWN. This fixes appearances of
"Unexpected FPU mode" message in some MIPS use cases. Currently, this
bug is a complete stopper for some MIPS binaries.

In load_elf_binary(), struct image_info interp_info is used without
being properly initialized. One result is that when the ELF's program
header doesn't contain an entry for the ABI flags, then the value of
the struct image_info's fp_abi field is set to whatever happened to
be in stack memory at the time.

Backporting to 4.0 and, if possible, to 3.1 is recommended.

Fixes: https://bugs.launchpad.net/qemu/+bug/1825002

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/elfload.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index c1a2602..7f09d57 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2698,6 +2698,11 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
     char *elf_interpreter = NULL;
     char *scratch;
 
+    memset(&interp_info, 0, sizeof(interp_info));
+#ifdef TARGET_MIPS
+    interp_info.fp_abi = MIPS_ABI_FP_UNKNOWN;
+#endif
+
     info->start_mmap = (abi_ulong)ELF_START_MMAP;
 
     load_elf_image(bprm->filename, bprm->fd, info,
-- 
2.7.4



  parent reply	other threads:[~2019-05-19 16:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-19 16:15 [Qemu-devel] [PATCH v6 0/6] linux-user: A set of miscellaneous patches Aleksandar Markovic
2019-05-19 16:15 ` [Qemu-devel] [PATCH v6 1/6] linux-user: Fix support for SIOCATMARK and SIOCGPGRP ioctls for xtensa Aleksandar Markovic
2019-05-22  9:11   ` Laurent Vivier
2019-05-19 16:15 ` [Qemu-devel] [PATCH v6 2/6] linux-user: Add support for SIOCSPGRP ioctl for all targets Aleksandar Markovic
2019-05-22  9:12   ` Laurent Vivier
2019-05-19 16:15 ` [Qemu-devel] [PATCH v6 3/6] linux-user: Add support for SIOC<G|S>IFPFLAGS ioctls " Aleksandar Markovic
2019-05-22  9:13   ` Laurent Vivier
2019-05-19 16:15 ` [Qemu-devel] [PATCH v6 4/6] linux-user: Add support for setsockopt() options IPV6_<ADD|DROP>_MEMBERSHIP Aleksandar Markovic
2019-05-22  9:16   ` Laurent Vivier
2019-05-22  9:18   ` Laurent Vivier
2019-05-19 16:15 ` Aleksandar Markovic [this message]
2019-05-22  9:14   ` [Qemu-devel] [PATCH v6 5/6] linux-user: Sanitize interp_info and, for mips only, init field fp_abi Laurent Vivier
2019-05-19 16:15 ` [Qemu-devel] [PATCH v6 6/6] linux-user: Add support for statx() syscall Aleksandar Markovic

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=1558282527-22183-6-git-send-email-aleksandar.markovic@rt-rk.com \
    --to=aleksandar.markovic@rt-rk.com \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=daniel.santos@pobox.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=nchen@wavecomp.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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.