linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Investigating a stack state mismatch in Linux kernel
       [not found] ` <875zwyabac.fsf@oldenburg.str.redhat.com>
@ 2018-11-15 20:51   ` Alexander Popov
  2018-11-20 23:08     ` Alexander Popov
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Popov @ 2018-11-15 20:51 UTC (permalink / raw)
  To: Florian Weimer, Richard Sandiford
  Cc: Kees Cook, Ingo Molnar, Andy Lutomirski, Tycho Andersen,
	Laura Abbott, Mark Rutland, Ard Biesheuvel, Borislav Petkov,
	Thomas Gleixner, H . Peter Anvin, Peter Zijlstra, Emese Revfy,
	Thomas Garnier, Alexei Starovoitov, Masami Hiramatsu,
	David S . Miller, Steven Rostedt, Dave Hansen, Will Deacon,
	Jann Horn, linux-arm-kernel, gcc-bugs, gcc-help, LKML,
	kernel-hardening

[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]

On 15.11.2018 13:24, Florian Weimer wrote:
> * Alexander Popov:
> 
>> Of course, there is a naive solution for this issue -- just skip stackleak
>> instrumentation for acpi_duplicate_processor_id(). But it would be great to find
>> out the reasons behind this compiler behavior. It might help to create a better
>> solution.
> 
> Please show us the RTL dumps with both compilers, both before and after
> the plugin pass.

Thanks a lot for your reply, Florian!

I have more information to share.

I attach the list of gcc passes. The 'rtl-stackleak_cleanup' runs after the
'rtl-reload' pass.

I attach RTL dumps both for gcc-5 and gcc-7 for:
  - 'rtl-reload' pass,
  - 'rtl-stackleak_cleanup' pass,
  - 'rtl-pro_and_epilogue' pass.

I've found out that for gcc-5:
  - if I put the 'rtl-stackleak_cleanup' pass (deleting CALL insn) *before* the
'rtl-pro_and_epilogue' pass, objtool reports about stack state mismatch in
acpi_duplicate_processor_id();
  - if I put the 'rtl-stackleak_cleanup' pass *after* the 'rtl-pro_and_epilogue'
pass, objtool *doesn't* report about stack state mismatch.

So gcc-5 does some mistake during the 'rtl-pro_and_epilogue' pass. And gcc-7
doesn't have this issue.

In the original grsecurity code the stackleak RTL pass was registered just
before the 'rtl-final' pass. Some time ago Richard Sandiford noted that:

>>> This might be too late, since it happens e.g. after addresses have
>>> been calculated for branch ranges, and after machine-specific passes
>>> (e.g. bundling on ia64).
>>>
>>> The stack size is final after reload, so inserting the pass after that
>>> might be better.

https://lore.kernel.org/patchwork/patch/879912/


So what is the best moment when we know the stack frame size and can safely
delete the CALL insn using delete_insn_and_edges()?

Thanks!

Best regards,
Alexander


[-- Attachment #2: gcc5-after-stackleak_cleanup.txt --]
[-- Type: text/plain, Size: 8078 bytes --]

;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29265, cgraph_uid=3143, symbol_order=3218)

deleting insn with uid = 8.


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0[ax] 1[dx] 2[cx] 3[bx] 5[di] 6[bp] 7[sp] 17[flags]
;;  ref usage 	r0={6d,6u} r1={2d,2u} r2={2d,1u} r3={1d,1u} r4={1d} r5={1d,1u} r6={1d,8u} r7={1d,8u} r17={7d,3u} r20={1d,1u} r37={1d} r38={1d} 
;;    total ref usage 56{25d,31u,0e} in 20{20 regular + 0 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 6 3 2 (set (reg/v:SI 3 bx [orig:98 proc_id ] [98])
        (reg:SI 5 di [ proc_id ])) drivers/acpi/acpi_processor.c:687 90 {*movsi_internal}
     (nil))
(note 3 2 14 2 NOTE_INSN_FUNCTION_BEG)
(note 14 3 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:91 D.40587 ] [91])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x7fd77f416090 nr_duplicate_ids>) [0 nr_duplicate_ids+0 S4 A32])) drivers/acpi/acpi_processor.c:694 90 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 0 [0]))) drivers/acpi/acpi_processor.c:694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref 44)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 44)
(note 20 19 22 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 22 20 24 3 (set (reg:DI 0 ax [orig:92 D.40586 ] [92])
        (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 89 {*movdi_internal}
     (nil))
(insn 24 22 25 3 (parallel [
            (set (reg:DI 2 cx [107])
                (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 25 24 26 3 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [107])) 89 {*movdi_internal}
     (nil))
(insn 26 25 27 3 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:98 proc_id ] [98])
            (mem/j/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x7fd77f4161b0 duplicate_processor_ids>) [0 duplicate_processor_ids+0 S4 A32]))) drivers/acpi/acpi_processor.c:695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 3 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 58)
            (pc))) drivers/acpi/acpi_processor.c:695 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 58)
(note 28 27 34 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 4 NOTE_INSN_DELETED)
(note 35 34 36 4 NOTE_INSN_DELETED)
(insn 36 35 37 4 (parallel [
            (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 1 [0x1]))) drivers/acpi/acpi_processor.c:694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 44)
(note 39 38 41 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 5 (parallel [
            (set (reg:DI 0 ax [115])
                (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 5 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [115])) 89 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 6 101 "" [2 uses])
(note 45 44 5 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 65 6 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 0 [0])) drivers/acpi/acpi_processor.c:698 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 65 5 66 6 (set (pc)
        (label_ref 46)) 654 {jump}
     (nil)
 -> 46)
(barrier 66 65 58)
(code_label 58 66 57 7 103 "" [1 uses])
(note 57 58 4 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 4 57 46 7 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 1 [0x1])) drivers/acpi/acpi_processor.c:696 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 46 4 47 8 102 "" [1 uses])
(note 47 46 52 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 52 47 53 8 (set (reg/i:QI 0 ax)
        (reg:QI 0 ax [orig:87 D.40585 ] [87])) drivers/acpi/acpi_processor.c:699 93 {*movqi_internal}
     (nil))
(insn 53 52 67 8 (use (reg/i:QI 0 ax)) drivers/acpi/acpi_processor.c:699 -1
     (nil))
(note 67 53 0 NOTE_INSN_DELETED)


[-- Attachment #3: gcc5-after-reload.txt --]
[-- Type: text/plain, Size: 16996 bytes --]

;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29265, cgraph_uid=3143, symbol_order=3218)


********** Local #1: **********

	   Spilling non-eliminable hard regs: 6
New elimination table:
Can't eliminate 16 to 7 (offset=24, prev_offset=0)
Can eliminate 16 to 6 (offset=16, prev_offset=0)
Can't eliminate 20 to 7 (offset=0, prev_offset=0)
Can eliminate 20 to 6 (offset=-8, prev_offset=0)
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 8:  (0) rBwBz {*call}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=18,losers=2,rld_nregs=2
          alt=1,overall=0,losers=0,rld_nregs=0
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=0,overall=9,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=17,losers=2 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 1 in insn 16:  (0) rm  (1) 0  (2) re {*adddi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 17:  (0) =r  (1) g {*movsi_internal}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 18:  (0) r {*cmpsi_ccno_1}
            alt=2: Bad operand -- refuse
          alt=3,overall=0,losers=0,rld_nregs=0
	 Choosing alt 3 in insn 22:  (0) r  (1) rem {*movdi_internal}
            1 Matching alt: reject+=2
          alt=0,overall=8,losers=1,rld_nregs=1
            1 Matching alt: reject+=2
          alt=1,overall=8,losers=1,rld_nregs=1
            2 Matching alt: reject+=2
            2 Non-pseudo reload: reject+=2
            2 Non input pseudo reload: reject++
            alt=2,overall=11,losers=1 -- refuse
          alt=3,overall=0,losers=0,rld_nregs=0
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=0,overall=11,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=11,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 3 in insn 24:  (0) r  (1) r  (2) le {*adddi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2: Bad operand -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
          alt=3,overall=609,losers=1,rld_nregs=1
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=4: Bad operand -- refuse
          alt=5,overall=0,losers=0,rld_nregs=0
	 Choosing alt 5 in insn 25:  (0) m  (1) re {*movdi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=9,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 26:  (0) r  (1) rm {*cmpsi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=18,losers=2,rld_nregs=2
          alt=1,overall=0,losers=0,rld_nregs=0
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=0,overall=9,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=17,losers=2 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 1 in insn 36:  (0) rm  (1) 0  (2) re {*adddi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 37:  (0) rm  (1) re {*cmpsi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=0,overall=11,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=11,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 0 in insn 41:  (0) =r  (1) %0  (2) rme {*adddi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2: Bad operand -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
          alt=3,overall=609,losers=1,rld_nregs=1
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=4: Bad operand -- refuse
          alt=5,overall=0,losers=0,rld_nregs=0
	 Choosing alt 5 in insn 42:  (0) m  (1) re {*movdi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=609,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 5:  (0) q  (1) qn {*movqi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=609,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 4:  (0) q  (1) qn {*movqi_internal}

********** Pseudo live ranges #1: **********

  BB 5
   Insn 42: point = 0
   Insn 41: point = 1
  BB 8
   Insn 53: point = 4
   Insn 52: point = 4
  BB 6
   Insn 65: point = 6
   Insn 5: point = 6
  BB 4
   Insn 38: point = 7
   Insn 37: point = 7
   Insn 36: point = 8
  BB 7
   Insn 4: point = 9
  BB 3
   Insn 27: point = 10
   Insn 26: point = 10
   Insn 25: point = 11
   Insn 24: point = 12
   Insn 22: point = 13
  BB 2
   Insn 19: point = 15
   Insn 18: point = 15
   Insn 17: point = 15
   Insn 16: point = 16
   Insn 8: point = 16
   Insn 2: point = 16
Compressing live ranges: from 17 to 0 - 0%
Ranges after the compression:
New elimination table:
Can't eliminate 16 to 7 (offset=24, prev_offset=0)
Can eliminate 16 to 6 (offset=16, prev_offset=0)
Can't eliminate 20 to 7 (offset=0, prev_offset=0)
Can eliminate 20 to 6 (offset=-8, prev_offset=0)
changing reg in insn 4
changing reg in insn 5
changing reg in insn 52
changing reg in insn 17
changing reg in insn 37
changing reg in insn 18
changing reg in insn 22
changing reg in insn 41
changing reg in insn 24
changing reg in insn 2
changing reg in insn 26
changing reg in insn 24
changing reg in insn 25
changing reg in insn 41
changing reg in insn 42


try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns
verify found no changes in insn with uid = 8.
starting the processing of deferred insns
ending the processing of deferred insns
df_analyze called
df_worklist_dataflow_doublequeue:n_basic_blocks 9 n_edges 10 count 9 (    1)
df_worklist_dataflow_doublequeue:n_basic_blocks 9 n_edges 10 count 9 (    1)


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0[ax] 1[dx] 2[cx] 3[bx] 5[di] 6[bp] 7[sp] 17[flags]
;;  ref usage 	r0={7d,6u} r1={3d,2u} r2={3d,1u} r3={1d,1u} r4={2d} r5={2d,1u} r6={1d,8u} r7={1d,9u} r8={1d} r9={1d} r10={1d} r11={1d} r12={1d} r13={1d} r14={1d} r15={1d} r17={8d,3u} r18={1d} r19={1d} r20={1d,1u} r21={1d} r22={1d} r23={1d} r24={1d} r25={1d} r26={1d} r27={1d} r28={1d} r29={1d} r30={1d} r31={1d} r32={1d} r33={1d} r34={1d} r35={1d} r36={1d} r37={2d} r38={2d} r39={1d} r40={1d} r45={1d} r46={1d} r47={1d} r48={1d} r49={1d} r50={1d} r51={1d} r52={1d} r53={1d} r54={1d} r55={1d} r56={1d} r57={1d} r58={1d} r59={1d} r60={1d} r61={1d} r62={1d} r63={1d} r64={1d} r65={1d} r66={1d} r67={1d} r68={1d} r69={1d} r70={1d} r71={1d} r72={1d} r73={1d} r74={1d} r75={1d} r76={1d} r77={1d} r78={1d} r79={1d} r80={1d} 
;;    total ref usage 129{97d,32u,0e} in 21{20 regular + 1 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 6 3 2 (set (reg/v:SI 3 bx [orig:98 proc_id ] [98])
        (reg:SI 5 di [ proc_id ])) drivers/acpi/acpi_processor.c:687 90 {*movsi_internal}
     (nil))
(note 3 2 8 2 NOTE_INSN_FUNCTION_BEG)
(call_insn 8 3 14 2 (call (mem:QI (symbol_ref:DI ("stackleak_track_stack") [flags 0x41]  <function_decl 0x7fd78183ce58 stackleak_track_stack>) [0 stackleak_track_stack S1 A8])
        (const_int 0 [0])) 660 {*call}
     (expr_list:REG_CALL_DECL (symbol_ref:DI ("stackleak_track_stack") [flags 0x41]  <function_decl 0x7fd78183ce58 stackleak_track_stack>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (nil))
(note 14 8 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:91 D.40587 ] [91])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x7fd77f416090 nr_duplicate_ids>) [0 nr_duplicate_ids+0 S4 A32])) drivers/acpi/acpi_processor.c:694 90 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 0 [0]))) drivers/acpi/acpi_processor.c:694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref 44)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 44)
(note 20 19 22 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 22 20 24 3 (set (reg:DI 0 ax [orig:92 D.40586 ] [92])
        (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 89 {*movdi_internal}
     (nil))
(insn 24 22 25 3 (parallel [
            (set (reg:DI 2 cx [107])
                (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 25 24 26 3 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [107])) 89 {*movdi_internal}
     (nil))
(insn 26 25 27 3 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:98 proc_id ] [98])
            (mem/j/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x7fd77f4161b0 duplicate_processor_ids>) [0 duplicate_processor_ids+0 S4 A32]))) drivers/acpi/acpi_processor.c:695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 3 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 58)
            (pc))) drivers/acpi/acpi_processor.c:695 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 58)
(note 28 27 34 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 4 NOTE_INSN_DELETED)
(note 35 34 36 4 NOTE_INSN_DELETED)
(insn 36 35 37 4 (parallel [
            (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 1 [0x1]))) drivers/acpi/acpi_processor.c:694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 44)
(note 39 38 41 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 5 (parallel [
            (set (reg:DI 0 ax [115])
                (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 5 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [115])) 89 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 6 101 "" [2 uses])
(note 45 44 5 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 65 6 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 0 [0])) drivers/acpi/acpi_processor.c:698 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 65 5 66 6 (set (pc)
        (label_ref 46)) 654 {jump}
     (nil)
 -> 46)
(barrier 66 65 58)
(code_label 58 66 57 7 103 "" [1 uses])
(note 57 58 4 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 4 57 46 7 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 1 [0x1])) drivers/acpi/acpi_processor.c:696 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 46 4 47 8 102 "" [1 uses])
(note 47 46 52 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 52 47 53 8 (set (reg/i:QI 0 ax)
        (reg:QI 0 ax [orig:87 D.40585 ] [87])) drivers/acpi/acpi_processor.c:699 93 {*movqi_internal}
     (nil))
(insn 53 52 67 8 (use (reg/i:QI 0 ax)) drivers/acpi/acpi_processor.c:699 -1
     (nil))
(note 67 53 0 NOTE_INSN_DELETED)


[-- Attachment #4: gcc5-after-pro_and_epilogue.txt --]
[-- Type: text/plain, Size: 10318 bytes --]


;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29265, cgraph_uid=3143, symbol_order=3218)



try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns
df_analyze called
Attempting shrink-wrapping optimization.
scanning new insn with uid = 73.
deleting insn with uid = 2.
Found candidate edge for shrink-wrapping, 2->3.
Performing shrink-wrapping.
changing bb of uid 76
  unscanned insn
Duplicating bb 6 to bb 9, 1 active insns.
scanning new insn with uid = 80.
verify found no changes in insn with uid = 19.
Edge 2->6 redirected to 9
changing bb of uid 82
  unscanned insn
changing bb of uid 77
  unscanned insn
Duplicating bb 8 to bb 10, 0 active insns.
scanning new insn with uid = 84.
scanning new insn with uid = 69.
scanning new insn with uid = 70.
scanning new insn with uid = 71.
scanning new insn with uid = 86.
scanning new insn with uid = 87.
scanning new insn with uid = 88.
scanning new insn with uid = 90.


try_optimize_cfg iteration 1

Merging block 10 into block 9...
changing bb of uid 84
  from 10 to 9
changing bb of uid 90
  from 10 to 9
Merged blocks 9 and 10.
Merged 9 and 10 without moving.


try_optimize_cfg iteration 2



try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 3 [bx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 3 [bx] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0[ax] 1[dx] 2[cx] 3[bx] 5[di] 6[bp] 7[sp] 17[flags]
;;  ref usage 	r0={6d,6u} r1={2d,2u} r2={2d,1u} r3={3d,3u} r4={1d} r5={1d,1u} r6={3d,10u} r7={5d,14u} r17={6d,3u} r20={1d,1u} r37={1d} r38={1d} 
;;    total ref usage 73{32d,41u,0e} in 28{28 regular + 0 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note 3 6 14 2 NOTE_INSN_FUNCTION_BEG)
(note 14 3 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/j/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>) [0 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:91 D.40587 ] [91])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x7fd77f416090 nr_duplicate_ids>) [0 nr_duplicate_ids+0 S4 A32])) drivers/acpi/acpi_processor.c:694 90 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 0 [0]))) drivers/acpi/acpi_processor.c:694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 81)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 81)
(note 20 19 69 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn/f 69 20 70 3 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg/f:DI 6 bp)) drivers/acpi/acpi_processor.c:687 -1
     (nil))
(insn/f 70 69 71 3 (set (reg/f:DI 6 bp)
        (reg/f:DI 7 sp)) drivers/acpi/acpi_processor.c:687 -1
     (nil))
(insn/f 71 70 72 3 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg:DI 3 bx)) drivers/acpi/acpi_processor.c:687 -1
     (nil))
(note 72 71 73 3 NOTE_INSN_PROLOGUE_END)
(insn 73 72 22 3 (set (reg/v:SI 3 bx [orig:98 proc_id ] [98])
        (reg:SI 5 di [ proc_id ])) -1
     (nil))
(insn 22 73 68 3 (set (reg:DI 0 ax [orig:92 D.40586 ] [92])
        (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 89 {*movdi_internal}
     (nil))
(insn 68 22 25 3 (set (reg:DI 2 cx [107])
        (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
            (const_int 1 [0x1]))) 214 {*leadi}
     (nil))
(insn 25 68 26 3 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [107])) 89 {*movdi_internal}
     (nil))
(insn 26 25 27 3 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:98 proc_id ] [98])
            (mem/j/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x7fd77f4161b0 duplicate_processor_ids>) [0 duplicate_processor_ids+0 S4 A32]))) drivers/acpi/acpi_processor.c:695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 3 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 58)
            (pc))) drivers/acpi/acpi_processor.c:695 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 58)
(note 28 27 34 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 4 NOTE_INSN_DELETED)
(note 35 34 36 4 NOTE_INSN_DELETED)
(insn 36 35 37 4 (parallel [
            (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [0 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:91 D.40587 ] [91])
            (const_int 1 [0x1]))) drivers/acpi/acpi_processor.c:694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) drivers/acpi/acpi_processor.c:694 612 {*jcc_1}
     (int_list:REG_BR_PROB 450 (nil))
 -> 44)
(note 39 38 41 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 5 (parallel [
            (set (reg:DI 0 ax [115])
                (plus:DI (reg:DI 0 ax [orig:92 D.40586 ] [92])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 5 (set (mem/j/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x7fd77f0eccf0 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [0 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [115])) 89 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 6 101 "" [1 uses])
(note 45 44 5 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 65 6 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 0 [0])) drivers/acpi/acpi_processor.c:698 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 65 5 66 6 (set (pc)
        (label_ref 46)) 654 {jump}
     (nil)
 -> 46)
(barrier 66 65 58)
(code_label 58 66 57 7 103 "" [1 uses])
(note 57 58 4 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 4 57 46 7 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 1 [0x1])) drivers/acpi/acpi_processor.c:696 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 46 4 47 8 102 "" [1 uses])
(note 47 46 53 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 53 47 85 8 (use (reg/i:QI 0 ax)) drivers/acpi/acpi_processor.c:699 -1
     (nil))
(note 85 53 86 8 NOTE_INSN_EPILOGUE_BEG)
(insn/f 86 85 87 8 (set (reg:DI 3 bx)
        (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8])) drivers/acpi/acpi_processor.c:699 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 3 bx)
        (nil)))
(insn/f 87 86 88 8 (set (reg/f:DI 6 bp)
        (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8])) drivers/acpi/acpi_processor.c:699 -1
     (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 7 sp)
            (const_int 8 [0x8]))
        (expr_list:REG_CFA_RESTORE (reg/f:DI 6 bp)
            (nil))))
(jump_insn 88 87 89 8 (simple_return) drivers/acpi/acpi_processor.c:699 -1
     (nil)
 -> simple_return)
(barrier 89 88 67)
(note 67 89 81 NOTE_INSN_DELETED)
(code_label 81 67 76 9 108 "" [1 uses])
(note 76 81 80 9 [bb 9] NOTE_INSN_BASIC_BLOCK)
(insn 80 76 84 9 (set (reg:QI 0 ax [orig:87 D.40585 ] [87])
        (const_int 0 [0])) drivers/acpi/acpi_processor.c:698 93 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(insn 84 80 90 9 (use (reg/i:QI 0 ax)) drivers/acpi/acpi_processor.c:699 -1
     (nil))
(jump_insn 90 84 78 9 (simple_return) drivers/acpi/acpi_processor.c:699 -1
     (nil)
 -> simple_return)
(barrier 78 90 0)


[-- Attachment #5: gcc7-after-stackleak_cleanup.txt --]
[-- Type: text/plain, Size: 8192 bytes --]

;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29214, cgraph_uid=3143, symbol_order=3218)

deleting insn with uid = 8.


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0 [ax] 1 [dx] 2 [cx] 3 [bx] 5 [di] 6 [bp] 7 [sp] 17 [flags]
;;  ref usage 	r0={6d,6u} r1={2d,2u} r2={2d,1u} r3={1d,1u} r4={1d} r5={1d,1u} r6={1d,8u} r7={1d,8u} r17={7d,3u} r20={1d,1u} r37={1d} r38={1d} 
;;    total ref usage 56{25d,31u,0e} in 20{20 regular + 0 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 6 3 2 (set (reg/v:SI 3 bx [orig:97 proc_id ] [97])
        (reg:SI 5 di [ proc_id ])) "drivers/acpi/acpi_processor.c":687 82 {*movsi_internal}
     (nil))
(note 3 2 14 2 NOTE_INSN_FUNCTION_BEG)
(note 14 3 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x2af79e210630 nr_duplicate_ids>) [3 nr_duplicate_ids+0 S4 A32])) "drivers/acpi/acpi_processor.c":694 82 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 0 [0]))) "drivers/acpi/acpi_processor.c":694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref 44)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 44)
(note 20 19 22 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 22 20 24 3 (set (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
        (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 81 {*movdi_internal}
     (nil))
(insn 24 22 25 3 (parallel [
            (set (reg:DI 2 cx [106])
                (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 25 24 26 3 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [106])) 81 {*movdi_internal}
     (nil))
(insn 26 25 27 3 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:97 proc_id ] [97])
            (mem/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x2af79e210750 duplicate_processor_ids>) [3 duplicate_processor_ids+0 S4 A32]))) "drivers/acpi/acpi_processor.c":695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 3 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 57)
            (pc))) "drivers/acpi/acpi_processor.c":695 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 57)
(note 28 27 34 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 4 NOTE_INSN_DELETED)
(note 35 34 36 4 NOTE_INSN_DELETED)
(insn 36 35 37 4 (parallel [
            (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 1 [0x1]))) "drivers/acpi/acpi_processor.c":694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 44)
(note 39 38 41 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 5 (parallel [
            (set (reg:DI 0 ax [114])
                (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 5 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [114])) 81 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 6 106 (nil) [2 uses])
(note 45 44 5 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 64 6 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 0 [0])) "drivers/acpi/acpi_processor.c":698 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 64 5 65 6 (set (pc)
        (label_ref 50)) 649 {jump}
     (nil)
 -> 50)
(barrier 65 64 57)
(code_label 57 65 56 7 108 (nil) [1 uses])
(note 56 57 4 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 4 56 50 7 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 1 [0x1])) "drivers/acpi/acpi_processor.c":696 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 50 4 53 8 105 (nil) [1 uses])
(note 53 50 51 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 51 53 52 8 (set (reg/i:QI 0 ax)
        (reg:QI 0 ax [orig:96 <retval> ] [96])) "drivers/acpi/acpi_processor.c":699 84 {*movqi_internal}
     (nil))
(insn 52 51 66 8 (use (reg/i:QI 0 ax)) "drivers/acpi/acpi_processor.c":699 -1
     (nil))
(note 66 52 0 NOTE_INSN_DELETED)


[-- Attachment #6: gcc7-after-reload.txt --]
[-- Type: text/plain, Size: 19210 bytes --]

;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29214, cgraph_uid=3143, symbol_order=3218)


********** Local #1: **********

	   Spilling non-eliminable hard regs: 6
New elimination table:
Can't eliminate 16 to 7 (offset=24, prev_offset=0)
Can eliminate 16 to 6 (offset=16, prev_offset=0)
Can't eliminate 20 to 7 (offset=0, prev_offset=0)
Can eliminate 20 to 6 (offset=-8, prev_offset=0)
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 8:  (0) rBwBz {*call}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=18,losers=2,rld_nregs=2
          alt=1,overall=0,losers=0,rld_nregs=0
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=0,overall=9,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=17,losers=2 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 1 in insn 16:  (0) rm  (1) 0  (2) re {*adddi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 17:  (0) =r  (1) g {*movsi_internal}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 18:  (0) r {*cmpsi_ccno_1}
            alt=2: Bad operand -- refuse
          alt=3,overall=0,losers=0,rld_nregs=0
	 Choosing alt 3 in insn 22:  (0) r  (1) rem {*movdi_internal}
            1 Matching alt: reject+=2
          alt=0,overall=8,losers=1,rld_nregs=1
            1 Matching alt: reject+=2
          alt=1,overall=8,losers=1,rld_nregs=1
            2 Matching alt: reject+=2
            2 Non-pseudo reload: reject+=2
            2 Non input pseudo reload: reject++
            alt=2,overall=11,losers=1 -- refuse
          alt=3,overall=0,losers=0,rld_nregs=0
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=0,overall=11,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=11,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 3 in insn 24:  (0) r  (1) r  (2) le {*adddi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2: Bad operand -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            Cycle danger: overall += LRA_MAX_REJECT
          alt=3,overall=609,losers=1,rld_nregs=1
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=4: Bad operand -- refuse
          alt=5,overall=0,losers=0,rld_nregs=0
	 Choosing alt 5 in insn 25:  (0) m  (1) re {*movdi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=9,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 26:  (0) r  (1) rm {*cmpsi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
          alt=0,overall=18,losers=2,rld_nregs=2
          alt=1,overall=0,losers=0,rld_nregs=0
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=0,overall=9,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=17,losers=2 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 1 in insn 36:  (0) rm  (1) 0  (2) re {*adddi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
	 Choosing alt 0 in insn 37:  (0) rm  (1) re {*cmpsi_1}
          alt=0,overall=0,losers=0,rld_nregs=0
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=0,overall=11,losers=1 -- refuse
            1 Matching alt: reject+=2
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=1,overall=11,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=2,overall=9,losers=1 -- refuse
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            alt=3,overall=9,losers=1 -- refuse
	 Choosing alt 0 in insn 41:  (0) =r  (1) %0  (2) rme {*adddi_1}
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=2: Bad operand -- refuse
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            Cycle danger: overall += LRA_MAX_REJECT
          alt=3,overall=609,losers=1,rld_nregs=1
            0 Non-pseudo reload: reject+=2
            0 Non input pseudo reload: reject++
            alt=4: Bad operand -- refuse
          alt=5,overall=0,losers=0,rld_nregs=0
	 Choosing alt 5 in insn 42:  (0) m  (1) re {*movdi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            Cycle danger: overall += LRA_MAX_REJECT
          alt=0,overall=609,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 5:  (0) q  (1) qn {*movqi_internal}
            1 Non-pseudo reload: reject+=2
            1 Non input pseudo reload: reject++
            Cycle danger: overall += LRA_MAX_REJECT
          alt=0,overall=609,losers=1,rld_nregs=1
          alt=1,overall=0,losers=0,rld_nregs=0
	 Choosing alt 1 in insn 4:  (0) q  (1) qn {*movqi_internal}
	   Spilling non-eliminable hard regs: 6

********** Pseudo live ranges #1: **********

  BB 5
   Insn 42: point = 0, n_alt = 5
   Insn 41: point = 1, n_alt = 0
  BB 8
   Insn 52: point = 4, n_alt = -1
   Insn 51: point = 4, n_alt = -2
  BB 6
   Insn 64: point = 6, n_alt = -1
   Insn 5: point = 6, n_alt = 1
  BB 4
   Insn 38: point = 7, n_alt = -1
   Insn 37: point = 7, n_alt = 0
   Insn 36: point = 8, n_alt = 1
  BB 7
   Insn 4: point = 9, n_alt = 1
  BB 3
   Insn 27: point = 10, n_alt = -1
   Insn 26: point = 10, n_alt = 1
   Insn 25: point = 11, n_alt = 5
   Insn 24: point = 12, n_alt = 3
   Insn 22: point = 13, n_alt = 3
  BB 2
   Insn 19: point = 15, n_alt = -1
   Insn 18: point = 15, n_alt = 0
   Insn 17: point = 15, n_alt = 0
   Insn 16: point = 16, n_alt = 1
   Insn 8: point = 16, n_alt = 0
   Insn 2: point = 16, n_alt = -2
 r90: [10..15] [7..8]
 r91: [10..13] [7..8] [2..3]
 r96: [9..9] [4..6]
 r97: [10..16]
 r106: [11..12]
 r114: [0..1]
Compressing live ranges: from 17 to 11 - 64%
Ranges after the compression:
 r90: [9..10] [6..7]
 r91: [9..10] [6..7] [2..3]
 r96: [8..8] [4..5]
 r97: [9..10]
 r106: [9..10]
 r114: [0..1]

********** Inheritance #1: **********

EBB 2 3 4 5
EBB 6
EBB 7
EBB 8

********** Pseudo live ranges #2: **********

  BB 5
   Insn 42: point = 0, n_alt = 5
   Insn 41: point = 1, n_alt = 0
  BB 8
   Insn 52: point = 4, n_alt = -1
   Insn 51: point = 4, n_alt = -2
  BB 6
   Insn 64: point = 6, n_alt = -1
   Insn 5: point = 6, n_alt = 1
  BB 4
   Insn 38: point = 7, n_alt = -1
   Insn 37: point = 7, n_alt = 0
   Insn 36: point = 8, n_alt = 1
  BB 7
   Insn 4: point = 9, n_alt = 1
  BB 3
   Insn 27: point = 10, n_alt = -1
   Insn 26: point = 10, n_alt = 1
   Insn 25: point = 11, n_alt = 5
   Insn 24: point = 12, n_alt = 3
   Insn 22: point = 13, n_alt = 3
  BB 2
   Insn 19: point = 15, n_alt = -1
   Insn 18: point = 15, n_alt = 0
   Insn 17: point = 15, n_alt = 0
   Insn 16: point = 16, n_alt = 1
   Insn 8: point = 16, n_alt = 0
   Insn 2: point = 16, n_alt = -2
 r90: [10..15] [7..8]
 r91: [10..13] [7..8] [2..3]
 r96: [9..9] [4..6]
 r97: [10..16]
 r106: [11..12]
 r114: [0..1]
Compressing live ranges: from 17 to 11 - 64%
Ranges after the compression:
 r90: [9..10] [6..7]
 r91: [9..10] [6..7] [2..3]
 r96: [8..8] [4..5]
 r97: [9..10]
 r106: [9..10]
 r114: [0..1]

********** Assignment #1: **********


********** Undoing inheritance #1: **********


********** Local #2: **********

	   Spilling non-eliminable hard regs: 6
	   Spilling non-eliminable hard regs: 6
New elimination table:
Can't eliminate 16 to 7 (offset=24, prev_offset=0)
Can eliminate 16 to 6 (offset=16, prev_offset=16)
Can't eliminate 20 to 7 (offset=0, prev_offset=0)
Can eliminate 20 to 6 (offset=-8, prev_offset=-8)
changing reg in insn 17
changing reg in insn 37
changing reg in insn 18
changing reg in insn 22
changing reg in insn 41
changing reg in insn 24
changing reg in insn 4
changing reg in insn 5
changing reg in insn 51
changing reg in insn 2
changing reg in insn 26
changing reg in insn 24
changing reg in insn 25
changing reg in insn 41
changing reg in insn 42


try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns
verify found no changes in insn with uid = 8.
starting the processing of deferred insns
ending the processing of deferred insns
df_analyze called
df_worklist_dataflow_doublequeue: n_basic_blocks 9 n_edges 10 count 9 (    1)
df_worklist_dataflow_doublequeue: n_basic_blocks 9 n_edges 10 count 9 (    1)


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0 [ax] 1 [dx] 2 [cx] 3 [bx] 5 [di] 6 [bp] 7 [sp] 17 [flags]
;;  ref usage 	r0={7d,6u} r1={3d,2u} r2={3d,1u} r3={1d,1u} r4={2d} r5={2d,1u} r6={1d,8u} r7={1d,9u} r8={1d} r9={1d} r10={1d} r11={1d} r12={1d} r13={1d} r14={1d} r15={1d} r17={8d,3u} r18={1d} r19={1d} r20={1d,1u} r21={1d} r22={1d} r23={1d} r24={1d} r25={1d} r26={1d} r27={1d} r28={1d} r29={1d} r30={1d} r31={1d} r32={1d} r33={1d} r34={1d} r35={1d} r36={1d} r37={2d} r38={2d} r39={1d} r40={1d} r45={1d} r46={1d} r47={1d} r48={1d} r49={1d} r50={1d} r51={1d} r52={1d} r53={1d} r54={1d} r55={1d} r56={1d} r57={1d} r58={1d} r59={1d} r60={1d} r61={1d} r62={1d} r63={1d} r64={1d} r65={1d} r66={1d} r67={1d} r68={1d} r69={1d} r70={1d} r71={1d} r72={1d} r73={1d} r74={1d} r75={1d} r76={1d} r77={1d} r78={1d} r79={1d} r80={1d} 
;;    total ref usage 129{97d,32u,0e} in 21{20 regular + 1 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(insn 2 6 3 2 (set (reg/v:SI 3 bx [orig:97 proc_id ] [97])
        (reg:SI 5 di [ proc_id ])) "drivers/acpi/acpi_processor.c":687 82 {*movsi_internal}
     (nil))
(note 3 2 8 2 NOTE_INSN_FUNCTION_BEG)
(call_insn 8 3 14 2 (call (mem:QI (symbol_ref:DI ("stackleak_track_stack") [flags 0x41]  <function_decl 0x2af79bd4a700 stackleak_track_stack>) [0 stackleak_track_stack S1 A8])
        (const_int 0 [0])) 655 {*call}
     (expr_list:REG_CALL_DECL (symbol_ref:DI ("stackleak_track_stack") [flags 0x41]  <function_decl 0x2af79bd4a700 stackleak_track_stack>)
        (expr_list:REG_EH_REGION (const_int 0 [0])
            (nil)))
    (nil))
(note 14 8 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x2af79e210630 nr_duplicate_ids>) [3 nr_duplicate_ids+0 S4 A32])) "drivers/acpi/acpi_processor.c":694 82 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 0 [0]))) "drivers/acpi/acpi_processor.c":694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref 44)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 44)
(note 20 19 22 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 22 20 24 3 (set (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
        (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 81 {*movdi_internal}
     (nil))
(insn 24 22 25 3 (parallel [
            (set (reg:DI 2 cx [106])
                (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 25 24 26 3 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [106])) 81 {*movdi_internal}
     (nil))
(insn 26 25 27 3 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:97 proc_id ] [97])
            (mem/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x2af79e210750 duplicate_processor_ids>) [3 duplicate_processor_ids+0 S4 A32]))) "drivers/acpi/acpi_processor.c":695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 3 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 57)
            (pc))) "drivers/acpi/acpi_processor.c":695 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 57)
(note 28 27 34 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 4 NOTE_INSN_DELETED)
(note 35 34 36 4 NOTE_INSN_DELETED)
(insn 36 35 37 4 (parallel [
            (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 1 [0x1]))) "drivers/acpi/acpi_processor.c":694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 44)
(note 39 38 41 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 5 (parallel [
            (set (reg:DI 0 ax [114])
                (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 5 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [114])) 81 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 6 106 (nil) [2 uses])
(note 45 44 5 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 64 6 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 0 [0])) "drivers/acpi/acpi_processor.c":698 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 64 5 65 6 (set (pc)
        (label_ref 50)) 649 {jump}
     (nil)
 -> 50)
(barrier 65 64 57)
(code_label 57 65 56 7 108 (nil) [1 uses])
(note 56 57 4 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 4 56 50 7 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 1 [0x1])) "drivers/acpi/acpi_processor.c":696 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 50 4 53 8 105 (nil) [1 uses])
(note 53 50 51 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 51 53 52 8 (set (reg/i:QI 0 ax)
        (reg:QI 0 ax [orig:96 <retval> ] [96])) "drivers/acpi/acpi_processor.c":699 84 {*movqi_internal}
     (nil))
(insn 52 51 66 8 (use (reg/i:QI 0 ax)) "drivers/acpi/acpi_processor.c":699 -1
     (nil))
(note 66 52 0 NOTE_INSN_DELETED)


[-- Attachment #7: gcc7-after-pro_and_epilogue.txt --]
[-- Type: text/plain, Size: 11195 bytes --]

;; Function acpi_duplicate_processor_id (acpi_duplicate_processor_id, funcdef_no=3046, decl_uid=29214, cgraph_uid=3143, symbol_order=3218)



try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns
df_analyze called
scanning new insn with uid = 76.
deleting insn with uid = 2.
Attempting shrink-wrapping optimization.
Block 3 needs the prologue.
After wrapping required blocks, PRO is now 3
Avoiding non-duplicatable blocks, PRO is now 3
Bumping back to anticipatable blocks, PRO is now 3
Performing shrink-wrapping.
changing bb of uid 82
  unscanned insn
changing bb of uid 80
  unscanned insn
scanning new insn with uid = 80.
changing bb of uid 81
  unscanned insn
scanning new insn with uid = 81.
Duplicated 6 to 9
changing bb of uid 86
  unscanned insn
changing bb of uid 85
  unscanned insn
scanning new insn with uid = 85.
Duplicated 8 to 10
Redirecting edge 2->6 to 9
verify found no changes in insn with uid = 19.
Edge 2->6 redirected to 9
Redirecting edge 9->8 to 10
Removing jump 81.
deleting insn with uid = 81.
scanning new insn with uid = 88.
Made simple_return with UID 88 in bb 10
changing bb of uid 90
  unscanned insn
Made prologue block 11
changing bb of uid 91
  unscanned insn
scanning new insn with uid = 93.
Redirected edge from 12
scanning new insn with uid = 96.
scanning new insn with uid = 73.
scanning new insn with uid = 74.
scanning new insn with uid = 75.
scanning new insn with uid = 68.
scanning new insn with uid = 69.
scanning new insn with uid = 70.


try_optimize_cfg iteration 1

Forwarding edge 2->3 to 4 failed.
Removing jump 93.
deleting insn with uid = 93.
Deleting fallthru block 3.
deleting block 3
Merging block 11 into block 10...
changing bb of uid 85
  from 11 to 10
changing bb of uid 88
  from 11 to 10
Merged blocks 10 and 11.
Merged 10 and 11 without moving.
deleting insn with uid = 96.
deleting block 12


try_optimize_cfg iteration 2

Deleted label in block 4.


try_optimize_cfg iteration 1

starting the processing of deferred insns
ending the processing of deferred insns


acpi_duplicate_processor_id

Dataflow summary:
;;  invalidated by call 	 0 [ax] 1 [dx] 2 [cx] 4 [si] 5 [di] 8 [] 9 [] 10 [] 11 [] 12 [] 13 [] 14 [] 15 [] 17 [flags] 18 [fpsr] 19 [fpcr] 21 [] 22 [] 23 [] 24 [] 25 [] 26 [] 27 [] 28 [] 29 [] 30 [] 31 [] 32 [] 33 [] 34 [] 35 [] 36 [] 37 [r8] 38 [r9] 39 [r10] 40 [r11] 45 [] 46 [] 47 [] 48 [] 49 [] 50 [] 51 [] 52 [] 53 [] 54 [] 55 [] 56 [] 57 [] 58 [] 59 [] 60 [] 61 [] 62 [] 63 [] 64 [] 65 [] 66 [] 67 [] 68 [] 69 [] 70 [] 71 [] 72 [] 73 [] 74 [] 75 [] 76 [] 77 [] 78 [] 79 [] 80 []
;;  hardware regs used 	 7 [sp]
;;  regular block artificial uses 	 6 [bp] 7 [sp]
;;  eh block artificial uses 	 6 [bp] 7 [sp] 16 [argp] 20 [frame]
;;  entry block defs 	 0 [ax] 1 [dx] 2 [cx] 3 [bx] 4 [si] 5 [di] 6 [bp] 7 [sp] 20 [frame] 37 [r8] 38 [r9]
;;  exit block uses 	 0 [ax] 3 [bx] 6 [bp] 7 [sp] 20 [frame]
;;  regs ever live 	 0 [ax] 1 [dx] 2 [cx] 3 [bx] 5 [di] 6 [bp] 7 [sp] 17 [flags]
;;  ref usage 	r0={6d,6u} r1={2d,2u} r2={2d,1u} r3={3d,3u} r4={1d} r5={1d,1u} r6={3d,10u} r7={5d,14u} r17={6d,3u} r20={1d,1u} r37={1d} r38={1d} 
;;    total ref usage 73{32d,41u,0e} in 28{28 regular + 0 call} insns.
(note 1 0 6 NOTE_INSN_DELETED)
(note 6 1 3 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
(note 3 6 14 2 NOTE_INSN_FUNCTION_BEG)
(note 14 3 15 2 NOTE_INSN_DELETED)
(note 15 14 16 2 NOTE_INSN_DELETED)
(insn 16 15 17 2 (parallel [
            (set (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                (plus:DI (mem/c:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>) [18 __gcov0.acpi_duplicate_processor_id+0 S8 A128])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 17 16 18 2 (set (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
        (mem/c:SI (symbol_ref:DI ("nr_duplicate_ids") [flags 0x2]  <var_decl 0x2af79e210630 nr_duplicate_ids>) [3 nr_duplicate_ids+0 S4 A32])) "drivers/acpi/acpi_processor.c":694 82 {*movsi_internal}
     (nil))
(insn 18 17 19 2 (set (reg:CCNO 17 flags)
        (compare:CCNO (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 0 [0]))) "drivers/acpi/acpi_processor.c":694 3 {*cmpsi_ccno_1}
     (nil))
(jump_insn 19 18 20 2 (set (pc)
        (if_then_else (le (reg:CCNO 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 87)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 87)
(note 20 19 68 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn/f 68 20 69 4 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg/f:DI 6 bp)) "drivers/acpi/acpi_processor.c":687 -1
     (nil))
(insn/f 69 68 70 4 (set (reg/f:DI 6 bp)
        (reg/f:DI 7 sp)) "drivers/acpi/acpi_processor.c":687 -1
     (nil))
(insn/f 70 69 71 4 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0  S8 A8])
        (reg:DI 3 bx)) "drivers/acpi/acpi_processor.c":687 -1
     (nil))
(note 71 70 76 4 NOTE_INSN_PROLOGUE_END)
(insn 76 71 22 4 (set (reg/v:SI 3 bx [orig:97 proc_id ] [97])
        (reg:SI 5 di [ proc_id ])) 82 {*movsi_internal}
     (nil))
(insn 22 76 67 4 (set (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
        (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])) 81 {*movdi_internal}
     (nil))
(insn 67 22 25 4 (set (reg:DI 2 cx [106])
        (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
            (const_int 1 [0x1]))) 214 {*leadi}
     (nil))
(insn 25 67 26 4 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 2 cx [106])) 81 {*movdi_internal}
     (nil))
(insn 26 25 27 4 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg/v:SI 3 bx [orig:97 proc_id ] [97])
            (mem/c:SI (symbol_ref:DI ("duplicate_processor_ids") [flags 0x2]  <var_decl 0x2af79e210750 duplicate_processor_ids>) [3 duplicate_processor_ids+0 S4 A32]))) "drivers/acpi/acpi_processor.c":695 7 {*cmpsi_1}
     (nil))
(jump_insn 27 26 28 4 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 57)
            (pc))) "drivers/acpi/acpi_processor.c":695 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 57)
(note 28 27 34 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(note 34 28 35 5 NOTE_INSN_DELETED)
(note 35 34 36 5 NOTE_INSN_DELETED)
(insn 36 35 37 5 (parallel [
            (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                            (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                (plus:DI (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                                (const_int 8 [0x8]))) [18 __gcov0.acpi_duplicate_processor_id+8 S8 A64])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (nil))
(insn 37 36 38 5 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 1 dx [orig:90 nr_duplicate_ids.1_21 ] [90])
            (const_int 1 [0x1]))) "drivers/acpi/acpi_processor.c":694 7 {*cmpsi_1}
     (nil))
(jump_insn 38 37 39 5 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref:DI 44)
            (pc))) "drivers/acpi/acpi_processor.c":694 617 {*jcc_1}
     (int_list:REG_BR_PROB 750 (nil))
 -> 44)
(note 39 38 41 6 [bb 6] NOTE_INSN_BASIC_BLOCK)
(insn 41 39 42 6 (parallel [
            (set (reg:DI 0 ax [114])
                (plus:DI (reg:DI 0 ax [orig:91 PROF_edge_counter_22 ] [91])
                    (const_int 2 [0x2])))
            (clobber (reg:CC 17 flags))
        ]) 218 {*adddi_1}
     (expr_list:REG_EQUIV (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (nil)))
(insn 42 41 43 6 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI ("__gcov0.acpi_duplicate_processor_id") [flags 0x2]  <var_decl 0x2af79e327990 __gcov0.acpi_duplicate_processor_id>)
                    (const_int 16 [0x10]))) [18 __gcov0.acpi_duplicate_processor_id+16 S8 A128])
        (reg:DI 0 ax [114])) 81 {*movdi_internal}
     (nil))
(barrier 43 42 44)
(code_label 44 43 45 7 106 (nil) [1 uses])
(note 45 44 5 7 [bb 7] NOTE_INSN_BASIC_BLOCK)
(insn 5 45 64 7 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 0 [0])) "drivers/acpi/acpi_processor.c":698 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(jump_insn 64 5 65 7 (set (pc)
        (label_ref 50)) 649 {jump}
     (nil)
 -> 50)
(barrier 65 64 57)
(code_label 57 65 56 8 108 (nil) [1 uses])
(note 56 57 4 8 [bb 8] NOTE_INSN_BASIC_BLOCK)
(insn 4 56 50 8 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 1 [0x1])) "drivers/acpi/acpi_processor.c":696 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 1 [0x1])
        (nil)))
(code_label 50 4 53 9 105 (nil) [1 uses])
(note 53 50 52 9 [bb 9] NOTE_INSN_BASIC_BLOCK)
(insn 52 53 72 9 (use (reg/i:QI 0 ax)) "drivers/acpi/acpi_processor.c":699 -1
     (nil))
(note 72 52 73 9 NOTE_INSN_EPILOGUE_BEG)
(insn/f 73 72 74 9 (set (reg:DI 3 bx)
        (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8])) "drivers/acpi/acpi_processor.c":699 -1
     (expr_list:REG_CFA_RESTORE (reg:DI 3 bx)
        (nil)))
(insn/f 74 73 75 9 (set (reg/f:DI 6 bp)
        (mem:DI (post_inc:DI (reg/f:DI 7 sp)) [0  S8 A8])) "drivers/acpi/acpi_processor.c":699 -1
     (expr_list:REG_CFA_DEF_CFA (plus:DI (reg/f:DI 7 sp)
            (const_int 8 [0x8]))
        (expr_list:REG_CFA_RESTORE (reg/f:DI 6 bp)
            (nil))))
(jump_insn 75 74 98 9 (simple_return) "drivers/acpi/acpi_processor.c":699 -1
     (nil)
 -> simple_return)
(barrier 98 75 66)
(note 66 98 87 NOTE_INSN_DELETED)
(code_label 87 66 82 10 113 (nil) [1 uses])
(note 82 87 80 10 [bb 10] NOTE_INSN_BASIC_BLOCK)
(insn 80 82 85 10 (set (reg:QI 0 ax [orig:96 <retval> ] [96])
        (const_int 0 [0])) "drivers/acpi/acpi_processor.c":698 84 {*movqi_internal}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))
(insn 85 80 88 10 (use (reg/i:QI 0 ax)) "drivers/acpi/acpi_processor.c":699 -1
     (nil))
(jump_insn 88 85 89 10 (simple_return) "drivers/acpi/acpi_processor.c":699 -1
     (nil)
 -> simple_return)
(barrier 89 88 0)


[-- Attachment #8: gcc-passes.txt --]
[-- Type: text/plain, Size: 20714 bytes --]

   *warn_unused_result                                 :  ON
   *diagnose_omp_blocks                                :  OFF
   *diagnose_tm_blocks                                 :  OFF
   tree-omplower                                       :  ON
   tree-lower                                          :  ON
   tree-tmlower                                        :  OFF
   tree-ehopt                                          :  OFF
   tree-eh                                             :  ON
   tree-cfg                                            :  ON
   *warn_function_return                               :  ON
   tree-ompexp                                         :  ON
   tree-printf-return-value1                           :  OFF
   tree-walloca1                                       :  OFF
   *build_cgraph_edges                                 :  ON
   *free_lang_data                                     :  ON
   ipa-visibility                                      :  ON
   ipa-chkp_versioning                                 :  OFF
   ipa-chkp_ecleanup                                   :  OFF
   ipa-build_ssa_passes                                :  ON
      tree-fixup_cfg1                                  :  ON
      tree-ssa                                         :  ON
      *nonnullcmp                                      :  ON
      tree-ubsan                                       :  OFF
      *early_warn_uninitialized                        :  ON
      tree-nothrow                                     :  ON
      *rebuild_cgraph_edges                            :  ON
   ipa-chkp_passes                                     :  OFF
      tree-fixup_cfg2                                  :  ON
      tree-chkp                                        :  OFF
      *rebuild_cgraph_edges                            :  ON
   ipa-opt_local_passes                                :  ON
      tree-fixup_cfg3                                  :  ON
      *rebuild_cgraph_edges                            :  ON
      tree-inline_param1                               :  ON
      tree-einline                                     :  ON
      tree-early_optimizations                         :  ON
         *remove_cgraph_callee_edges                   :  ON
         tree-objsz1                                   :  ON
         tree-ccp1                                     :  ON
         tree-forwprop1                                :  ON
         tree-ethread                                  :  ON
         tree-esra                                     :  ON
         tree-ealias                                   :  ON
         tree-fre1                                     :  ON
         tree-evrp                                     :  ON
         tree-mergephi1                                :  ON
         tree-dse1                                     :  ON
         tree-cddce1                                   :  ON
         tree-eipa_sra                                 :  ON
         tree-tailr1                                   :  ON
         tree-switchconv                               :  ON
         tree-ehcleanup1                               :  OFF
         tree-profile_estimate                         :  ON
         tree-local-pure-const1                        :  ON
         tree-fnsplit                                  :  ON
      tree-release_ssa                                 :  ON
      *rebuild_cgraph_edges                            :  ON
      tree-inline_param2                               :  ON
   ipa-ipa_oacc                                        :  OFF
      ipa-pta1                                         :  OFF
      ipa-ipa_oacc_kernels                             :  ON
         tree-oacc_kernels                             :  OFF
            tree-ch1                                   :  ON
            tree-fre2                                  :  ON
            tree-lim1                                  :  ON
            tree-dom1                                  :  ON
            tree-dce1                                  :  ON
            tree-parloops1                             :  OFF
            tree-ompexpssa1                            :  ON
            *rebuild_cgraph_edges                      :  ON
   ipa-targetclone                                     :  ON
   ipa-chkp_cleanup                                    :  OFF
   ipa-afdo                                            :  OFF
   ipa-free-inline-summary                             :  ON
   ipa-profile                                         :  OFF
      tree-feedback_fnsplit                            :  OFF
   ipa-increase_alignment                              :  OFF
   ipa-tmipa                                           :  OFF
   ipa-emutls                                          :  OFF
   ipa-whole-program                                   :  ON
   ipa-profile_estimate                                :  ON
   ipa-icf                                             :  ON
   ipa-devirt                                          :  ON
   ipa-cp                                              :  ON
   ipa-cdtor                                           :  OFF
   ipa-hsa                                             :  OFF
   ipa-inline                                          :  ON
   ipa-pure-const                                      :  ON
   ipa-static-var                                      :  ON
   ipa-single-use                                      :  ON
   ipa-comdats                                         :  ON
   ipa-materialize-all-clones                          :  ON
   ipa-pta2                                            :  OFF
   ipa-simdclone                                       :  ON
   tree-fixup_cfg4                                     :  ON
   tree-ehdisp                                         :  OFF
   tree-oaccdevlow                                     :  OFF
   tree-ompdevlow                                      :  ON
   tree-omptargetlink                                  :  OFF
   *all_optimizations                                  :  ON
      *remove_cgraph_callee_edges                      :  ON
      *strip_predict_hints                             :  ON
      tree-ccp2                                        :  ON
      tree-post_ipa_warn1                              :  ON
      tree-cunrolli                                    :  ON
      tree-backprop                                    :  ON
      tree-phiprop                                     :  ON
      tree-forwprop2                                   :  ON
      tree-objsz2                                      :  ON
      tree-alias                                       :  ON
      tree-retslot                                     :  ON
      tree-fre3                                        :  ON
      tree-mergephi2                                   :  ON
      tree-thread1                                     :  ON
      tree-vrp1                                        :  ON
      tree-chkpopt                                     :  OFF
      tree-dce2                                        :  ON
      tree-stdarg                                      :  ON
      tree-cdce                                        :  ON
      tree-cselim                                      :  ON
      tree-copyprop1                                   :  ON
      tree-ifcombine                                   :  ON
      tree-mergephi3                                   :  ON
      tree-phiopt1                                     :  ON
      tree-tailr2                                      :  ON
      tree-ch2                                         :  ON
      tree-cplxlower1                                  :  ON
      tree-sra                                         :  ON
      tree-thread2                                     :  ON
      tree-dom2                                        :  ON
      tree-isolate-paths                               :  ON
      tree-phicprop1                                   :  ON
      tree-dse2                                        :  ON
      tree-reassoc1                                    :  ON
      tree-dce3                                        :  ON
      tree-forwprop3                                   :  ON
      tree-phiopt2                                     :  ON
      tree-ccp3                                        :  ON
      tree-sincos                                      :  ON
      tree-bswap                                       :  ON
      tree-laddress                                    :  ON
      tree-lim2                                        :  ON
      tree-crited1                                     :  ON
      tree-walloca2                                    :  OFF
      tree-pre                                         :  ON
      tree-sink                                        :  ON
      tree-sancov1                                     :  ON
      tree-asan1                                       :  OFF
      tree-tsan1                                       :  OFF
      tree-dce4                                        :  ON
      tree-fix_loops                                   :  ON
      tree-loop                                        :  ON
         tree-loopinit                                 :  ON
         tree-unswitch                                 :  OFF
         tree-sccp                                     :  ON
         tree-lsplit                                   :  OFF
         tree-cddce2                                   :  ON
         *record_bounds                                :  ON
         tree-ldist                                    :  OFF
         tree-copyprop2                                :  ON
         tree-graphite0                                :  OFF
            tree-graphite                              :  OFF
            tree-lim3                                  :  ON
            tree-copyprop3                             :  ON
            tree-dce5                                  :  ON
         tree-ivcanon                                  :  ON
         tree-parloops2                                :  OFF
         tree-ompexpssa2                               :  ON
         tree-ch_vect                                  :  OFF
         tree-ifcvt                                    :  OFF
         tree-vect                                     :  OFF
            tree-dce6                                  :  ON
         tree-pcom                                     :  OFF
         tree-cunroll                                  :  ON
         tree-slp1                                     :  OFF
         tree-aprefetch                                :  OFF
         tree-ivopts                                   :  ON
         tree-lim4                                     :  ON
         tree-loopdone                                 :  ON
      tree-no_loop                                     :  OFF
         tree-slp2                                     :  OFF
      tree-simduid1                                    :  OFF
      tree-veclower21                                  :  ON
      tree-recip                                       :  OFF
      tree-printf-return-value2                        :  ON
      tree-reassoc2                                    :  ON
      tree-slsr                                        :  ON
      tree-split-paths                                 :  OFF
      tree-tracer                                      :  OFF
      tree-thread3                                     :  ON
      tree-dom3                                        :  ON
      tree-strlen                                      :  ON
      tree-thread4                                     :  ON
      tree-vrp2                                        :  ON
      tree-phicprop2                                   :  ON
      tree-dse3                                        :  ON
      tree-cddce3                                      :  ON
      tree-forwprop4                                   :  ON
      tree-phiopt3                                     :  ON
      tree-fab1                                        :  ON
      tree-widening_mul                                :  ON
      tree-store-merging                               :  ON
      tree-tailc                                       :  ON
      tree-dce7                                        :  ON
      tree-crited2                                     :  ON
      tree-uninit1                                     :  ON
      tree-uncprop1                                    :  ON
      tree-local-pure-const2                           :  ON
   *all_optimizations_g                                :  OFF
      *remove_cgraph_callee_edges                      :  ON
      *strip_predict_hints                             :  ON
      tree-cplxlower2                                  :  ON
      tree-veclower22                                  :  ON
      tree-ccp4                                        :  ON
      tree-post_ipa_warn2                              :  ON
      tree-objsz3                                      :  ON
      tree-fab2                                        :  ON
      tree-printf-return-value3                        :  ON
      tree-copyprop4                                   :  ON
      tree-dce8                                        :  ON
      tree-sancov2                                     :  ON
      tree-asan2                                       :  OFF
      tree-tsan2                                       :  OFF
      tree-crited3                                     :  ON
      tree-uninit2                                     :  ON
      tree-uncprop2                                    :  ON
      tree-local-pure-const3                           :  ON
   *tminit                                             :  OFF
      tree-tmmark                                      :  ON
      tree-tmmemopt                                    :  OFF
      tree-tmedge                                      :  ON
   tree-simduid2                                       :  OFF
   tree-vtable-verify                                  :  OFF
   tree-lower_vaarg                                    :  ON
   tree-veclower                                       :  ON
   tree-cplxlower0                                     :  ON
   tree-sancov_O0                                      :  OFF
   tree-asan0                                          :  OFF
   tree-tsan0                                          :  OFF
   tree-sanopt                                         :  OFF
   tree-ehcleanup2                                     :  OFF
   tree-resx                                           :  OFF
   tree-nrv                                            :  ON
   tree-stackleak_instrument                           :  ON
   tree-optimized                                      :  ON
   *warn_function_noreturn                             :  OFF
   tree-hsagen                                         :  OFF
   rtl-expand                                          :  ON
   *rest_of_compilation                                :  ON
      rtl-vregs                                        :  ON
      rtl-into_cfglayout                               :  ON
      rtl-jump                                         :  ON
      rtl-subreg1                                      :  ON
      rtl-dfinit                                       :  ON
      rtl-cse1                                         :  ON
      rtl-fwprop1                                      :  ON
      rtl-cprop1                                       :  ON
      rtl-rtl pre                                      :  ON
      rtl-hoist                                        :  OFF
      rtl-cprop2                                       :  ON
      rtl-store_motion                                 :  OFF
      rtl-cse_local                                    :  OFF
      rtl-ce1                                          :  ON
      rtl-reginfo                                      :  ON
      rtl-loop2                                        :  ON
         rtl-loop2_init                                :  ON
         rtl-loop2_invariant                           :  ON
         rtl-loop2_unroll                              :  OFF
         rtl-loop2_doloop                              :  OFF
         rtl-loop2_done                                :  ON
      rtl-web                                          :  OFF
      rtl-cprop3                                       :  ON
      rtl-stv1                                         :  OFF
      rtl-cse2                                         :  ON
      rtl-dse1                                         :  ON
      rtl-fwprop2                                      :  ON
      rtl-auto_inc_dec                                 :  OFF
      rtl-init-regs                                    :  ON
      rtl-ud_dce                                       :  ON
      rtl-combine                                      :  ON
      rtl-stv2                                         :  OFF
      rtl-ce2                                          :  ON
      rtl-bbpart                                       :  OFF
      rtl-outof_cfglayout                              :  ON
      rtl-split1                                       :  ON
      rtl-subreg2                                      :  ON
      rtl-no-opt dfinit                                :  OFF
      *stack_ptr_mod                                   :  ON
      rtl-mode_sw                                      :  ON
      rtl-asmcons                                      :  ON
      rtl-sms                                          :  OFF
      rtl-lr_shrinkage                                 :  OFF
      rtl-sched1                                       :  OFF
      rtl-ira                                          :  ON
      rtl-reload                                       :  ON
      rtl-stackleak_cleanup                            :  ON
      rtl-vzeroupper                                   :  OFF
      *all-postreload                                  :  OFF
         rtl-postreload                                :  OFF
         rtl-gcse2                                     :  OFF
         rtl-split2                                    :  ON
         rtl-ree                                       :  ON
         rtl-cmpelim                                   :  OFF
         rtl-btl1                                      :  OFF
         rtl-pro_and_epilogue                          :  ON
         rtl-dse2                                      :  ON
         rtl-csa                                       :  ON
         rtl-jump2                                     :  ON
         rtl-compgotos                                 :  ON
         rtl-sched_fusion                              :  OFF
         rtl-peephole2                                 :  ON
         rtl-ce3                                       :  ON
         rtl-rnreg                                     :  OFF
         rtl-cprop_hardreg                             :  ON
         rtl-rtl_dce                                   :  ON
         rtl-bbro                                      :  ON
         rtl-btl2                                      :  OFF
         *leaf_regs                                    :  ON
         rtl-split4                                    :  ON
         rtl-sched2                                    :  ON
         *stack_regs                                   :  ON
            rtl-split3                                 :  OFF
            rtl-stack                                  :  ON
      *all-late_compilation                            :  OFF
         rtl-alignments                                :  ON
         rtl-vartrack                                  :  OFF
         *free_cfg                                     :  ON
         rtl-mach                                      :  ON
         rtl-barriers                                  :  ON
         rtl-dbr                                       :  OFF
         rtl-split5                                    :  OFF
         rtl-eh_ranges                                 :  OFF
         rtl-shorten                                   :  ON
         rtl-nothrow                                   :  ON
         rtl-dwarf2                                    :  ON
         rtl-final                                     :  ON
      rtl-dfinish                                      :  ON
   *clean_state                                        :  ON


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Investigating a stack state mismatch in Linux kernel
  2018-11-15 20:51   ` Investigating a stack state mismatch in Linux kernel Alexander Popov
@ 2018-11-20 23:08     ` Alexander Popov
  2018-11-23 14:06       ` Alexander Monakov
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Popov @ 2018-11-20 23:08 UTC (permalink / raw)
  To: Florian Weimer, Richard Sandiford, Segher Boessenkool, Alexander Monakov
  Cc: Kees Cook, Ingo Molnar, Andy Lutomirski, Tycho Andersen,
	Laura Abbott, Mark Rutland, Ard Biesheuvel, Borislav Petkov,
	Thomas Gleixner, H . Peter Anvin, Peter Zijlstra, Emese Revfy,
	Thomas Garnier, Alexei Starovoitov, Masami Hiramatsu,
	David S . Miller, Steven Rostedt, Dave Hansen, Will Deacon,
	Jann Horn, linux-arm-kernel, gcc-bugs, gcc-help, LKML,
	kernel-hardening, gcc

Hello everyone!

At irc.freenode.org/#gcc people told me that I should CC gcc@gcc.gnu.org to get
some attention of gcc developers.

Link to previous discussion:
 https://www.openwall.com/lists/kernel-hardening/2018/11/14/1


On 15.11.2018 23:51, Alexander Popov wrote:
> In the original grsecurity code the stackleak RTL pass was registered just
> before the 'rtl-final' pass. Some time ago Richard Sandiford noted that:
> 
>>>> This might be too late, since it happens e.g. after addresses have
>>>> been calculated for branch ranges, and after machine-specific passes
>>>> (e.g. bundling on ia64).
>>>>
>>>> The stack size is final after reload, so inserting the pass after that
>>>> might be better.
> 
> https://lore.kernel.org/patchwork/patch/879912/
> 
> So what is the best moment when we know the stack frame size and can safely
> delete the CALL insn using delete_insn_and_edges()?

At irc.oftc.net/#gcc Segher (kudos to him!) confirmed that 'final' pass is too
late for this and proposed registering 'stackleak_cleanup' pass before
'machine_reorg' pass. It's the moment when the stack frame size is already final
and function prologues and epilogues are generated. That would also fit
Richard's concerns.

It looks reasonable -- that's what gcc/target.def says about
machine_dependent_reorg() hook, which is called during 'machine_reorg' pass:

"If non-null, this hook performs a target-specific pass over the
instruction stream. The compiler will run it at all optimization levels,
just before the point at which it normally does delayed-branch scheduling.
The exact purpose of the hook varies from target to target.  Some use
it to do transformations that are necessary for correctness, such as
laying out in-function constant pools or avoiding hardware hazards.
Others use it as an opportunity to do some machine-dependent optimizations".


So I would appreciate any comments on the following solution:

diff --git a/scripts/gcc-plugins/stackleak_plugin.c
b/scripts/gcc-plugins/stackleak_plugin.c
index 2f48da9..6f41b32 100644
--- a/scripts/gcc-plugins/stackleak_plugin.c
+++ b/scripts/gcc-plugins/stackleak_plugin.c
@@ -363,10 +363,12 @@ __visible int plugin_init(struct plugin_name_args
*plugin_info,
                                                PASS_POS_INSERT_BEFORE);

        /*
-        * The stackleak_cleanup pass should be executed after the
-        * "reload" pass, when the stack frame size is final.
+        * The stackleak_cleanup pass should be executed before the "mach"
+        * pass, which performs the machine dependent code transformations.
+        * It's the moment when the stack frame size is already final and
+        * function prologues and epilogues are generated.
         */
-       PASS_INFO(stackleak_cleanup, "reload", 1, PASS_POS_INSERT_AFTER);
+       PASS_INFO(stackleak_cleanup, "mach", 1, PASS_POS_INSERT_BEFORE);

        if (!plugin_default_version_check(version, &gcc_version)) {
                error(G_("incompatible gcc/plugin versions"));

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Investigating a stack state mismatch in Linux kernel
  2018-11-20 23:08     ` Alexander Popov
@ 2018-11-23 14:06       ` Alexander Monakov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Monakov @ 2018-11-23 14:06 UTC (permalink / raw)
  To: Alexander Popov
  Cc: Florian Weimer, Richard Sandiford, Segher Boessenkool, Kees Cook,
	Ingo Molnar, Andy Lutomirski, Tycho Andersen, Laura Abbott,
	Mark Rutland, Ard Biesheuvel, Borislav Petkov, Thomas Gleixner,
	H . Peter Anvin, Peter Zijlstra, Emese Revfy, Thomas Garnier,
	Alexei Starovoitov, Masami Hiramatsu, David S . Miller,
	Steven Rostedt, Dave Hansen, Will Deacon, Jann Horn,
	linux-arm-kernel, LKML, kernel-hardening, gcc

Hi,

On Wed, 21 Nov 2018, Alexander Popov wrote:

> Hello everyone!
> 
> At irc.freenode.org/#gcc people told me that I should CC gcc@gcc.gnu.org to get
> some attention of gcc developers.
> 
> Link to previous discussion:
>  https://www.openwall.com/lists/kernel-hardening/2018/11/14/1

So just for information, it isn't a plugin bug. I'll elaborate below, but in
short, objtool was complaining about unreachable code.  To be fair though,
gcc could have made the problem easier to spot.

Now for the details.

The repro uses an unusual (randomized) kernel config, in particular gcov is
enabled and NR_CPUS is 1. Thus we have

static int duplicate_processor_ids[] = {
        [0 ... 1 - 1] = -1,
};

and the compiler deduces that the loop in acpi_duplicate_processor_id does not
iterate:

bool acpi_duplicate_processor_id(int proc_id)
{
        int i;

        for (i = 0; i < nr_duplicate_ids; i++) {
                if (duplicate_processor_ids[i] == proc_id)
                        return true;
        }
        return false;
}

However as gcov is enabled, loop backedge remains, followed by gcov counter
increment and __builtin_unreachable() (on GIMPLE). On RTL, however, the basic
block with the increment ends with a barrier rtx, which is not visible in
assembly and looks just as if control flow falls through to a function exit.
Since the exit in question corresponds to a shrink-wrapped early exit that
does not push/pop registers, objtool complains.

Ultimately this is poor luck, if gcc optimized the code better or terminated
the block that-should-not-be-reached with ud2, it would not arise.

Alexander

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-23 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <b7aad232-76e1-241f-00e2-77783ce30f87@linux.com>
     [not found] ` <875zwyabac.fsf@oldenburg.str.redhat.com>
2018-11-15 20:51   ` Investigating a stack state mismatch in Linux kernel Alexander Popov
2018-11-20 23:08     ` Alexander Popov
2018-11-23 14:06       ` Alexander Monakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).