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, 19 Nov 2008 21:09:59 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Roland McGrath <roland@...hat.com>
Cc:	Jan Beulich <jbeulich@...ell.com>, heukelum@...tmail.fm,
	Andi Kleen <andi@...stfloor.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Alexander van Heukelum <heukelum@...lshack.com>,
	Glauber Costa <gcosta@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Nick Piggin <nickpiggin@...oo.com.au>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [RFC,v2] x86_64: save_args out of line


* Ingo Molnar <mingo@...e.hu> wrote:

> What _clearly_ sucks is the current mess of:
> 
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        ss,0*/
>         pushq %rax /* rsp */
>         CFI_ADJUST_CFA_OFFSET   8
>         CFI_REL_OFFSET  rsp,0
>         pushq $(1<<9) /* eflags - interrupts on */
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        rflags,0*/
>         pushq $__KERNEL_CS /* cs */
>         CFI_ADJUST_CFA_OFFSET   8
>         /*CFI_REL_OFFSET        cs,0*/
>         pushq \child_rip /* rip */
>         CFI_ADJUST_CFA_OFFSET   8
>         CFI_REL_OFFSET  rip,0
>         pushq   %rax /* orig rax */
>         CFI_ADJUST_CFA_OFFSET   8
> 
> Compared to what we could have (stupid mockup):
> 
>         pushq_cf1 %rax			/* rsp */
>         pushq_cf1 $(1<<9)		/* eflags - interrupts on */
>         pushq_cf1 $__KERNEL_CS		/* cs */
>         pushq_cf2 \child_rip		/* rip */
>         pushq_cf1 %rax			/* orig rax */
> 
> Whoever claims that this cannot be automated in _large_ part isnt 
> thinking it through really. Those CFI annotations should never have 
> been added in this form.

Something like this would be a lot cleaner equivalent replacement:

         PUSHQ %rax			/* rsp 			  */
         PUSHQ $(1<<9)			/* eflags - interrupts on */
         PUSHQ $__KERNEL_CS		/* cs 			  */
         PUSHQ \child_rip		/* rip			  */
          cfi_map rip, 0
         PUSHQ %rax			/* orig rax		  */

as most of the really annoying CFI annotations in entry_64.S that 
obscruct code reading are just plain CFA offset modifications related 
to stack shuffling.

[ Sidenote: trying to connect up RIP like that in the FAKE_STACK_FRAME
  is pretty wrong to begin with - the annotation is incomplete up to
  this point. ]

The problems are not caused by the prologue or epilogue annotations, 
nor by any of the trickier stack shuffling annotations we do around 
syscall/sysret and around exception frames. A lot of the frame formats 
we use are special, controlled by hw details and we do have to map 
those details to the debuginfo - it's an inevitably manual piece of 
work.

It's the plain crappy:

        pushq %rdi
        CFI_ADJUST_CFA_OFFSET 8
        call schedule
        popq  %rdi
        CFI_ADJUST_CFA_OFFSET -8

annotation spam that hurts readability the most. The "+8" and "-8" 
CFA-offset lines are completely uninformative and they obsctruct the 
reading of this already very trick type of source code (assembly 
language).

It should be something like this:

        PUSHQ %rdi
        call schedule
        POPQ %rdi

instead.

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