lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1711151425100.3893@tp.orcam.me.uk>
Date:   Wed, 15 Nov 2017 14:53:33 +0000
From:   "Maciej W. Rozycki" <macro@...s.com>
To:     Matt Redfearn <matt.redfearn@...s.com>
CC:     James Hogan <james.hogan@...s.com>,
        Corey Minyard <cminyard@...sta.com>,
        Ralf Baechle <ralf@...ux-mips.org>,
        Matthew Fortune <matthew.fortune@...s.com>,
        <linux-mips@...ux-mips.org>, <linux-kernel@...r.kernel.org>,
        "Jason A. Donenfeld" <jason@...c4.com>,
        "Paul Burton" <paul.burton@...s.com>
Subject: Re: [PATCH] MIPS: Fix exception entry when CONFIG_EVA enabled

Hi Matt,

On Wed, 15 Nov 2017, Maciej W. Rozycki wrote:

>  Can you send me .i output from the offending source along with GCC 
> options used to make .o output (use `V=1' with `make' if needed)?  I'll 
> check if my hypothesis is right or find the actual cause otherwise.

 Thanks for the pieces requested.

 I can see what is going on here: the problem is the source is built with 
no optimisation enabled.  Consequently GAS does not schedule delay slots 
itself.  I wasn't aware we had this problem with kernel build flags -- it 
certainly affects more than just this piece of code.

 For GAS to schedule delay slots it has to be passed -O2 by the GCC 
driver.  The driver in turn will pass -O2 to GAS whenever at least -O has 
been used.  By default -O1 is passed, which only enables the removal of 
unnecessary NOPs, i.e. those that have been inserted precautionarily for 
execution hazard avoidance in the assembly pass and in the end turned out 
unnecessary and can be optionally removed in the relaxation pass.  NB 
GAS's default is actually -O2, i.e. when invoked directly, however this is 
overridden by the GCC driver as described.

 My recommendation would be using just the same CFLAGS for assembly 
sources that are used for C language sources; the GCC driver will silently 
filter out options that are irrelevant and interpret all the options that 
do have relevance.  This may be important for various `-f<foo>' and 
`-m<bar>' options which may sometimes affect assembly generation and, for 
that matter, multilib selection.

 This also means all CFLAGS should be passed to the linker as well, 
because again, they may affect linker options.

 So if you stick say `-O2' with your compiler invocation, for the purpose 
of this consideration possibly just like this:

$ make AFLAGS_genex.o=-O2 arch/mips/kernel/genex.o

then you should get the delay slot in question (and any other ones) 
scheduled.  Indeed with this build recipe applied I can already see a 
small code size reduction in `genex.o' even without your change:

$ size arch/mips/kernel/genex-?.o
   text	   data	    bss	    dec	    hex	filename
   8236	     48	      0	   8284	   205c	arch/mips/kernel/genex-0.o
   8204	     48	      0	   8252	   203c	arch/mips/kernel/genex-1.o
$

 HTH,

  Maciej

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ