From nobody Mon Nov 10 19:47:30 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1558268919; cv=none; d=zoho.com; s=zohoarc; b=B0vMqmOl+XIzvxDIx6vMFOT3p8brxwp5ub/5Pjv0ZZGs4um603UU3EcDje9WYX0e6zrvQBfPx3/ur6A4WJLnO0E2C7R6S9bGlMMaJOhrdIVH1/NjNiQriLVnE3mAdt8Way9V+e3qy5s3igbxBaUYhTqoK8gACYZz4HdbfHV/MeY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558268919; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4dqNte1VLc9PiYN5dp9/pItHs/Ud7ZYYO5NmbGbef/Y=; b=jqOmUsMPuQPAhYkym9C/yatwnjz+AVQWfkNrMPWlfr2+t5IR1bTlM3j/IspucFmphvVW7VYI5Rc/wf38iwAr+QzBxbWwoQkQv74Kc+OKB44//o1PXa6+xBfUDgbvcUdn0RZJEQABNTVDmFD7AqNbv328ocXcmIAhyCI95lXANoA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558268919310775.1877484631545; Sun, 19 May 2019 05:28:39 -0700 (PDT) Received: from localhost ([127.0.0.1]:48119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKvc-0003hY-B8 for importer@patchew.org; Sun, 19 May 2019 08:28:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSKsG-0000tR-6r for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSKsF-0005IB-6k for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:08 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:32907 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hSKsF-0005Hj-0E for qemu-devel@nongnu.org; Sun, 19 May 2019 08:25:07 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 000081A1E3D; Sun, 19 May 2019 14:25:05 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id D18851A1D9C; Sun, 19 May 2019 14:25:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 14:22:30 +0200 Message-Id: <1558268551-14877-6-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1558268551-14877-1-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v5 5/6] linux-user: Sanitize interp_info and, for mips only, init field fp_abi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Daniel Santos 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 Signed-off-by: Aleksandar Markovic Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- 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, struc= t image_info *info) char *elf_interpreter =3D NULL; char *scratch; =20 + memset(&interp_info, 0, sizeof(interp_info)); +#ifdef TARGET_MIPS + interp_info.fp_abi =3D MIPS_ABI_FP_UNKNOWN; +#endif + info->start_mmap =3D (abi_ulong)ELF_START_MMAP; =20 load_elf_image(bprm->filename, bprm->fd, info, --=20 2.7.4