linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Paul Burton <paulburton@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"open list:BROADCOM NVRAM DRIVER" <linux-mips@vger.kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Christian Brauner <christian.brauner@canonical.com>
Subject: Re: [PATCH] mips: vdso: conditionalize 32-bit time functions on COMPAT_32BIT_TIME
Date: Wed, 1 Jan 2020 10:47:04 +0100	[thread overview]
Message-ID: <CAHmME9pvMmnN_=enz7k_hU=KjEtOiDL6dFa42E3mLPDdZ+M1cg@mail.gmail.com> (raw)
In-Reply-To: <20200101041056.xionott76qbrffih@lantea.localdomain>

On Wed, Jan 1, 2020 at 5:08 AM Paul Burton <paulburton@kernel.org> wrote:
>
> Hi Jason,
>
> On Tue, Dec 31, 2019 at 05:14:41PM +0100, Jason A. Donenfeld wrote:
> > Here's a "one click" reproducer:
> > https://data.zx2c4.com/mips-musl-libc-weird-crash-time32-compat.tar.xz
> >
> > Untar that and hit `make -j$(nproc)`, and you'll get a freshly built
> > and crashing kernel+userland.
>
> Thanks for the test case. It seems like the VDSO code isn't saving &
> restoring $gp/$28, even though it's meant to be callee-saved in both the
> n32 & n64 ABIs. With some digging I found that the below seems to
> resolve the issue. Could you check whether it works for you?
>
> I'm still not quite sure *why* this happens; perhaps GCC just decides it
> doesn't need to save & restore $gp/$28 when it spots that it's being
> "used" for __current_thread_info (even though that's never actually
> referenced in the VDSO)?
>
> Just moving the declaration of __current_thread_info inside the
> current_thread_info() function seems to do the trick too, and is
> probably a bit neater.
>
> Thanks,
>     Paul
>
> ---
> diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
> index 4993db40482c..ac33959bbb1f 100644
> --- a/arch/mips/include/asm/thread_info.h
> +++ b/arch/mips/include/asm/thread_info.h
> @@ -50,7 +50,11 @@ struct thread_info {
>  }
>
>  /* How to get the thread information struct from C.  */
> +#ifdef __VDSO__
> +register struct thread_info *__current_thread_info __asm__("$0");
> +#else
>  register struct thread_info *__current_thread_info __asm__("$28");
> +#endif
>
>  static inline struct thread_info *current_thread_info(void)
>  {

Holy guacamole, nice catch. That's interesting behavior indeed...

I'll leave it to you to submit for 5.5?

      parent reply	other threads:[~2020-01-01  9:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 13:08 vdso-related userspace crashes on 5.5 mips64 Jason A. Donenfeld
2019-12-23 21:44 ` Jason A. Donenfeld
2019-12-23 23:29 ` Paul Burton
2019-12-24 13:37   ` Jason A. Donenfeld
2019-12-30 15:58     ` Arnd Bergmann
2019-12-24 14:19   ` Jason A. Donenfeld
2019-12-24 13:54 ` [PATCH] mips: vdso: conditionalize 32-bit time functions on COMPAT_32BIT_TIME Jason A. Donenfeld
2019-12-30 11:57   ` Arnd Bergmann
2019-12-30 12:26     ` Jason A. Donenfeld
2019-12-30 12:34       ` Arnd Bergmann
2019-12-30 14:37         ` Jason A. Donenfeld
2019-12-30 15:10           ` Jason A. Donenfeld
2019-12-30 15:37           ` Arnd Bergmann
2019-12-30 15:39             ` Jason A. Donenfeld
2019-12-30 15:47               ` Arnd Bergmann
2019-12-30 15:58                 ` Jason A. Donenfeld
2019-12-30 17:33                   ` Arnd Bergmann
2019-12-30 21:09                     ` Jason A. Donenfeld
2019-12-30 21:42                       ` Jason A. Donenfeld
2019-12-31 16:14                         ` Jason A. Donenfeld
2020-01-01  4:10                           ` Paul Burton
2020-01-01  4:25                             ` Paul Burton
2020-01-01  9:47                               ` Jason A. Donenfeld
2020-01-01  9:47                             ` Jason A. Donenfeld [this message]

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='CAHmME9pvMmnN_=enz7k_hU=KjEtOiDL6dFa42E3mLPDdZ+M1cg@mail.gmail.com' \
    --to=jason@zx2c4.com \
    --cc=arnd@arndb.de \
    --cc=christian.brauner@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --subject='Re: [PATCH] mips: vdso: conditionalize 32-bit time functions on COMPAT_32BIT_TIME' \
    /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

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox