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: ARM: pxa/corgi: armv5te kernel 4.12 fails to decompress compiled with gcc7
Date: Sun, 15 Oct 2017 14:01:19 +0100	[thread overview]
Message-ID: <20171015130118.GJ20805@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20171015104640.hazujjkbqyik7fgg@darkstar.musicnaut.iki.fi>

On Sun, Oct 15, 2017 at 01:46:40PM +0300, Aaro Koskinen wrote:
> Hi,
> 
> It dies already during decompression so earlycon does not help much.
> 
> This seems to be simpler to debug/reproduce using busybox. Compiling
> just busybox with GCC 7.2 and march=armv5te/mtune=xscale already
> produces failing xz decompression:
> 
> root at thecus-n2100:~$ echo foo > foo.txt
> root at thecus-n2100:~$ xz foo.txt 
> root at thecus-n2100:~$ ./busybox.gcc-7.2 xz -d foo.txt.xz 
> xz: corrupted data
> root at thecus-n2100:~$ ./busybox.gcc-6.4 xz -d foo.txt.xz 
> root at thecus-n2100:~$ cat foo.txt
> foo
> 
> gzip is no better:
> 
> root at thecus-n2100:~$ gzip foo.txt 
> root at thecus-n2100:~$ ./busybox.gcc-7.2 gzip -d foo.txt.gz 
> gzip: crc error
> root at thecus-n2100:~$ ./busybox.gcc-6.4 gzip -d foo.txt.gz 
> root at thecus-n2100:~$ cat foo.txt
> foo
> 
> With bigger files (e.g. compressed binary), gzip gets stuck and produces
> an ever growing file.
> 
> This requires specific hardware to reproduce:
> 
> root at thecus-n2100:~$ cat /proc/cpuinfo 
> processor       : 0
> model name      : XScale-80219 rev 0 (v5l)
> BogoMIPS        : 591.87
> Features        : swp half thumb fastmult edsp 
> CPU implementer : 0x69
> CPU architecture: 5TE
> CPU variant     : 0x0
> CPU part        : 0x2e3
> CPU revision    : 0
> 
> Hardware        : Thecus N2100
> Revision        : 0000
> Serial          : 0000000000000000
> 
> The same failing binary (busybox.gcc-7.2) seems to work fine on RPi 2...?!
> 
> Anyway it seems that GCC 7.2 is unsuitable for building Linux at least
> for some ARM platforms.

What mode do you have for alignment handling?

cat /proc/cpu/alignment

Default for older CPUs is to "ignore" then, which basically means that
unaligned loads are rotated - in other words, the 32-bit naturally
aligned word is loaded and then rotated such that the addressed byte
is in bits 0-7.  This is standard behaviour for older CPUs - it's
how the CPU works when there's no trapping of unaligned accesses, and
it should really be the way that GCC expects these CPUs to work.

Since there have been moves to drop older architecture support from GCC,
I wouldn't be surprised if handling for pre-ARMv6 CPUs was bitrotting
and GCC was producing code that fails.

I also know that various folk have put out calls for help with tooling
for older CPUs (without which support gets dropped), but I don't think
anyone stepped up.

So... you might be able to work around the userspace issues by setting
the alignment fault handling to "fixup" but that really won't help the
decompressor - we have no ways to take any faults in the decompressor,
so we can't fix up an unaligned access.

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

  reply	other threads:[~2017-10-15 13:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 13:13 ARM: pxa/corgi: armv5te kernel 4.12 fails to decompress compiled with gcc7 Andrea Adami
2017-07-20  6:57 ` Robert Jarzmik
2017-09-02 21:50   ` Andrea Adami
2017-10-14 21:50     ` Aaro Koskinen
2017-10-14 21:57       ` Robert Jarzmik
2017-10-15 10:46         ` Aaro Koskinen
2017-10-15 13:01           ` Russell King - ARM Linux [this message]
2017-10-15 15:14             ` Aaro Koskinen
2017-10-16 11:55           ` Petr Cvek
2017-10-17  8:02             ` Andrea Adami
2017-10-17  8:10               ` Petr Cvek
2017-10-17  8:18                 ` Andrea Adami
2017-10-18 10:39                   ` Petr Cvek
2017-10-18 10:44                     ` Russell King - ARM Linux
2017-10-18 11:12                       ` Petr Cvek
2017-10-24  8:34                         ` Andrea Adami
2017-10-24  8:43                           ` Andrea Adami
2017-10-17 20:33             ` Aaro Koskinen
2017-10-18  9:57               ` Petr Cvek
2017-10-14 22:00       ` Petr Cvek

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=20171015130118.GJ20805@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.