Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2479771pxb; Mon, 18 Jan 2021 20:37:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVm/RVWjYvjpGL6HS06tOWASZGM73dkTwNHPRvAHPPVADuYraU775dj4ivNs1A6eKq+BUR X-Received: by 2002:a50:d60f:: with SMTP id x15mr1885419edi.224.1611031067060; Mon, 18 Jan 2021 20:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611031067; cv=none; d=google.com; s=arc-20160816; b=dJxxRRFrP7FApg1/wdQYbaY55hnUnsoWzSetb1aaPNlGBvjLMMq0qliqOd3MKStSEq GemoVSryF4AX999OdEyYodVEpeRGhGAJ1/U88xw8RcCFOgFjp+C7S0BGKRlNd2a7Ys93 O6M87SZW+qlWUPGQgK8pyba4C4zmuIYTb6wpFuBh00IocPjyjhLhh0TPzyEdkzCnEEBV vDDcJsL6t8ZWUNYFqmyzVlZU4qBreL1IkDXRJS01GW0u6S19F0WaoW4BQyT6tyQlfBKX FEPqBk0UWJkrsy5zGUgC3ZTVQfRrSOulP2Wf3HkY1cSVtkG9m9unHNpLGPpOyv4tG1YM /boA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ijgeCGf4HvvOJcJ2DCjr923eXBKQ4GwpG+xPmqjZz1U=; b=mej6Onp7/UL4rkVa+CTzFhhjq9g3BqOoRYhCXnZrhyKkIVgLOJPYtBUQf0O0dX46m7 cm3fhZsUgHD4ccqTCdwSjPEwx+02+L12eS72fBGZ9YFMtCb6K/MOZXiqvY9JgsCWsfEb hnb5cXLDNbvF8gv96ybHTcew3s0EyMwHCYryynD03UFdHDIGMW1FlNxonMRreyuXbhuk Gify5EsL0CiVWYZR3xDoeSZKExLgBB0P3W/Rx81rVvPl/dFBZdGsPWbtpMjTgHOdONBh AWiVGEnyQLs35u92AAwqm0ONa6NwgwZtQ0fS2kFzJhOEjXv4/ISY3GKhsIPyv/Wm817E E5Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CyAZXxaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp24si8593092ejb.323.2021.01.18.20.37.24; Mon, 18 Jan 2021 20:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CyAZXxaX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725771AbhARPPU (ORCPT + 99 others); Mon, 18 Jan 2021 10:15:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:36828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390443AbhARLlr (ORCPT ); Mon, 18 Jan 2021 06:41:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01949229CA; Mon, 18 Jan 2021 11:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610970091; bh=Fnbb9wq2N2d/GTAea58aUb8NDG9ujjwvKcZ7H152tYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CyAZXxaXxpVLMoIfnFa4h3Fy3ITBUL7oegJdEF9GjLE9xrznx/3D0yjpQFx6z5WeD nofLpfmwehhUE7OrcvLiMHfHMHcyWGFzzrL85HZXMr5LIzlbaC/jK/tfvAxAdIl4+Q p7C2zHymwfigXELLgLQlzgVDI5lsF/ZESvMitBqw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Thomas Bogendoerfer , stable@kernel.org Subject: [PATCH 5.10 032/152] MIPS: Fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps Date: Mon, 18 Jan 2021 12:33:27 +0100 Message-Id: <20210118113354.318756123@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210118113352.764293297@linuxfoundation.org> References: <20210118113352.764293297@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Viro commit 698222457465ce343443be81c5512edda86e5914 upstream. Patches that introduced NT_FILE and NT_SIGINFO notes back in 2012 had taken care of native (fs/binfmt_elf.c) and compat (fs/compat_binfmt_elf.c) coredumps; unfortunately, compat on mips (which does not go through the usual compat_binfmt_elf.c) had not been noticed. As the result, both N32 and O32 coredumps on 64bit mips kernels have those sections malformed enough to confuse the living hell out of all gdb and readelf versions (up to and including the tip of binutils-gdb.git). Longer term solution is to make both O32 and N32 compat use the regular compat_binfmt_elf.c, but that's too much for backports. The minimal solution is to do in arch/mips/kernel/binfmt_elf[on]32.c the same thing those patches have done in fs/compat_binfmt_elf.c Cc: stable@kernel.org # v3.7+ Signed-off-by: Al Viro Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/binfmt_elfn32.c | 7 +++++++ arch/mips/kernel/binfmt_elfo32.c | 7 +++++++ 2 files changed, 14 insertions(+) --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c @@ -103,4 +103,11 @@ jiffies_to_old_timeval32(unsigned long j #undef ns_to_kernel_old_timeval #define ns_to_kernel_old_timeval ns_to_old_timeval32 +/* + * Some data types as stored in coredump. + */ +#define user_long_t compat_long_t +#define user_siginfo_t compat_siginfo_t +#define copy_siginfo_to_external copy_siginfo_to_external32 + #include "../../../fs/binfmt_elf.c" --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c @@ -106,4 +106,11 @@ jiffies_to_old_timeval32(unsigned long j #undef ns_to_kernel_old_timeval #define ns_to_kernel_old_timeval ns_to_old_timeval32 +/* + * Some data types as stored in coredump. + */ +#define user_long_t compat_long_t +#define user_siginfo_t compat_siginfo_t +#define copy_siginfo_to_external copy_siginfo_to_external32 + #include "../../../fs/binfmt_elf.c"