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]
Date:	Wed, 25 Mar 2015 19:19:01 +0100
From:	Denys Vlasenko <dvlasenk@...hat.com>
To:	Ingo Molnar <mingo@...nel.org>
CC:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Borislav Petkov <bp@...en8.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Oleg Nesterov <oleg@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Alexei Starovoitov <ast@...mgrid.com>,
	Will Drewry <wad@...omium.org>,
	Kees Cook <keescook@...omium.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] x86/asm/entry/64: do not TRACE_IRQS fast SYSRET64
 path

On 03/25/2015 07:04 PM, Ingo Molnar wrote:
>>> * Denys Vlasenko <dvlasenk@...hat.com> wrote:
>>>
>>>> SYSRET code path has a small irq-off block.
>>>> On this code path, TRACE_IRQS_ON can't be called right before interrupts
>>>> are enabled for real, we can't clobber registers there.
>>>> So current code does it earlier, in a safe place.
>>>>
>>>> But with this, TRACE_IRQS_OFF/ON frames just two fast instructions,
>>>> which is ridiculous: now most of irq-off block is _outside_ of the framing.
>>>>
>>>> Do the same thing that we do on SYSCALL entry: do not track this irq-off block,
>>>> it is very small to ever cause noticeable irq latency.
>>>>
>>>> Be careful: make sure that "jnz int_ret_from_sys_call_irqs_off" now does
>>>> invoke TRACE_IRQS_OFF - move int_ret_from_sys_call_irqs_off label before
>>>> TRACE_IRQS_OFF.
>>>
>>>> @@ -345,8 +346,8 @@ tracesys_phase2:
>>>>   */
>>>>  GLOBAL(int_ret_from_sys_call)
>>>>  	DISABLE_INTERRUPTS(CLBR_NONE)
>>>> -	TRACE_IRQS_OFF
>>>>  int_ret_from_sys_call_irqs_off:
>>>> +	TRACE_IRQS_OFF
>>>>  	movl $_TIF_ALLWORK_MASK,%edi
>>>>  	/* edi:	mask to check */
>>>
>>> This latter trick absolutely needs a comment, to keep future lockdep 
>>> developers from wondering about the mismatch and the weird label 
>>> placement ...
>>
>> Unsure how to format it.
>>
>> How about:
>>
>>
>> 	DISABLE_INTERRUPTS(CLBR_NONE)
>> int_ret_from_sys_call_irqs_off: /* jumps come here with irqs off */
>> 	TRACE_IRQS_OFF
> 
> Why not something like 'jumps come here from the irqs-off SYSRET 
> path'?

Ok. I'll send v2 for patches 1 and 2.

(Patch 1 will be expanded, there is another instance of jump
needing the same treatment.)

>>
>>
>>
>> (In truth, there is only one jump as of now, but using pliral
>> "jumps" if that would change)
> 
> I'd also put a comment to the actual sysret IRQ-disablement that we 
> are skipping with the annotation.


Patch does add such a comment:

+       /*
+        * We do not frame this tiny irq-off block with TRACE_IRQS_OFF/ON,
+        * it is too small to ever cause noticeable irq latency.
+        */


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