linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Victor Kamensky (kamensky)" <kamensky@cisco.com>
To: Paul Burton <paulburton@kernel.org>
Cc: "linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	"bruce.ashfield@gmail.com" <bruce.ashfield@gmail.com>,
	"richard.purdie@linuxfoundation.org" 
	<richard.purdie@linuxfoundation.org>
Subject: Re: [PATCH 1/2] mips: vdso: fix 'jalr t9' crash in vdso code
Date: Mon, 10 Feb 2020 21:12:59 +0000	[thread overview]
Message-ID: <BL0PR11MB3219374C9349EE1B4F174777CD190@BL0PR11MB3219.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200210193301.ella5mokkudw3qgs@lantea.localdomain>

Hi Paul,

Appreciate you looking into this.

Please see inline. Look for 'kamensky>'. Please forgive
my awful corporate mail agent deficiencies with inline replies.
Please let me know if you cannot read my inline replies,
I will re-post this message from my personal account.

________________________________________
From: linux-mips-owner@vger.kernel.org <linux-mips-owner@vger.kernel.org> on behalf of Paul Burton <paulburton@kernel.org>
Sent: Monday, February 10, 2020 11:33 AM
To: Victor Kamensky (kamensky)
Cc: linux-mips@vger.kernel.org; Ralf Baechle; James Hogan; Vincenzo Frascino; bruce.ashfield@gmail.com; richard.purdie@linuxfoundation.org
Subject: Re: [PATCH 1/2] mips: vdso: fix 'jalr t9' crash in vdso code

Hi Victor,

On Mon, Feb 10, 2020 at 11:14:24AM -0800, Paul Burton wrote:
> Which kernel version did you find this issue with? Could you check
> whether you have commit bbcc5672b006 ("MIPS: Avoid VDSO ABI breakage due
> to global register variable")? That was merged for v5.5-rc5.

Ah, I just spotted your detailed cover letter - my bad :)

Please try moving from v5.4 to v5.4.18 or higher, or just cherry-picking
the commit I mentioned.

kamensky> Double commit that you mentioned is present in 5.4.15 (since
kamensky> v5.4.9) that I use. It is 5b004a238460113276319536534928c58d95e599

[kamensky@kamensky-p53s linux]$ git tag --contains 5b004a238460113276319536534928c58d95e599
v5.4.10
v5.4.11
v5.4.12
v5.4.13
v5.4.14
v5.4.15
v5.4.16
v5.4.17
v5.4.18
v5.4.9

kamensky> You can check your tree: disassemble arch/mips/vdso/vgettimeofday-n32.o
kamensky> you would see 'jalr t9' calls, then disassemble arsm/mips/vdso/vdos-n32.so
kamensky> and check that those 'jalr t9' places got converted into 'bal' instructions,
kamensky> even though t9 set up instructions are there. This conversion happens by
kamensky> ld during relocation processing if code was compiled with options I propose
kamensky> to add explicitly. Walk through gcc and binutils places that do that are in my
kamensky> cover letter write up.

kamensky> You can reproduce the issue by doing opposite of what I propose:
kamensky> disable -mrelax-pic-calls and -mexplicit-relocs defaults in your
kamensky> toolchain by either using negate variant of option, ie
kamensky> -mno-relax-pic-calls or -mno-explicit-relocs or both. Something
kamensky> like in diff below. I've tried it on mips-poky-linux-gcc toolchain
kamensky> that got correct defaults and worked for us before, after adding
kamensky> no variants it shows the same 'jalr t9' crash as with other yocto
kamensky> mips toolchains.

diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 996a934ece7d..2131c3082580 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -31,7 +31,9 @@ cflags-vdso := $(ccflags-vdso) \
        -O3 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
        -fno-stack-protector -fno-jump-tables -DDISABLE_BRANCH_PROFILING \
        $(call cc-option, -fno-asynchronous-unwind-tables) \
-       $(call cc-option, -fno-stack-protector)
+       $(call cc-option, -fno-stack-protector) \
+       $(call cc-option, -mno-relax-pic-calls) \
+       $(call cc-option, -mno-explicit-relocs)

Thanks,
Victor

Thanks,
    Paul

  reply	other threads:[~2020-02-10 21:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 23:31 [PATCH 0/2] mips: vdso: fix 'jalr t9' crash in vdso code Victor Kamensky
2020-02-03 23:31 ` [PATCH 1/2] " Victor Kamensky
2020-02-10 19:14   ` Paul Burton
2020-02-10 19:33     ` Paul Burton
2020-02-10 21:12       ` Victor Kamensky (kamensky) [this message]
2020-02-10 22:52         ` Paul Burton
2020-02-10 23:11           ` Paul Burton
2020-02-11 16:55           ` Victor Kamensky (kamensky)
2020-02-11 17:01             ` Paul Burton
2020-02-17 13:38               ` Maciej W. Rozycki
2020-02-03 23:31 ` [PATCH 2/2] mips: vdso: add build time check that no 'jalr t9' calls left Victor Kamensky

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=BL0PR11MB3219374C9349EE1B4F174777CD190@BL0PR11MB3219.namprd11.prod.outlook.com \
    --to=kamensky@cisco.com \
    --cc=bruce.ashfield@gmail.com \
    --cc=jhogan@kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=richard.purdie@linuxfoundation.org \
    --cc=vincenzo.frascino@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).