public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: compat: fix compat types affecting struct compat_elf_prpsinfo
Date: Tue, 14 Oct 2014 11:29:14 +0200	[thread overview]
Message-ID: <1876499.pQrfMV3dKY@wuerfel> (raw)
In-Reply-To: <20141014085122.GA26987@e104818-lin.cambridge.arm.com>

On Tuesday 14 October 2014 09:51:25 Catalin Marinas wrote:
> On Tue, Oct 14, 2014 at 06:55:05AM +0100, Victor Kamensky wrote:
> > The compat_elf_prpsinfo structure does not match the arch/arm struct
> > elf_pspsinfo definition. As result NT_PRPSINFO note in core file
> > created by arm64 kernel for aarch32 (compat) process has wrong size.
> > So gdb cannot display command that caused process crash.
> > 
> > Fix is to change size of __compat_uid_t, __compat_gid_t so it would
> > match size of similar fields in arch/arm case.
> > 
> > Signed-off-by: Victor Kamensky <victor.kamensky@linaro.org>
> > ---
> >  arch/arm64/include/asm/compat.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
> > index 253e33b..56de5aa 100644
> > --- a/arch/arm64/include/asm/compat.h
> > +++ b/arch/arm64/include/asm/compat.h
> > @@ -37,8 +37,8 @@ typedef s32         compat_ssize_t;
> >  typedef s32          compat_time_t;
> >  typedef s32          compat_clock_t;
> >  typedef s32          compat_pid_t;
> > -typedef u32          __compat_uid_t;
> > -typedef u32          __compat_gid_t;
> > +typedef u16          __compat_uid_t;
> > +typedef u16          __compat_gid_t;
> >  typedef u16          __compat_uid16_t;
> >  typedef u16          __compat_gid16_t;
> >  typedef u32          __compat_uid32_t;
> 
> __compat_uid_t is defined to match the arm32 uid_t and that would be
> __kernel_uid32_t (or __compat_uid32_t). So this is not the correct fix.

No, I think Victor is right: __compat_uid_t should match the arm32
__kernel_uid_t, not the arm32 uid_t, which is just a kernel-internal
definition, while the __kernel_uid_t is the one used in all user
visible interfaces.

The definition in your asm/compat.h file seems to be a mistake.

> The problem is that elf_prpsinfo uses __kernel_uid_t which arm32 defines
> as (unsigned short) while compat_elf_prspinfo uses __compat_uid_t which
> is 32-bit. In reality compat_uid_t is different from the arm32
> kernel_uid_t (other 32-bit architectures may use a 32-bit kernel_uid_t).

compat_uid_t should match the __kernel_uid_t for all 32-bit architectures
that are emulated on a 64-bit architecture, that is the definition.

	Arnd

  parent reply	other threads:[~2014-10-14  9:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  5:55 [PATCH] compat: fix compat types affecting struct compat_elf_prpsinfo Victor Kamensky
2014-10-14  5:55 ` [PATCH] arm64: " Victor Kamensky
2014-10-14  8:51   ` Catalin Marinas
2014-10-14  8:53     ` Catalin Marinas
2014-10-14  9:29     ` Arnd Bergmann [this message]
2014-10-14  9:53       ` Catalin Marinas
2014-10-14 10:08         ` Arnd Bergmann
2014-10-14 10:28           ` Catalin Marinas
2014-10-14 16:38             ` Victor Kamensky
2014-10-14 17:54               ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2014-10-14  6:00 Victor Kamensky
2014-10-15  6:11 Victor Kamensky
2014-10-15 14:50 ` Catalin Marinas

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=1876499.pQrfMV3dKY@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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