Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9864429pxu; Tue, 29 Dec 2020 07:12:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1b7O8SqJsTQd/CHEDWI9crFMkOGYvh0UjUnYlKlroY+LkOl69vMuqj2XsUEpV/qbwFW2H X-Received: by 2002:a05:6402:1352:: with SMTP id y18mr46873802edw.178.1609254777620; Tue, 29 Dec 2020 07:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609254777; cv=none; d=google.com; s=arc-20160816; b=PUsLxk0yGxTpKtwN9yH3BeeRyIP7GKt2+0PUbKlp6Y6LP3OCMBlq1f4XDvabER4MDK E6Mtver3mQGW7z7gwC2YcKcWs3Q5VeXEKPXUTa8uWtUk6Vpx507Oi94yagh1gaKKrcT4 JHNFtSVW1xZ2Ey5DJ2pE1SEQGcqWQAHaqzGgSmnajv1EtBbxHkgbLoVBqVWCEE0P83tk muScIMggSwQJLLGyWfYNDo2OoePCt8fW9dbS7WrtkFJ3GqW96DmpHRHlZLaXCLcavION /+kV/Puc4Axu9SEjQlY47jsTp4FqgqTnUdR6l02C2scH+fk6NqCI4xRDFm0WBlQGp7Gy bHaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=1XZS0ZScOCgLsmQxE8tPOXWqZxk38MGzG3HvnfahZ60=; b=ZOkppVGL9GLNMZi+8EPbrVDVVwNhHzTQu6Ra1GTHq2bbWwUrd9bhmq3zjYZUZgPpcd T2Z8HnhYLw2uYMw2BIwUsr+IU8E7RGWheTYHAn6VrsVf/JpJqMXEsD4v7FFfHlpwPV+a PC7unZ006uZ33HnyWUylcSLsSgwrhk/TeOIhQeKkR7WrT/gdIBELjX0mpLcKtBblBtWH Hs2HIE/ytEQbddMr4GYblo8AE6/Jdm9HrlysL4JPXYEbTe869piCz8rrB1RcaKtlzcUb f6lZ4xJy93BExiTYUjNpPTfEC++UIT8exf0I8wNYA7kbBPWCpomLKKUUcRhLi6vY1vvC 6mgA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw15si20391489ejb.535.2020.12.29.07.12.35; Tue, 29 Dec 2020 07:12:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbgL2PKZ (ORCPT + 99 others); Tue, 29 Dec 2020 10:10:25 -0500 Received: from elvis.franken.de ([193.175.24.41]:45052 "EHLO elvis.franken.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbgL2PKY (ORCPT ); Tue, 29 Dec 2020 10:10:24 -0500 Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1kuGd4-0006mx-01; Tue, 29 Dec 2020 16:09:42 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 0C7C4C07BE; Tue, 29 Dec 2020 16:09:25 +0100 (CET) Date: Tue, 29 Dec 2020 16:09:25 +0100 From: Thomas Bogendoerfer To: Al Viro Cc: "Maciej W. Rozycki" , Linus Torvalds , Linux Kernel Mailing List , the arch/x86 maintainers , linux-mips@vger.kernel.org, Randy Dunlap , Denys Vlasenko Subject: Re: [RFC][PATCH] NT_FILE/NT_SIGINFO breakage on mips compat coredumps Message-ID: <20201229150924.GB7832@alpha.franken.de> References: <20201203214529.GB3579531@ZenIV.linux.org.uk> <20201203230336.GC3579531@ZenIV.linux.org.uk> <20201216030154.GL3579531@ZenIV.linux.org.uk> <20201223070320.GW3579531@ZenIV.linux.org.uk> <20201223071213.GX3579531@ZenIV.linux.org.uk> <20201224194438.GY3579531@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201224194438.GY3579531@ZenIV.linux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 24, 2020 at 07:44:38PM +0000, Al Viro wrote: > [mips] fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps > > 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 > --- > diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c > index 6ee3f7218c67..c4441416e96b 100644 > --- a/arch/mips/kernel/binfmt_elfn32.c > +++ b/arch/mips/kernel/binfmt_elfn32.c > @@ -103,4 +103,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) > #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" > diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c > index 6dd103d3cebb..7b2a23f48c1a 100644 > --- a/arch/mips/kernel/binfmt_elfo32.c > +++ b/arch/mips/kernel/binfmt_elfo32.c > @@ -106,4 +106,11 @@ jiffies_to_old_timeval32(unsigned long jiffies, struct old_timeval32 *value) > #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" LGTM, I've applied it to mips-fixes. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]