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] [thread-next>] [day] [month] [year] [list]
Message-ID: <55CB90CD.4000805@oracle.com>
Date:	Wed, 12 Aug 2015 14:30:37 -0400
From:	Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:	Andy Lutomirski <luto@...capital.net>
CC:	Peter Zijlstra <peterz@...radead.org>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Stefano Stabellini <stefano.stabellini@...citrix.com>,
	Xen Devel <Xen-devel@...ts.xensource.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...e.hu>, "H. Peter Anvin" <hpa@...or.com>,
	"linux-next@...r.kernel.org" <linux-next@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andy Lutomirski <luto@...nel.org>,
	David Vrabel <david.vrabel@...rix.com>
Subject: Re: linux-next: manual merge of the xen-tip tree with the tip tree

On 08/12/2015 02:26 PM, Andy Lutomirski wrote:
> On Wed, Aug 12, 2015 at 11:17 AM, Boris Ostrovsky
> <boris.ostrovsky@...cle.com> wrote:
>> On 08/12/2015 01:46 PM, Peter Zijlstra wrote:
>>> On Wed, Aug 12, 2015 at 07:21:05PM +0200, Peter Zijlstra wrote:
>>>> On Wed, Aug 12, 2015 at 09:27:38AM -0400, Boris Ostrovsky wrote:
>>>>
>>>>> Incidentally, 11276d53 ("locking/static_keys: Add a new static_key
>>>>> interface") breaks old-ish compilers (gcc version 4.4.4 20100503 (Red
>>>>> Hat
>>>>> 4.4.4-2) (GCC)):
>>>>>
>>>>>
>>>>>
>>>>>     CC      arch/x86/kernel/nmi.o
>>>>> In file included from
>>>>> /home/build/linux-boris/include/linux/jump_label.h:109,
>>>>>                    from
>>>>> /home/build/linux-boris/arch/x86/include/asm/spinlock.h:5,
>>>>>                    from
>>>>> /home/build/linux-boris/include/linux/spinlock.h:88,
>>>>>                    from /home/build/linux-boris/arch/x86/kernel/nmi.c:14:
>>>>> /home/build/linux-boris/arch/x86/include/asm/jump_label.h: In function
>>>>> ‘nmi_handle’:
>>>>> /home/build/linux-boris/arch/x86/include/asm/jump_label.h:21: warning:
>>>>> asm
>>>>> operand 0 probably doesn’t match constraints
>>>>> /home/build/linux-boris/arch/x86/include/asm/jump_label.h:21: error:
>>>>> impossible constraint in ‘asm’
>>>>> make[3]: *** [arch/x86/kernel/nmi.o] Error 1
>>>>> make[2]: *** [arch/x86/kernel] Error 2
>>>>> make[1]: *** [arch/x86] Error 2
>>>> Ugh bugger.
>>>>
>>>> I bet its that: &((char *)key)[branch] business, an earlier variant
>>>> thereof tripped up more recent GCCs too.
>>>>
>>>> So its an __always_inline function, and both argument are always compile
>>>> time constants, @key is the address of an object in static storage (a
>>>> global) and @branch is a simple 0/1 at the call site.
>>>>
>>>> Now we wish to compute (unsigned long)key + branch at compile/link time
>>>> to feed to the assembler as an immediate, which should be possible,
>>>> given its all 'constants'.
>>>>
>>>> It just appears GCC is having a hard time with this.
>>>>
>>>> Let me see if I have a sufficiently old GCC around to play with.
>>> Could you feed the below to your compiler? Its a bit cumbersome, but
>>> its the next best I could come up with...
>>
>> No, it produces the same error. This is Fedora 13, btw, uses gcc 4.4.4.
> Is the problem just that it's being misdetected as supporting asm
> goto?  What does gcc -E say?

static inline __attribute__((no_instrument_function)) 
__attribute__((always_inline)) bool arch_static_branch(struct static_key 
*key, bool branch)
{
  do { asm goto("1:" ".byte " "0x0f,0x1f,0x44,0x00,0" "\n\t" 
".pushsection __jump_table,  \"aw\" \n\t" " " ".balign 8" " " "\n\t" " " 
".quad" " " "1b, %l[l_yes], %c0 \n\t" ".popsection \n\t" : : "i" 
(&((char *)key)[branch]) : : l_yes); asm (""); } while (0)

return false;
l_yes:
  return true;
}

-boris

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ