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: <CALCETrV36fXFj8hqPNh-SUTg5Xt1ayB62CBLx8q5F1uAo4_YRA@mail.gmail.com>
Date:	Sat, 7 Nov 2015 09:05:06 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Borislav Petkov <bp@...en8.de>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Brian Gerst <brgerst@...il.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	X86 ML <x86@...nel.org>, Peter Zijlstra <peterz@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels

On Sat, Nov 7, 2015 at 8:58 AM, Thomas Gleixner <tglx@...utronix.de> wrote:
> On Sat, 7 Nov 2015, Andy Lutomirski wrote:
>> On Nov 7, 2015 3:21 AM, "Thomas Gleixner" <tglx@...utronix.de> wrote:
>> > +/* ASM jump label support */
>> > +#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
>> > +#include <asm/jump_label.h>
>> > +
>> > +       .macro STATIC_CALL_IF_ENABLED fun, key
>>
>> I think we still need the "def" parameter.  But maybe the "static
>> call" is a good idea.  (By giving 'def' a default value or omitting it
>> entirely, it's too easy not to think about it, and that's a huge
>> historical source of breakage and it's a good part of the reason for
>> the new improved C API.  At least these days I *think* we'll diagnose
>> the problem on bootup instead of waiting for random breakage later.)
>
> Ok. That's easy to add :)
>
>> > +       1:
>> > +       jmp.d32         2f
>>
>> Old binutils will choke on this.  But maybe no one has jump labels and
>> old binutils.
>
> Good question.
>
>> > +       call            fun
>> > +       .pushsection __jump_table, "aw"
>> > +       _ASM_ALIGN
>> > +       _ASM_PTR        1b, 2f, \key
>> > +       .popsection
>> > +       2:
>> > +       .endm
>> > +#else
>> > +       .macro STATIC_CALL_IF_ENABLED fun, key
>> > +       call            fun
>> > +       .endm
>>
>> This could result in errors down the road, since this macro is really
>> "static call if enabled or if the kernel is built without jump
>> labels".  enter_from_user_mode is special because it's already a no-op
>> if context tracking is off, but I'm not sure that this oddity should
>> leak into more generic code.
>
> Hmm. Maybe we need a better name for this macro.
>
>> > +#endif
>> > Index: tip/arch/x86/entry/entry_64.S
>> > ===================================================================
>> > --- tip.orig/arch/x86/entry/entry_64.S
>> > +++ tip/arch/x86/entry/entry_64.S
>> > @@ -510,7 +510,7 @@ END(irq_entries_start)
>> >          */
>> >         SWAPGS
>> >  #ifdef CONFIG_CONTEXT_TRACKING
>> > -       call enter_from_user_mode
>> > +       STATIC_CALL_IF_ENABLED enter_from_user_mode, context_tracking_enabled
>> >  #endif
>>
>> This doesn't get rid of the ifdeffery, which I thought was a nice
>> feature of my patch.
>
> Right. I was just too lazy to add another macro :)
>
> My main point was to avoid the extra stuff for !HAVE_JUMP_LABEL and
> hide this in a header file.
>

True.  But I hid it in a header file, too, but it was just a different
header file -- I had it all hidden away as CALL_ENTER_FROM_USER_MODE.

--Andy
--
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