mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	linux-mips@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>,
	Denys Vlasenko <dvlasenk@redhat.com>
Subject: Re: [RFC][PATCH] NT_FILE/NT_SIGINFO breakage on mips compat coredumps
Date: Tue, 29 Dec 2020 16:09:25 +0100	[thread overview]
Message-ID: <20201229150924.GB7832@alpha.franken.de> (raw)
In-Reply-To: <20201224194438.GY3579531@ZenIV.linux.org.uk>

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 <viro@zeniv.linux.org.uk>
> ---
> 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 ]

  reply	other threads:[~2020-12-29 15:10 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 21:45 [PATCHSET] saner elf compat Al Viro
2020-12-03 21:46 ` [PATCH 01/10] binfmt_elf: partially sanitize PRSTATUS_SIZE and SET_PR_FPVALID Al Viro
2020-12-03 21:46   ` [PATCH 02/10] elf_prstatus: collect the common part (everything before pr_reg) into a struct Al Viro
2020-12-03 21:46   ` [PATCH 03/10] [elfcore-compat][amd64] clean PRSTATUS_SIZE/SET_PR_FPVALID up properly Al Viro
2020-12-03 21:46   ` [PATCH 04/10] mips binfmt_elf*32.c: use elfcore-compat.h Al Viro
2020-12-03 21:46   ` [PATCH 05/10] mips: kill unused definitions in binfmt_elf[on]32.c Al Viro
2020-12-03 21:46   ` [PATCH 06/10] mips: KVM_GUEST makes no sense for 64bit builds Al Viro
2020-12-03 21:46   ` [PATCH 07/10] mips compat: don't bother with ELF_ET_DYN_BASE Al Viro
2020-12-03 21:46   ` [PATCH 08/10] mips: don't bother with ELF_CORE_EFLAGS Al Viro
2020-12-03 21:46   ` [PATCH 09/10] mips compat: switch to compat_binfmt_elf.c Al Viro
2020-12-03 21:46   ` [PATCH 10/10] Kconfig: regularize selection of CONFIG_BINFMT_ELF Al Viro
2020-12-03 22:09 ` [PATCHSET] saner elf compat Linus Torvalds
2020-12-03 23:03   ` Al Viro
2020-12-06  3:23     ` Al Viro
2020-12-07  3:36       ` hpa
2020-12-07 18:01     ` Maciej W. Rozycki
2020-12-16  3:01       ` Al Viro
2020-12-16  9:44         ` Maciej W. Rozycki
2020-12-22 20:04           ` Al Viro
2020-12-22 21:38             ` Al Viro
2020-12-22 22:57               ` Al Viro
2020-12-23  7:03           ` Al Viro
2020-12-23  7:12             ` Al Viro
2020-12-24 19:44               ` [RFC][PATCH] NT_FILE/NT_SIGINFO breakage on mips compat coredumps Al Viro
2020-12-29 15:09                 ` Thomas Bogendoerfer [this message]
2020-12-15 19:54     ` [PATCHSET] saner elf compat Thomas Bogendoerfer

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=20201229150924.GB7832@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=dvlasenk@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=rdunlap@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®