All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: copypage: do not use naked functions
Date: Tue, 16 Oct 2018 09:33:41 +0100	[thread overview]
Message-ID: <20181016083341.GE30658@n2100.armlinux.org.uk> (raw)
In-Reply-To: <nycvar.YSQ.7.76.1810151908450.1498@knanqh.ubzr>

On Mon, Oct 15, 2018 at 07:27:43PM -0400, Nicolas Pitre wrote:
> It's hard to see what that commit was actually fixing, but the operands 
> usage is wrong as explained already. Maybe the generated code has been 
> OK for all those years but that is due to luck rather than correctness.
...
> No idea. Maybe Russell remembers?
> Maybe digging into the mailing list archive might tell.

I found this as a reply to the patch by Mikael Pettersson:

I've tested and verified that this bit enables a gcc-4.5 compiled kernel
to boot on TS-119 (Kirkwood) when combined with my fix for __naked.
With neither or only one of the patches applied, the kernel oopses hard
in copy_user_page() as it tries to start /sbin/init.
...
- the asm() bodies of these __naked functions have inadequate input
  parameter constraints, in particular they fail to declare any
  dependencies on the functions' formal parameters; gcc-4.5 sees this
  and skips the parameter setup before calling these functions, causing
  runtime crashes; Khem's patch (this one) fixes that
  (copypage-xscale.c already had correct asm() constraints so it works
  with only the __naked fix, these other copypage-*.c files need both
  patches to work)

So, while wrong to the GCC manual, it's fixing a bug that is present
with gcc-4.5 and who-knows what other GCC versions.  Reverting the
commit has the chance to cause regressions with GCC.

It looks like any change here needs to be validated on a range of
GCC versions, because there are versions of GCC known not to follow
it's manual!

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Stefan Agner <stefan@agner.ch>,
	arnd@arndb.de, linus.walleij@linaro.org,
	linux-kernel@vger.kernel.org, joel@jms.id.au,
	ulli.kroll@googlemail.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] ARM: copypage: do not use naked functions
Date: Tue, 16 Oct 2018 09:33:41 +0100	[thread overview]
Message-ID: <20181016083341.GE30658@n2100.armlinux.org.uk> (raw)
In-Reply-To: <nycvar.YSQ.7.76.1810151908450.1498@knanqh.ubzr>

On Mon, Oct 15, 2018 at 07:27:43PM -0400, Nicolas Pitre wrote:
> It's hard to see what that commit was actually fixing, but the operands 
> usage is wrong as explained already. Maybe the generated code has been 
> OK for all those years but that is due to luck rather than correctness.
...
> No idea. Maybe Russell remembers?
> Maybe digging into the mailing list archive might tell.

I found this as a reply to the patch by Mikael Pettersson:

I've tested and verified that this bit enables a gcc-4.5 compiled kernel
to boot on TS-119 (Kirkwood) when combined with my fix for __naked.
With neither or only one of the patches applied, the kernel oopses hard
in copy_user_page() as it tries to start /sbin/init.
...
- the asm() bodies of these __naked functions have inadequate input
  parameter constraints, in particular they fail to declare any
  dependencies on the functions' formal parameters; gcc-4.5 sees this
  and skips the parameter setup before calling these functions, causing
  runtime crashes; Khem's patch (this one) fixes that
  (copypage-xscale.c already had correct asm() constraints so it works
  with only the __naked fix, these other copypage-*.c files need both
  patches to work)

So, while wrong to the GCC manual, it's fixing a bug that is present
with gcc-4.5 and who-knows what other GCC versions.  Reverting the
commit has the chance to cause regressions with GCC.

It looks like any change here needs to be validated on a range of
GCC versions, because there are versions of GCC known not to follow
it's manual!

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

  reply	other threads:[~2018-10-16  8:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 22:26 [PATCH 2/2] ARM: copypage: do not use naked functions Stefan Agner
2018-10-15 22:26 ` Stefan Agner
2018-10-15 22:35 ` Nicolas Pitre
2018-10-15 22:35   ` Nicolas Pitre
2018-10-15 22:41   ` Russell King - ARM Linux
2018-10-15 22:41     ` Russell King - ARM Linux
2018-10-15 22:51     ` Stefan Agner
2018-10-15 22:51       ` Stefan Agner
2018-10-15 23:27       ` Nicolas Pitre
2018-10-15 23:27         ` Nicolas Pitre
2018-10-16  8:33         ` Russell King - ARM Linux [this message]
2018-10-16  8:33           ` Russell King - ARM Linux
2018-10-16 12:09           ` Stefan Agner
2018-10-16 12:09             ` Stefan Agner
2018-10-15 22:54     ` Nicolas Pitre
2018-10-15 22:54       ` Nicolas Pitre
2018-10-15 23:02       ` Russell King - ARM Linux
2018-10-15 23:02         ` Russell King - ARM Linux

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=20181016083341.GE30658@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.