All of lore.kernel.org
 help / color / mirror / Atom feed
* [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
@ 2020-02-29 14:37 kbuild test robot
  2020-03-05 13:43 ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: kbuild test robot @ 2020-02-29 14:37 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/rcu
head:   bc72cd8dac4be9572f0cae33b096f9c23460e08a
commit: 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f [31/33] x86/int3: Ensure that poke_int3_handler() is not sanitized
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        git checkout 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from arch/x86/include/asm/math_emu.h:5:0,
                    from arch/x86/include/asm/processor.h:13,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:51,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from arch/x86/kernel/alternative.c:4:
   arch/x86/kernel/alternative.c: In function 'poke_int3_handler':
   arch/x86/include/asm/ptrace.h:126:28: error: inlining failed in call to always_inline 'user_mode': function attribute mismatch
    static __always_inline int user_mode(struct pt_regs *regs)
                               ^~~~~~~~~
   arch/x86/kernel/alternative.c:1000:6: note: called from here
     if (user_mode(regs))
         ^~~~~~~~~~~~~~~
>> arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
    struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
                             ^~~~~~~~~~~~
   arch/x86/kernel/alternative.c:1013:7: note: called from here
     desc = try_get_desc(&bp_desc);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/kernel/alternative.c:17:0:
>> include/linux/bsearch.h:8:7: error: inlining failed in call to always_inline '__bsearch': function attribute mismatch
    void *__bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)
          ^~~~~~~~~
   arch/x86/kernel/alternative.c:1026:6: note: called from here
      tp = __bsearch(ip, desc->vec, desc->nr_entries,
      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              sizeof(struct text_poke_loc),
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              patch_cmp);
              ~~~~~~~~~~
   arch/x86/kernel/alternative.c:977:30: error: inlining failed in call to always_inline 'text_poke_addr': function attribute mismatch
    static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
                                 ^~~~~~~~~~~~~~
   arch/x86/kernel/alternative.c:1033:7: note: called from here
      if (text_poke_addr(tp) != ip)
          ^~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/kprobes.h:18:0,
                    from include/linux/kprobes.h:30,
                    from arch/x86/kernel/alternative.c:15:
>> arch/x86/include/asm/text-patching.h:67:28: error: inlining failed in call to always_inline 'text_opcode_size': function attribute mismatch
    static __always_inline int text_opcode_size(u8 opcode)
                               ^~~~~~~~~~~~~~~~
   arch/x86/kernel/alternative.c:1037:6: note: called from here
     len = text_opcode_size(tp->opcode);
     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/kprobes.h:18:0,
                    from include/linux/kprobes.h:30,
                    from arch/x86/kernel/alternative.c:15:
>> arch/x86/include/asm/text-patching.h:144:6: error: inlining failed in call to always_inline 'int3_emulate_call': function attribute mismatch
    void int3_emulate_call(struct pt_regs *regs, unsigned long func)
         ^~~~~~~~~~~~~~~~~
   arch/x86/kernel/alternative.c:1049:3: note: called from here
      int3_emulate_call(regs, (long)ip + tp->rel32);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from arch/x86/include/asm/kprobes.h:18:0,
                    from include/linux/kprobes.h:30,
                    from arch/x86/kernel/alternative.c:15:
>> arch/x86/include/asm/text-patching.h:122:6: error: inlining failed in call to always_inline 'int3_emulate_jmp': function attribute mismatch
    void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
         ^~~~~~~~~~~~~~~~
   arch/x86/kernel/alternative.c:1054:3: note: called from here
      int3_emulate_jmp(regs, (long)ip + tp->rel32);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kernel/alternative.c:971:29: error: inlining failed in call to always_inline 'put_desc': function attribute mismatch
    static __always_inline void put_desc(struct bp_patching_desc *desc)
                                ^~~~~~~~
   arch/x86/kernel/alternative.c:1064:2: note: called from here
     put_desc(desc);
     ^~~~~~~~~~~~~~
--
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
   arch/x86/kernel/traps.c: In function 'do_int3':
>> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
    static __always_inline int preempt_count(void)
                               ^~~~~~~~~~~~~
   In file included from arch/x86/include/asm/current.h:5:0,
                    from include/linux/sched.h:12,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
   include/linux/preempt.h:102:20: note: called from here
    #define in_nmi()  (preempt_count() & NMI_MASK)
                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(in_nmi() == NMI_MASK);   \
      ^~~~~~
   include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
      BUG_ON(in_nmi() == NMI_MASK);   \
             ^~~~~~
   arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/hardirq.h:7:0,
                    from include/linux/interrupt.h:11,
                    from arch/x86/kernel/traps.c:16:
>> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
    static __always_inline void ftrace_nmi_enter(void)
                                ^~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86/kernel/traps.c:16:
   include/linux/hardirq.h:85:3: note: called from here
      ftrace_nmi_enter();    \
      ^~~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/sched.h:12:0,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
     current->lockdep_recursion += LOCKDEP_OFF; \
     ^~~~~~~
   include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
      lockdep_off();     \
      ^~~~~~~~~~~
   arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
     current->hardirq_context++;  \
     ^~~~~~~
   include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
      trace_hardirq_enter();    \
      ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
   arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
    static __always_inline void __preempt_count_add(int val)
                                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86/kernel/traps.c:16:
   include/linux/hardirq.h:87:3: note: called from here
      __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
>> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
    static __always_inline int preempt_count(void)
                               ^~~~~~~~~~~~~
   In file included from arch/x86/include/asm/current.h:5:0,
                    from include/linux/sched.h:12,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
   include/linux/preempt.h:102:20: note: called from here
    #define in_nmi()  (preempt_count() & NMI_MASK)
                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(!in_nmi());    \
      ^~~~~~
   include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
      BUG_ON(!in_nmi());    \
              ^~~~~~
   arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/sched.h:12:0,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
     current->hardirq_context--;  \
     ^~~~~~~
   include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
      trace_hardirq_exit();    \
      ^~~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
     current->lockdep_recursion -= LOCKDEP_OFF; \
     ^~~~~~~
   include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
      lockdep_on();     \
      ^~~~~~~~~~
   arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/hardirq.h:7:0,
                    from include/linux/interrupt.h:11,
                    from arch/x86/kernel/traps.c:16:
>> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
    static __always_inline void ftrace_nmi_exit(void)
                                ^~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86/kernel/traps.c:16:
   include/linux/hardirq.h:98:3: note: called from here
      ftrace_nmi_exit();    \
      ^~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86/kernel/traps.c:15:
   arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
    static __always_inline void __preempt_count_sub(int val)
                                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86/kernel/traps.c:16:
   include/linux/hardirq.h:97:3: note: called from here
      __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
--
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
   arch/x86//kernel/traps.c: In function 'do_int3':
>> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
    static __always_inline int preempt_count(void)
                               ^~~~~~~~~~~~~
   In file included from arch/x86/include/asm/current.h:5:0,
                    from include/linux/sched.h:12,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
   include/linux/preempt.h:102:20: note: called from here
    #define in_nmi()  (preempt_count() & NMI_MASK)
                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(in_nmi() == NMI_MASK);   \
      ^~~~~~
   include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
      BUG_ON(in_nmi() == NMI_MASK);   \
             ^~~~~~
   arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/hardirq.h:7:0,
                    from include/linux/interrupt.h:11,
                    from arch/x86//kernel/traps.c:16:
>> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
    static __always_inline void ftrace_nmi_enter(void)
                                ^~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86//kernel/traps.c:16:
   include/linux/hardirq.h:85:3: note: called from here
      ftrace_nmi_enter();    \
      ^~~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/sched.h:12:0,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
     current->lockdep_recursion += LOCKDEP_OFF; \
     ^~~~~~~
   include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
      lockdep_off();     \
      ^~~~~~~~~~~
   arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
     current->hardirq_context++;  \
     ^~~~~~~
   include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
      trace_hardirq_enter();    \
      ^~~~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
   arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
    static __always_inline void __preempt_count_add(int val)
                                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86//kernel/traps.c:16:
   include/linux/hardirq.h:87:3: note: called from here
      __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
     nmi_enter();
     ^~~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
>> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
    static __always_inline int preempt_count(void)
                               ^~~~~~~~~~~~~
   In file included from arch/x86/include/asm/current.h:5:0,
                    from include/linux/sched.h:12,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
   include/linux/preempt.h:102:20: note: called from here
    #define in_nmi()  (preempt_count() & NMI_MASK)
                       ^~~~~~~~~~~~~~~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
      BUG_ON(!in_nmi());    \
      ^~~~~~
   include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
      BUG_ON(!in_nmi());    \
              ^~~~~~
   arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/sched.h:12:0,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
     current->hardirq_context--;  \
     ^~~~~~~
   include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
      trace_hardirq_exit();    \
      ^~~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
>> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
    static __always_inline struct task_struct *get_current(void)
                                               ^~~~~~~~~~~
   arch/x86/include/asm/current.h:18:17: note: called from here
    #define current get_current()
                    ^~~~~~~~~~~~~
   include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
     current->lockdep_recursion -= LOCKDEP_OFF; \
     ^~~~~~~
   include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
      lockdep_on();     \
      ^~~~~~~~~~
   arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/hardirq.h:7:0,
                    from include/linux/interrupt.h:11,
                    from arch/x86//kernel/traps.c:16:
>> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
    static __always_inline void ftrace_nmi_exit(void)
                                ^~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86//kernel/traps.c:16:
   include/linux/hardirq.h:98:3: note: called from here
      ftrace_nmi_exit();    \
      ^~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
   In file included from include/linux/preempt.h:78:0,
                    from include/linux/rcupdate.h:27,
                    from include/linux/rculist.h:11,
                    from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/context_tracking.h:5,
                    from arch/x86//kernel/traps.c:15:
   arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
    static __always_inline void __preempt_count_sub(int val)
                                ^~~~~~~~~~~~~~~~~~~
   In file included from include/linux/interrupt.h:11:0,
                    from arch/x86//kernel/traps.c:16:
   include/linux/hardirq.h:97:3: note: called from here
      __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
     nmi_exit();
     ^~~~~~~~
..

vim +/try_get_desc +961 arch/x86/kernel/alternative.c

1f676247f36a4b Peter Zijlstra             2019-12-11  959  
809106a6157bce Thomas Gleixner            2020-01-21  960  static __always_inline
809106a6157bce Thomas Gleixner            2020-01-21 @961  struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
1f676247f36a4b Peter Zijlstra             2019-12-11  962  {
a9d380bd4091e7 Peter Zijlstra             2020-01-24  963  	struct bp_patching_desc *desc = READ_ONCE_NOCHECK(*descp); /* rcu_dereference */
1f676247f36a4b Peter Zijlstra             2019-12-11  964  
a9d380bd4091e7 Peter Zijlstra             2020-01-24  965  	if (!desc || !arch_atomic_inc_not_zero(&desc->refs))
1f676247f36a4b Peter Zijlstra             2019-12-11  966  		return NULL;
1f676247f36a4b Peter Zijlstra             2019-12-11  967  
1f676247f36a4b Peter Zijlstra             2019-12-11  968  	return desc;
1f676247f36a4b Peter Zijlstra             2019-12-11  969  }
1f676247f36a4b Peter Zijlstra             2019-12-11  970  
809106a6157bce Thomas Gleixner            2020-01-21 @971  static __always_inline void put_desc(struct bp_patching_desc *desc)
1f676247f36a4b Peter Zijlstra             2019-12-11  972  {
1f676247f36a4b Peter Zijlstra             2019-12-11  973  	smp_mb__before_atomic();
a9d380bd4091e7 Peter Zijlstra             2020-01-24  974  	arch_atomic_dec(&desc->refs);
1f676247f36a4b Peter Zijlstra             2019-12-11  975  }
c0213b0ac03cf6 Daniel Bristot de Oliveira 2019-06-12  976  

:::::: The code at line 961 was first introduced by commit
:::::: 809106a6157bce0fff76bfc7864e7ce34080abe0 x86/int3: Ensure that poke_int3_handler() is not traced

:::::: TO: Thomas Gleixner <tglx@linutronix.de>
:::::: CC: Peter Zijlstra <peterz@infradead.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 68355 bytes --]

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-02-29 14:37 [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch kbuild test robot
@ 2020-03-05 13:43 ` Peter Zijlstra
  2020-03-05 15:00   ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Zijlstra @ 2020-03-05 13:43 UTC (permalink / raw)
  To: kbuild-all

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


Dmitry; I keep getting this from the 0day robot, but I can't reproduce
locally (with GCC-8 and up).

The alternative to having that __no_sanitize is moving the code that
wants this into it's own .c file and using the Makefile hacks to kills
everything dead, but that's cumbersome too.

The thing is, Thomas is reworking the x86 entry code and we're moving a
whole bunch of that into C, those early entry functions also all want
this.

Do you have any clues as to what gcc-7 is on about and what, if
anything, we can do about this?

On Sat, Feb 29, 2020 at 10:37:26PM +0800, kbuild test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/rcu
> head:   bc72cd8dac4be9572f0cae33b096f9c23460e08a
> commit: 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f [31/33] x86/int3: Ensure that poke_int3_handler() is not sanitized
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
> reproduce:
>         git checkout 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from arch/x86/include/asm/math_emu.h:5:0,
>                     from arch/x86/include/asm/processor.h:13,
>                     from arch/x86/include/asm/cpufeature.h:5,
>                     from arch/x86/include/asm/thread_info.h:53,
>                     from include/linux/thread_info.h:38,
>                     from arch/x86/include/asm/preempt.h:7,
>                     from include/linux/preempt.h:78,
>                     from include/linux/spinlock.h:51,
>                     from include/linux/seqlock.h:36,
>                     from include/linux/time.h:6,
>                     from include/linux/stat.h:19,
>                     from include/linux/module.h:13,
>                     from arch/x86/kernel/alternative.c:4:
>    arch/x86/kernel/alternative.c: In function 'poke_int3_handler':
>    arch/x86/include/asm/ptrace.h:126:28: error: inlining failed in call to always_inline 'user_mode': function attribute mismatch
>     static __always_inline int user_mode(struct pt_regs *regs)
>                                ^~~~~~~~~
>    arch/x86/kernel/alternative.c:1000:6: note: called from here
>      if (user_mode(regs))
>          ^~~~~~~~~~~~~~~
> >> arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
>     struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
>                              ^~~~~~~~~~~~
>    arch/x86/kernel/alternative.c:1013:7: note: called from here
>      desc = try_get_desc(&bp_desc);
>      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from arch/x86/kernel/alternative.c:17:0:
> >> include/linux/bsearch.h:8:7: error: inlining failed in call to always_inline '__bsearch': function attribute mismatch
>     void *__bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)
>           ^~~~~~~~~
>    arch/x86/kernel/alternative.c:1026:6: note: called from here
>       tp = __bsearch(ip, desc->vec, desc->nr_entries,
>       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>               sizeof(struct text_poke_loc),
>               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>               patch_cmp);
>               ~~~~~~~~~~
>    arch/x86/kernel/alternative.c:977:30: error: inlining failed in call to always_inline 'text_poke_addr': function attribute mismatch
>     static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
>                                  ^~~~~~~~~~~~~~
>    arch/x86/kernel/alternative.c:1033:7: note: called from here
>       if (text_poke_addr(tp) != ip)
>           ^~~~~~~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/kprobes.h:18:0,
>                     from include/linux/kprobes.h:30,
>                     from arch/x86/kernel/alternative.c:15:
> >> arch/x86/include/asm/text-patching.h:67:28: error: inlining failed in call to always_inline 'text_opcode_size': function attribute mismatch
>     static __always_inline int text_opcode_size(u8 opcode)
>                                ^~~~~~~~~~~~~~~~
>    arch/x86/kernel/alternative.c:1037:6: note: called from here
>      len = text_opcode_size(tp->opcode);
>      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/kprobes.h:18:0,
>                     from include/linux/kprobes.h:30,
>                     from arch/x86/kernel/alternative.c:15:
> >> arch/x86/include/asm/text-patching.h:144:6: error: inlining failed in call to always_inline 'int3_emulate_call': function attribute mismatch
>     void int3_emulate_call(struct pt_regs *regs, unsigned long func)
>          ^~~~~~~~~~~~~~~~~
>    arch/x86/kernel/alternative.c:1049:3: note: called from here
>       int3_emulate_call(regs, (long)ip + tp->rel32);
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/kprobes.h:18:0,
>                     from include/linux/kprobes.h:30,
>                     from arch/x86/kernel/alternative.c:15:
> >> arch/x86/include/asm/text-patching.h:122:6: error: inlining failed in call to always_inline 'int3_emulate_jmp': function attribute mismatch
>     void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
>          ^~~~~~~~~~~~~~~~
>    arch/x86/kernel/alternative.c:1054:3: note: called from here
>       int3_emulate_jmp(regs, (long)ip + tp->rel32);
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> arch/x86/kernel/alternative.c:971:29: error: inlining failed in call to always_inline 'put_desc': function attribute mismatch
>     static __always_inline void put_desc(struct bp_patching_desc *desc)
>                                 ^~~~~~~~
>    arch/x86/kernel/alternative.c:1064:2: note: called from here
>      put_desc(desc);
>      ^~~~~~~~~~~~~~
> --
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
>    arch/x86/kernel/traps.c: In function 'do_int3':
> >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
>     static __always_inline int preempt_count(void)
>                                ^~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/current.h:5:0,
>                     from include/linux/sched.h:12,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
>    include/linux/preempt.h:102:20: note: called from here
>     #define in_nmi()  (preempt_count() & NMI_MASK)
>                        ^~~~~~~~~~~~~~~
>    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
>     # define unlikely(x) __builtin_expect(!!(x), 0)
>                                              ^
>    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
>       BUG_ON(in_nmi() == NMI_MASK);   \
>       ^~~~~~
>    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
>       BUG_ON(in_nmi() == NMI_MASK);   \
>              ^~~~~~
>    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/hardirq.h:7:0,
>                     from include/linux/interrupt.h:11,
>                     from arch/x86/kernel/traps.c:16:
> >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
>     static __always_inline void ftrace_nmi_enter(void)
>                                 ^~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86/kernel/traps.c:16:
>    include/linux/hardirq.h:85:3: note: called from here
>       ftrace_nmi_enter();    \
>       ^~~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/sched.h:12:0,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
>      current->lockdep_recursion += LOCKDEP_OFF; \
>      ^~~~~~~
>    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
>       lockdep_off();     \
>       ^~~~~~~~~~~
>    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
>      current->hardirq_context++;  \
>      ^~~~~~~
>    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
>       trace_hardirq_enter();    \
>       ^~~~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
>    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
>     static __always_inline void __preempt_count_add(int val)
>                                 ^~~~~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86/kernel/traps.c:16:
>    include/linux/hardirq.h:87:3: note: called from here
>       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
> >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
>     static __always_inline int preempt_count(void)
>                                ^~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/current.h:5:0,
>                     from include/linux/sched.h:12,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
>    include/linux/preempt.h:102:20: note: called from here
>     #define in_nmi()  (preempt_count() & NMI_MASK)
>                        ^~~~~~~~~~~~~~~
>    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
>     # define unlikely(x) __builtin_expect(!!(x), 0)
>                                              ^
>    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
>       BUG_ON(!in_nmi());    \
>       ^~~~~~
>    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
>       BUG_ON(!in_nmi());    \
>               ^~~~~~
>    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/sched.h:12:0,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
>      current->hardirq_context--;  \
>      ^~~~~~~
>    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
>       trace_hardirq_exit();    \
>       ^~~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
>      current->lockdep_recursion -= LOCKDEP_OFF; \
>      ^~~~~~~
>    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
>       lockdep_on();     \
>       ^~~~~~~~~~
>    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/hardirq.h:7:0,
>                     from include/linux/interrupt.h:11,
>                     from arch/x86/kernel/traps.c:16:
> >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
>     static __always_inline void ftrace_nmi_exit(void)
>                                 ^~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86/kernel/traps.c:16:
>    include/linux/hardirq.h:98:3: note: called from here
>       ftrace_nmi_exit();    \
>       ^~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86/kernel/traps.c:15:
>    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
>     static __always_inline void __preempt_count_sub(int val)
>                                 ^~~~~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86/kernel/traps.c:16:
>    include/linux/hardirq.h:97:3: note: called from here
>       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
> --
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
>    arch/x86//kernel/traps.c: In function 'do_int3':
> >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
>     static __always_inline int preempt_count(void)
>                                ^~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/current.h:5:0,
>                     from include/linux/sched.h:12,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
>    include/linux/preempt.h:102:20: note: called from here
>     #define in_nmi()  (preempt_count() & NMI_MASK)
>                        ^~~~~~~~~~~~~~~
>    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
>     # define unlikely(x) __builtin_expect(!!(x), 0)
>                                              ^
>    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
>       BUG_ON(in_nmi() == NMI_MASK);   \
>       ^~~~~~
>    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
>       BUG_ON(in_nmi() == NMI_MASK);   \
>              ^~~~~~
>    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/hardirq.h:7:0,
>                     from include/linux/interrupt.h:11,
>                     from arch/x86//kernel/traps.c:16:
> >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
>     static __always_inline void ftrace_nmi_enter(void)
>                                 ^~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86//kernel/traps.c:16:
>    include/linux/hardirq.h:85:3: note: called from here
>       ftrace_nmi_enter();    \
>       ^~~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/sched.h:12:0,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
>      current->lockdep_recursion += LOCKDEP_OFF; \
>      ^~~~~~~
>    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
>       lockdep_off();     \
>       ^~~~~~~~~~~
>    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
>      current->hardirq_context++;  \
>      ^~~~~~~
>    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
>       trace_hardirq_enter();    \
>       ^~~~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
>    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
>     static __always_inline void __preempt_count_add(int val)
>                                 ^~~~~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86//kernel/traps.c:16:
>    include/linux/hardirq.h:87:3: note: called from here
>       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
>      nmi_enter();
>      ^~~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
> >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
>     static __always_inline int preempt_count(void)
>                                ^~~~~~~~~~~~~
>    In file included from arch/x86/include/asm/current.h:5:0,
>                     from include/linux/sched.h:12,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
>    include/linux/preempt.h:102:20: note: called from here
>     #define in_nmi()  (preempt_count() & NMI_MASK)
>                        ^~~~~~~~~~~~~~~
>    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
>     # define unlikely(x) __builtin_expect(!!(x), 0)
>                                              ^
>    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
>       BUG_ON(!in_nmi());    \
>       ^~~~~~
>    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
>       BUG_ON(!in_nmi());    \
>               ^~~~~~
>    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/sched.h:12:0,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
>      current->hardirq_context--;  \
>      ^~~~~~~
>    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
>       trace_hardirq_exit();    \
>       ^~~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
> >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
>     static __always_inline struct task_struct *get_current(void)
>                                                ^~~~~~~~~~~
>    arch/x86/include/asm/current.h:18:17: note: called from here
>     #define current get_current()
>                     ^~~~~~~~~~~~~
>    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
>      current->lockdep_recursion -= LOCKDEP_OFF; \
>      ^~~~~~~
>    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
>       lockdep_on();     \
>       ^~~~~~~~~~
>    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/hardirq.h:7:0,
>                     from include/linux/interrupt.h:11,
>                     from arch/x86//kernel/traps.c:16:
> >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
>     static __always_inline void ftrace_nmi_exit(void)
>                                 ^~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86//kernel/traps.c:16:
>    include/linux/hardirq.h:98:3: note: called from here
>       ftrace_nmi_exit();    \
>       ^~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
>    In file included from include/linux/preempt.h:78:0,
>                     from include/linux/rcupdate.h:27,
>                     from include/linux/rculist.h:11,
>                     from include/linux/pid.h:5,
>                     from include/linux/sched.h:14,
>                     from include/linux/context_tracking.h:5,
>                     from arch/x86//kernel/traps.c:15:
>    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
>     static __always_inline void __preempt_count_sub(int val)
>                                 ^~~~~~~~~~~~~~~~~~~
>    In file included from include/linux/interrupt.h:11:0,
>                     from arch/x86//kernel/traps.c:16:
>    include/linux/hardirq.h:97:3: note: called from here
>       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
>      nmi_exit();
>      ^~~~~~~~
> ..
> 
> vim +/try_get_desc +961 arch/x86/kernel/alternative.c
> 
> 1f676247f36a4b Peter Zijlstra             2019-12-11  959  
> 809106a6157bce Thomas Gleixner            2020-01-21  960  static __always_inline
> 809106a6157bce Thomas Gleixner            2020-01-21 @961  struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> 1f676247f36a4b Peter Zijlstra             2019-12-11  962  {
> a9d380bd4091e7 Peter Zijlstra             2020-01-24  963  	struct bp_patching_desc *desc = READ_ONCE_NOCHECK(*descp); /* rcu_dereference */
> 1f676247f36a4b Peter Zijlstra             2019-12-11  964  
> a9d380bd4091e7 Peter Zijlstra             2020-01-24  965  	if (!desc || !arch_atomic_inc_not_zero(&desc->refs))
> 1f676247f36a4b Peter Zijlstra             2019-12-11  966  		return NULL;
> 1f676247f36a4b Peter Zijlstra             2019-12-11  967  
> 1f676247f36a4b Peter Zijlstra             2019-12-11  968  	return desc;
> 1f676247f36a4b Peter Zijlstra             2019-12-11  969  }
> 1f676247f36a4b Peter Zijlstra             2019-12-11  970  
> 809106a6157bce Thomas Gleixner            2020-01-21 @971  static __always_inline void put_desc(struct bp_patching_desc *desc)
> 1f676247f36a4b Peter Zijlstra             2019-12-11  972  {
> 1f676247f36a4b Peter Zijlstra             2019-12-11  973  	smp_mb__before_atomic();
> a9d380bd4091e7 Peter Zijlstra             2020-01-24  974  	arch_atomic_dec(&desc->refs);
> 1f676247f36a4b Peter Zijlstra             2019-12-11  975  }
> c0213b0ac03cf6 Daniel Bristot de Oliveira 2019-06-12  976  
> 
> :::::: The code at line 961 was first introduced by commit
> :::::: 809106a6157bce0fff76bfc7864e7ce34080abe0 x86/int3: Ensure that poke_int3_handler() is not traced
> 
> :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> :::::: CC: Peter Zijlstra <peterz@infradead.org>
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 13:43 ` Peter Zijlstra
@ 2020-03-05 15:00   ` Dmitry Vyukov
  2020-03-05 15:10     ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-05 15:00 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 2:43 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
>
> Dmitry; I keep getting this from the 0day robot, but I can't reproduce
> locally (with GCC-8 and up).
>
> The alternative to having that __no_sanitize is moving the code that
> wants this into it's own .c file and using the Makefile hacks to kills
> everything dead, but that's cumbersome too.
>
> The thing is, Thomas is reworking the x86 entry code and we're moving a
> whole bunch of that into C, those early entry functions also all want
> this.
>
> Do you have any clues as to what gcc-7 is on about and what, if
> anything, we can do about this?

Hi Peter,

I can reproduce this on:

commit 38b47f3cd6f56a0616b0503bbd58c9ab8b3511e9 (HEAD)
   x86/int3: Ensure that poke_int3_handler() is not sanitized

with a small diff:

--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -194,14 +194,14 @@ static inline int trace_rcu_enter(void)
 {
        int state = !rcu_is_watching();
        if (state)
-               rcu_irq_enter_irqsave();
+               rcu_irq_enter_irqsafe();
        return state;
 }

 static inline void trace_rcu_exit(int state)
 {
        if (state)
-               rcu_irq_exit_irqsave();
+               rcu_irq_exit_irqsafe();
 }

by running:

make CC=gcc-7 arch/x86/kernel/alternative.o
make CC=gcc-8 arch/x86/kernel/alternative.o


Question: do we need/want to not kasan-instrument user_mode?





> On Sat, Feb 29, 2020 at 10:37:26PM +0800, kbuild test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/rcu
> > head:   bc72cd8dac4be9572f0cae33b096f9c23460e08a
> > commit: 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f [31/33] x86/int3: Ensure that poke_int3_handler() is not sanitized
> > config: x86_64-allmodconfig (attached as .config)
> > compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
> > reproduce:
> >         git checkout 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f
> >         # save the attached .config to linux build tree
> >         make ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All errors (new ones prefixed by >>):
> >
> >    In file included from arch/x86/include/asm/math_emu.h:5:0,
> >                     from arch/x86/include/asm/processor.h:13,
> >                     from arch/x86/include/asm/cpufeature.h:5,
> >                     from arch/x86/include/asm/thread_info.h:53,
> >                     from include/linux/thread_info.h:38,
> >                     from arch/x86/include/asm/preempt.h:7,
> >                     from include/linux/preempt.h:78,
> >                     from include/linux/spinlock.h:51,
> >                     from include/linux/seqlock.h:36,
> >                     from include/linux/time.h:6,
> >                     from include/linux/stat.h:19,
> >                     from include/linux/module.h:13,
> >                     from arch/x86/kernel/alternative.c:4:
> >    arch/x86/kernel/alternative.c: In function 'poke_int3_handler':
> >    arch/x86/include/asm/ptrace.h:126:28: error: inlining failed in call to always_inline 'user_mode': function attribute mismatch
> >     static __always_inline int user_mode(struct pt_regs *regs)
> >                                ^~~~~~~~~
> >    arch/x86/kernel/alternative.c:1000:6: note: called from here
> >      if (user_mode(regs))
> >          ^~~~~~~~~~~~~~~
> > >> arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
> >     struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> >                              ^~~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:1013:7: note: called from here
> >      desc = try_get_desc(&bp_desc);
> >      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from arch/x86/kernel/alternative.c:17:0:
> > >> include/linux/bsearch.h:8:7: error: inlining failed in call to always_inline '__bsearch': function attribute mismatch
> >     void *__bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)
> >           ^~~~~~~~~
> >    arch/x86/kernel/alternative.c:1026:6: note: called from here
> >       tp = __bsearch(ip, desc->vec, desc->nr_entries,
> >       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >               sizeof(struct text_poke_loc),
> >               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >               patch_cmp);
> >               ~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:977:30: error: inlining failed in call to always_inline 'text_poke_addr': function attribute mismatch
> >     static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
> >                                  ^~~~~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:1033:7: note: called from here
> >       if (text_poke_addr(tp) != ip)
> >           ^~~~~~~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> >                     from include/linux/kprobes.h:30,
> >                     from arch/x86/kernel/alternative.c:15:
> > >> arch/x86/include/asm/text-patching.h:67:28: error: inlining failed in call to always_inline 'text_opcode_size': function attribute mismatch
> >     static __always_inline int text_opcode_size(u8 opcode)
> >                                ^~~~~~~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:1037:6: note: called from here
> >      len = text_opcode_size(tp->opcode);
> >      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> >                     from include/linux/kprobes.h:30,
> >                     from arch/x86/kernel/alternative.c:15:
> > >> arch/x86/include/asm/text-patching.h:144:6: error: inlining failed in call to always_inline 'int3_emulate_call': function attribute mismatch
> >     void int3_emulate_call(struct pt_regs *regs, unsigned long func)
> >          ^~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:1049:3: note: called from here
> >       int3_emulate_call(regs, (long)ip + tp->rel32);
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> >                     from include/linux/kprobes.h:30,
> >                     from arch/x86/kernel/alternative.c:15:
> > >> arch/x86/include/asm/text-patching.h:122:6: error: inlining failed in call to always_inline 'int3_emulate_jmp': function attribute mismatch
> >     void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
> >          ^~~~~~~~~~~~~~~~
> >    arch/x86/kernel/alternative.c:1054:3: note: called from here
> >       int3_emulate_jmp(regs, (long)ip + tp->rel32);
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >> arch/x86/kernel/alternative.c:971:29: error: inlining failed in call to always_inline 'put_desc': function attribute mismatch
> >     static __always_inline void put_desc(struct bp_patching_desc *desc)
> >                                 ^~~~~~~~
> >    arch/x86/kernel/alternative.c:1064:2: note: called from here
> >      put_desc(desc);
> >      ^~~~~~~~~~~~~~
> > --
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> >    arch/x86/kernel/traps.c: In function 'do_int3':
> > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> >     static __always_inline int preempt_count(void)
> >                                ^~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/current.h:5:0,
> >                     from include/linux/sched.h:12,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> >    include/linux/preempt.h:102:20: note: called from here
> >     #define in_nmi()  (preempt_count() & NMI_MASK)
> >                        ^~~~~~~~~~~~~~~
> >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> >     # define unlikely(x) __builtin_expect(!!(x), 0)
> >                                              ^
> >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> >       BUG_ON(in_nmi() == NMI_MASK);   \
> >       ^~~~~~
> >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> >       BUG_ON(in_nmi() == NMI_MASK);   \
> >              ^~~~~~
> >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/hardirq.h:7:0,
> >                     from include/linux/interrupt.h:11,
> >                     from arch/x86/kernel/traps.c:16:
> > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> >     static __always_inline void ftrace_nmi_enter(void)
> >                                 ^~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86/kernel/traps.c:16:
> >    include/linux/hardirq.h:85:3: note: called from here
> >       ftrace_nmi_enter();    \
> >       ^~~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/sched.h:12:0,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> >      current->lockdep_recursion += LOCKDEP_OFF; \
> >      ^~~~~~~
> >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> >       lockdep_off();     \
> >       ^~~~~~~~~~~
> >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> >      current->hardirq_context++;  \
> >      ^~~~~~~
> >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> >       trace_hardirq_enter();    \
> >       ^~~~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> >     static __always_inline void __preempt_count_add(int val)
> >                                 ^~~~~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86/kernel/traps.c:16:
> >    include/linux/hardirq.h:87:3: note: called from here
> >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> >     static __always_inline int preempt_count(void)
> >                                ^~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/current.h:5:0,
> >                     from include/linux/sched.h:12,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> >    include/linux/preempt.h:102:20: note: called from here
> >     #define in_nmi()  (preempt_count() & NMI_MASK)
> >                        ^~~~~~~~~~~~~~~
> >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> >     # define unlikely(x) __builtin_expect(!!(x), 0)
> >                                              ^
> >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> >       BUG_ON(!in_nmi());    \
> >       ^~~~~~
> >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> >       BUG_ON(!in_nmi());    \
> >               ^~~~~~
> >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/sched.h:12:0,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> >      current->hardirq_context--;  \
> >      ^~~~~~~
> >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> >       trace_hardirq_exit();    \
> >       ^~~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> >      current->lockdep_recursion -= LOCKDEP_OFF; \
> >      ^~~~~~~
> >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> >       lockdep_on();     \
> >       ^~~~~~~~~~
> >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/hardirq.h:7:0,
> >                     from include/linux/interrupt.h:11,
> >                     from arch/x86/kernel/traps.c:16:
> > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> >     static __always_inline void ftrace_nmi_exit(void)
> >                                 ^~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86/kernel/traps.c:16:
> >    include/linux/hardirq.h:98:3: note: called from here
> >       ftrace_nmi_exit();    \
> >       ^~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86/kernel/traps.c:15:
> >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> >     static __always_inline void __preempt_count_sub(int val)
> >                                 ^~~~~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86/kernel/traps.c:16:
> >    include/linux/hardirq.h:97:3: note: called from here
> >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> > --
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> >    arch/x86//kernel/traps.c: In function 'do_int3':
> > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> >     static __always_inline int preempt_count(void)
> >                                ^~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/current.h:5:0,
> >                     from include/linux/sched.h:12,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> >    include/linux/preempt.h:102:20: note: called from here
> >     #define in_nmi()  (preempt_count() & NMI_MASK)
> >                        ^~~~~~~~~~~~~~~
> >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> >     # define unlikely(x) __builtin_expect(!!(x), 0)
> >                                              ^
> >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> >       BUG_ON(in_nmi() == NMI_MASK);   \
> >       ^~~~~~
> >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> >       BUG_ON(in_nmi() == NMI_MASK);   \
> >              ^~~~~~
> >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/hardirq.h:7:0,
> >                     from include/linux/interrupt.h:11,
> >                     from arch/x86//kernel/traps.c:16:
> > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> >     static __always_inline void ftrace_nmi_enter(void)
> >                                 ^~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86//kernel/traps.c:16:
> >    include/linux/hardirq.h:85:3: note: called from here
> >       ftrace_nmi_enter();    \
> >       ^~~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/sched.h:12:0,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> >      current->lockdep_recursion += LOCKDEP_OFF; \
> >      ^~~~~~~
> >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> >       lockdep_off();     \
> >       ^~~~~~~~~~~
> >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> >      current->hardirq_context++;  \
> >      ^~~~~~~
> >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> >       trace_hardirq_enter();    \
> >       ^~~~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> >     static __always_inline void __preempt_count_add(int val)
> >                                 ^~~~~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86//kernel/traps.c:16:
> >    include/linux/hardirq.h:87:3: note: called from here
> >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> >      nmi_enter();
> >      ^~~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> >     static __always_inline int preempt_count(void)
> >                                ^~~~~~~~~~~~~
> >    In file included from arch/x86/include/asm/current.h:5:0,
> >                     from include/linux/sched.h:12,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> >    include/linux/preempt.h:102:20: note: called from here
> >     #define in_nmi()  (preempt_count() & NMI_MASK)
> >                        ^~~~~~~~~~~~~~~
> >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> >     # define unlikely(x) __builtin_expect(!!(x), 0)
> >                                              ^
> >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> >       BUG_ON(!in_nmi());    \
> >       ^~~~~~
> >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> >       BUG_ON(!in_nmi());    \
> >               ^~~~~~
> >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/sched.h:12:0,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> >      current->hardirq_context--;  \
> >      ^~~~~~~
> >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> >       trace_hardirq_exit();    \
> >       ^~~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> >     static __always_inline struct task_struct *get_current(void)
> >                                                ^~~~~~~~~~~
> >    arch/x86/include/asm/current.h:18:17: note: called from here
> >     #define current get_current()
> >                     ^~~~~~~~~~~~~
> >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> >      current->lockdep_recursion -= LOCKDEP_OFF; \
> >      ^~~~~~~
> >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> >       lockdep_on();     \
> >       ^~~~~~~~~~
> >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/hardirq.h:7:0,
> >                     from include/linux/interrupt.h:11,
> >                     from arch/x86//kernel/traps.c:16:
> > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> >     static __always_inline void ftrace_nmi_exit(void)
> >                                 ^~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86//kernel/traps.c:16:
> >    include/linux/hardirq.h:98:3: note: called from here
> >       ftrace_nmi_exit();    \
> >       ^~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> >    In file included from include/linux/preempt.h:78:0,
> >                     from include/linux/rcupdate.h:27,
> >                     from include/linux/rculist.h:11,
> >                     from include/linux/pid.h:5,
> >                     from include/linux/sched.h:14,
> >                     from include/linux/context_tracking.h:5,
> >                     from arch/x86//kernel/traps.c:15:
> >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> >     static __always_inline void __preempt_count_sub(int val)
> >                                 ^~~~~~~~~~~~~~~~~~~
> >    In file included from include/linux/interrupt.h:11:0,
> >                     from arch/x86//kernel/traps.c:16:
> >    include/linux/hardirq.h:97:3: note: called from here
> >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> >      nmi_exit();
> >      ^~~~~~~~
> > ..
> >
> > vim +/try_get_desc +961 arch/x86/kernel/alternative.c
> >
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  959
> > 809106a6157bce Thomas Gleixner            2020-01-21  960  static __always_inline
> > 809106a6157bce Thomas Gleixner            2020-01-21 @961  struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  962  {
> > a9d380bd4091e7 Peter Zijlstra             2020-01-24  963     struct bp_patching_desc *desc = READ_ONCE_NOCHECK(*descp); /* rcu_dereference */
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  964
> > a9d380bd4091e7 Peter Zijlstra             2020-01-24  965     if (!desc || !arch_atomic_inc_not_zero(&desc->refs))
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  966             return NULL;
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  967
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  968     return desc;
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  969  }
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  970
> > 809106a6157bce Thomas Gleixner            2020-01-21 @971  static __always_inline void put_desc(struct bp_patching_desc *desc)
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  972  {
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  973     smp_mb__before_atomic();
> > a9d380bd4091e7 Peter Zijlstra             2020-01-24  974     arch_atomic_dec(&desc->refs);
> > 1f676247f36a4b Peter Zijlstra             2019-12-11  975  }
> > c0213b0ac03cf6 Daniel Bristot de Oliveira 2019-06-12  976
> >
> > :::::: The code at line 961 was first introduced by commit
> > :::::: 809106a6157bce0fff76bfc7864e7ce34080abe0 x86/int3: Ensure that poke_int3_handler() is not traced
> >
> > :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> > :::::: CC: Peter Zijlstra <peterz@infradead.org>
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
>

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 15:00   ` Dmitry Vyukov
@ 2020-03-05 15:10     ` Dmitry Vyukov
  2020-03-05 15:23       ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-05 15:10 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 4:00 PM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Thu, Mar 5, 2020 at 2:43 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> >
> > Dmitry; I keep getting this from the 0day robot, but I can't reproduce
> > locally (with GCC-8 and up).
> >
> > The alternative to having that __no_sanitize is moving the code that
> > wants this into it's own .c file and using the Makefile hacks to kills
> > everything dead, but that's cumbersome too.
> >
> > The thing is, Thomas is reworking the x86 entry code and we're moving a
> > whole bunch of that into C, those early entry functions also all want
> > this.
> >
> > Do you have any clues as to what gcc-7 is on about and what, if
> > anything, we can do about this?

What we are asking it to do is impossible to satisfy. For now I am
puzzled as to why gcc-8 does not produce the same warning. I think it
should. So far I can't find any recent relevant changes in gcc code.

> Hi Peter,
>
> I can reproduce this on:
>
> commit 38b47f3cd6f56a0616b0503bbd58c9ab8b3511e9 (HEAD)
>    x86/int3: Ensure that poke_int3_handler() is not sanitized
>
> with a small diff:
>
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -194,14 +194,14 @@ static inline int trace_rcu_enter(void)
>  {
>         int state = !rcu_is_watching();
>         if (state)
> -               rcu_irq_enter_irqsave();
> +               rcu_irq_enter_irqsafe();
>         return state;
>  }
>
>  static inline void trace_rcu_exit(int state)
>  {
>         if (state)
> -               rcu_irq_exit_irqsave();
> +               rcu_irq_exit_irqsafe();
>  }
>
> by running:
>
> make CC=gcc-7 arch/x86/kernel/alternative.o
> make CC=gcc-8 arch/x86/kernel/alternative.o
>
>
> Question: do we need/want to not kasan-instrument user_mode?
>
>
>
>
>
> > On Sat, Feb 29, 2020 at 10:37:26PM +0800, kbuild test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/rcu
> > > head:   bc72cd8dac4be9572f0cae33b096f9c23460e08a
> > > commit: 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f [31/33] x86/int3: Ensure that poke_int3_handler() is not sanitized
> > > config: x86_64-allmodconfig (attached as .config)
> > > compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
> > > reproduce:
> > >         git checkout 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f
> > >         # save the attached .config to linux build tree
> > >         make ARCH=x86_64
> > >
> > > If you fix the issue, kindly add following tag
> > > Reported-by: kbuild test robot <lkp@intel.com>
> > >
> > > All errors (new ones prefixed by >>):
> > >
> > >    In file included from arch/x86/include/asm/math_emu.h:5:0,
> > >                     from arch/x86/include/asm/processor.h:13,
> > >                     from arch/x86/include/asm/cpufeature.h:5,
> > >                     from arch/x86/include/asm/thread_info.h:53,
> > >                     from include/linux/thread_info.h:38,
> > >                     from arch/x86/include/asm/preempt.h:7,
> > >                     from include/linux/preempt.h:78,
> > >                     from include/linux/spinlock.h:51,
> > >                     from include/linux/seqlock.h:36,
> > >                     from include/linux/time.h:6,
> > >                     from include/linux/stat.h:19,
> > >                     from include/linux/module.h:13,
> > >                     from arch/x86/kernel/alternative.c:4:
> > >    arch/x86/kernel/alternative.c: In function 'poke_int3_handler':
> > >    arch/x86/include/asm/ptrace.h:126:28: error: inlining failed in call to always_inline 'user_mode': function attribute mismatch
> > >     static __always_inline int user_mode(struct pt_regs *regs)
> > >                                ^~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1000:6: note: called from here
> > >      if (user_mode(regs))
> > >          ^~~~~~~~~~~~~~~
> > > >> arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
> > >     struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> > >                              ^~~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1013:7: note: called from here
> > >      desc = try_get_desc(&bp_desc);
> > >      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> > >    In file included from arch/x86/kernel/alternative.c:17:0:
> > > >> include/linux/bsearch.h:8:7: error: inlining failed in call to always_inline '__bsearch': function attribute mismatch
> > >     void *__bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)
> > >           ^~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1026:6: note: called from here
> > >       tp = __bsearch(ip, desc->vec, desc->nr_entries,
> > >       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >               sizeof(struct text_poke_loc),
> > >               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >               patch_cmp);
> > >               ~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:977:30: error: inlining failed in call to always_inline 'text_poke_addr': function attribute mismatch
> > >     static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
> > >                                  ^~~~~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1033:7: note: called from here
> > >       if (text_poke_addr(tp) != ip)
> > >           ^~~~~~~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > >                     from include/linux/kprobes.h:30,
> > >                     from arch/x86/kernel/alternative.c:15:
> > > >> arch/x86/include/asm/text-patching.h:67:28: error: inlining failed in call to always_inline 'text_opcode_size': function attribute mismatch
> > >     static __always_inline int text_opcode_size(u8 opcode)
> > >                                ^~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1037:6: note: called from here
> > >      len = text_opcode_size(tp->opcode);
> > >      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > >                     from include/linux/kprobes.h:30,
> > >                     from arch/x86/kernel/alternative.c:15:
> > > >> arch/x86/include/asm/text-patching.h:144:6: error: inlining failed in call to always_inline 'int3_emulate_call': function attribute mismatch
> > >     void int3_emulate_call(struct pt_regs *regs, unsigned long func)
> > >          ^~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1049:3: note: called from here
> > >       int3_emulate_call(regs, (long)ip + tp->rel32);
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > >                     from include/linux/kprobes.h:30,
> > >                     from arch/x86/kernel/alternative.c:15:
> > > >> arch/x86/include/asm/text-patching.h:122:6: error: inlining failed in call to always_inline 'int3_emulate_jmp': function attribute mismatch
> > >     void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
> > >          ^~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/alternative.c:1054:3: note: called from here
> > >       int3_emulate_jmp(regs, (long)ip + tp->rel32);
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >> arch/x86/kernel/alternative.c:971:29: error: inlining failed in call to always_inline 'put_desc': function attribute mismatch
> > >     static __always_inline void put_desc(struct bp_patching_desc *desc)
> > >                                 ^~~~~~~~
> > >    arch/x86/kernel/alternative.c:1064:2: note: called from here
> > >      put_desc(desc);
> > >      ^~~~~~~~~~~~~~
> > > --
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > >    arch/x86/kernel/traps.c: In function 'do_int3':
> > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > >     static __always_inline int preempt_count(void)
> > >                                ^~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/current.h:5:0,
> > >                     from include/linux/sched.h:12,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > >    include/linux/preempt.h:102:20: note: called from here
> > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > >                        ^~~~~~~~~~~~~~~
> > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > >                                              ^
> > >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > >       ^~~~~~
> > >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > >              ^~~~~~
> > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/hardirq.h:7:0,
> > >                     from include/linux/interrupt.h:11,
> > >                     from arch/x86/kernel/traps.c:16:
> > > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> > >     static __always_inline void ftrace_nmi_enter(void)
> > >                                 ^~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86/kernel/traps.c:16:
> > >    include/linux/hardirq.h:85:3: note: called from here
> > >       ftrace_nmi_enter();    \
> > >       ^~~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/sched.h:12:0,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> > >      current->lockdep_recursion += LOCKDEP_OFF; \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> > >       lockdep_off();     \
> > >       ^~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> > >      current->hardirq_context++;  \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> > >       trace_hardirq_enter();    \
> > >       ^~~~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> > >     static __always_inline void __preempt_count_add(int val)
> > >                                 ^~~~~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86/kernel/traps.c:16:
> > >    include/linux/hardirq.h:87:3: note: called from here
> > >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > >     static __always_inline int preempt_count(void)
> > >                                ^~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/current.h:5:0,
> > >                     from include/linux/sched.h:12,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > >    include/linux/preempt.h:102:20: note: called from here
> > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > >                        ^~~~~~~~~~~~~~~
> > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > >                                              ^
> > >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> > >       BUG_ON(!in_nmi());    \
> > >       ^~~~~~
> > >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> > >       BUG_ON(!in_nmi());    \
> > >               ^~~~~~
> > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/sched.h:12:0,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> > >      current->hardirq_context--;  \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> > >       trace_hardirq_exit();    \
> > >       ^~~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> > >      current->lockdep_recursion -= LOCKDEP_OFF; \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> > >       lockdep_on();     \
> > >       ^~~~~~~~~~
> > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/hardirq.h:7:0,
> > >                     from include/linux/interrupt.h:11,
> > >                     from arch/x86/kernel/traps.c:16:
> > > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> > >     static __always_inline void ftrace_nmi_exit(void)
> > >                                 ^~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86/kernel/traps.c:16:
> > >    include/linux/hardirq.h:98:3: note: called from here
> > >       ftrace_nmi_exit();    \
> > >       ^~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86/kernel/traps.c:15:
> > >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> > >     static __always_inline void __preempt_count_sub(int val)
> > >                                 ^~~~~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86/kernel/traps.c:16:
> > >    include/linux/hardirq.h:97:3: note: called from here
> > >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > > --
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > >    arch/x86//kernel/traps.c: In function 'do_int3':
> > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > >     static __always_inline int preempt_count(void)
> > >                                ^~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/current.h:5:0,
> > >                     from include/linux/sched.h:12,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > >    include/linux/preempt.h:102:20: note: called from here
> > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > >                        ^~~~~~~~~~~~~~~
> > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > >                                              ^
> > >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > >       ^~~~~~
> > >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > >              ^~~~~~
> > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/hardirq.h:7:0,
> > >                     from include/linux/interrupt.h:11,
> > >                     from arch/x86//kernel/traps.c:16:
> > > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> > >     static __always_inline void ftrace_nmi_enter(void)
> > >                                 ^~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86//kernel/traps.c:16:
> > >    include/linux/hardirq.h:85:3: note: called from here
> > >       ftrace_nmi_enter();    \
> > >       ^~~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/sched.h:12:0,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> > >      current->lockdep_recursion += LOCKDEP_OFF; \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> > >       lockdep_off();     \
> > >       ^~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> > >      current->hardirq_context++;  \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> > >       trace_hardirq_enter();    \
> > >       ^~~~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> > >     static __always_inline void __preempt_count_add(int val)
> > >                                 ^~~~~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86//kernel/traps.c:16:
> > >    include/linux/hardirq.h:87:3: note: called from here
> > >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > >      nmi_enter();
> > >      ^~~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > >     static __always_inline int preempt_count(void)
> > >                                ^~~~~~~~~~~~~
> > >    In file included from arch/x86/include/asm/current.h:5:0,
> > >                     from include/linux/sched.h:12,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > >    include/linux/preempt.h:102:20: note: called from here
> > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > >                        ^~~~~~~~~~~~~~~
> > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > >                                              ^
> > >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> > >       BUG_ON(!in_nmi());    \
> > >       ^~~~~~
> > >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> > >       BUG_ON(!in_nmi());    \
> > >               ^~~~~~
> > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/sched.h:12:0,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> > >      current->hardirq_context--;  \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> > >       trace_hardirq_exit();    \
> > >       ^~~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > >     static __always_inline struct task_struct *get_current(void)
> > >                                                ^~~~~~~~~~~
> > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > >     #define current get_current()
> > >                     ^~~~~~~~~~~~~
> > >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> > >      current->lockdep_recursion -= LOCKDEP_OFF; \
> > >      ^~~~~~~
> > >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> > >       lockdep_on();     \
> > >       ^~~~~~~~~~
> > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/hardirq.h:7:0,
> > >                     from include/linux/interrupt.h:11,
> > >                     from arch/x86//kernel/traps.c:16:
> > > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> > >     static __always_inline void ftrace_nmi_exit(void)
> > >                                 ^~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86//kernel/traps.c:16:
> > >    include/linux/hardirq.h:98:3: note: called from here
> > >       ftrace_nmi_exit();    \
> > >       ^~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > >    In file included from include/linux/preempt.h:78:0,
> > >                     from include/linux/rcupdate.h:27,
> > >                     from include/linux/rculist.h:11,
> > >                     from include/linux/pid.h:5,
> > >                     from include/linux/sched.h:14,
> > >                     from include/linux/context_tracking.h:5,
> > >                     from arch/x86//kernel/traps.c:15:
> > >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> > >     static __always_inline void __preempt_count_sub(int val)
> > >                                 ^~~~~~~~~~~~~~~~~~~
> > >    In file included from include/linux/interrupt.h:11:0,
> > >                     from arch/x86//kernel/traps.c:16:
> > >    include/linux/hardirq.h:97:3: note: called from here
> > >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > >      nmi_exit();
> > >      ^~~~~~~~
> > > ..
> > >
> > > vim +/try_get_desc +961 arch/x86/kernel/alternative.c
> > >
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  959
> > > 809106a6157bce Thomas Gleixner            2020-01-21  960  static __always_inline
> > > 809106a6157bce Thomas Gleixner            2020-01-21 @961  struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  962  {
> > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  963     struct bp_patching_desc *desc = READ_ONCE_NOCHECK(*descp); /* rcu_dereference */
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  964
> > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  965     if (!desc || !arch_atomic_inc_not_zero(&desc->refs))
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  966             return NULL;
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  967
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  968     return desc;
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  969  }
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  970
> > > 809106a6157bce Thomas Gleixner            2020-01-21 @971  static __always_inline void put_desc(struct bp_patching_desc *desc)
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  972  {
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  973     smp_mb__before_atomic();
> > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  974     arch_atomic_dec(&desc->refs);
> > > 1f676247f36a4b Peter Zijlstra             2019-12-11  975  }
> > > c0213b0ac03cf6 Daniel Bristot de Oliveira 2019-06-12  976
> > >
> > > :::::: The code at line 961 was first introduced by commit
> > > :::::: 809106a6157bce0fff76bfc7864e7ce34080abe0 x86/int3: Ensure that poke_int3_handler() is not traced
> > >
> > > :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> > > :::::: CC: Peter Zijlstra <peterz@infradead.org>
> > >
> > > ---
> > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> >
> >

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 15:10     ` Dmitry Vyukov
@ 2020-03-05 15:23       ` Dmitry Vyukov
  2020-03-05 15:55         ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-05 15:23 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 4:10 PM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Thu, Mar 5, 2020 at 4:00 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> >
> > On Thu, Mar 5, 2020 at 2:43 PM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > >
> > > Dmitry; I keep getting this from the 0day robot, but I can't reproduce
> > > locally (with GCC-8 and up).
> > >
> > > The alternative to having that __no_sanitize is moving the code that
> > > wants this into it's own .c file and using the Makefile hacks to kills
> > > everything dead, but that's cumbersome too.
> > >
> > > The thing is, Thomas is reworking the x86 entry code and we're moving a
> > > whole bunch of that into C, those early entry functions also all want
> > > this.
> > >
> > > Do you have any clues as to what gcc-7 is on about and what, if
> > > anything, we can do about this?
>
> What we are asking it to do is impossible to satisfy. For now I am
> puzzled as to why gcc-8 does not produce the same warning. I think it
> should. So far I can't find any recent relevant changes in gcc code.


I've tried with manually built gcc in an attempt to try to understand
what has changed between gcc 7 and 8.
I've tried on 8793c0dee2d1282ef76228acfd3c34569ad2a190, it's not the
latest commit, but it's gcc version 9.0.0 20190115
and it produces the same errors about inlining.
So I think that distro-provided gcc-8/9 are just buggy.

Compilers just don't allow this: asking to inline sanitized function
into a non-sanitized function. But I don't know the ptrace/alternative
code good enough to suggest the right alternative (don't call
user_mode, copy user_mode, or something else).

Maybe we could replace no_sanitize with calls to
kasan_disable_current/kasan_enable_current around the section of code
where you don't want to see kasan reports.


> > Hi Peter,
> >
> > I can reproduce this on:
> >
> > commit 38b47f3cd6f56a0616b0503bbd58c9ab8b3511e9 (HEAD)
> >    x86/int3: Ensure that poke_int3_handler() is not sanitized
> >
> > with a small diff:
> >
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -194,14 +194,14 @@ static inline int trace_rcu_enter(void)
> >  {
> >         int state = !rcu_is_watching();
> >         if (state)
> > -               rcu_irq_enter_irqsave();
> > +               rcu_irq_enter_irqsafe();
> >         return state;
> >  }
> >
> >  static inline void trace_rcu_exit(int state)
> >  {
> >         if (state)
> > -               rcu_irq_exit_irqsave();
> > +               rcu_irq_exit_irqsafe();
> >  }
> >
> > by running:
> >
> > make CC=gcc-7 arch/x86/kernel/alternative.o
> > make CC=gcc-8 arch/x86/kernel/alternative.o
> >
> >
> > Question: do we need/want to not kasan-instrument user_mode?
> >
> >
> >
> >
> >
> > > On Sat, Feb 29, 2020 at 10:37:26PM +0800, kbuild test robot wrote:
> > > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git core/rcu
> > > > head:   bc72cd8dac4be9572f0cae33b096f9c23460e08a
> > > > commit: 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f [31/33] x86/int3: Ensure that poke_int3_handler() is not sanitized
> > > > config: x86_64-allmodconfig (attached as .config)
> > > > compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
> > > > reproduce:
> > > >         git checkout 2834aaec9e68691ed8d74bdfd3bbea47b6b3972f
> > > >         # save the attached .config to linux build tree
> > > >         make ARCH=x86_64
> > > >
> > > > If you fix the issue, kindly add following tag
> > > > Reported-by: kbuild test robot <lkp@intel.com>
> > > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > >    In file included from arch/x86/include/asm/math_emu.h:5:0,
> > > >                     from arch/x86/include/asm/processor.h:13,
> > > >                     from arch/x86/include/asm/cpufeature.h:5,
> > > >                     from arch/x86/include/asm/thread_info.h:53,
> > > >                     from include/linux/thread_info.h:38,
> > > >                     from arch/x86/include/asm/preempt.h:7,
> > > >                     from include/linux/preempt.h:78,
> > > >                     from include/linux/spinlock.h:51,
> > > >                     from include/linux/seqlock.h:36,
> > > >                     from include/linux/time.h:6,
> > > >                     from include/linux/stat.h:19,
> > > >                     from include/linux/module.h:13,
> > > >                     from arch/x86/kernel/alternative.c:4:
> > > >    arch/x86/kernel/alternative.c: In function 'poke_int3_handler':
> > > >    arch/x86/include/asm/ptrace.h:126:28: error: inlining failed in call to always_inline 'user_mode': function attribute mismatch
> > > >     static __always_inline int user_mode(struct pt_regs *regs)
> > > >                                ^~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1000:6: note: called from here
> > > >      if (user_mode(regs))
> > > >          ^~~~~~~~~~~~~~~
> > > > >> arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
> > > >     struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> > > >                              ^~~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1013:7: note: called from here
> > > >      desc = try_get_desc(&bp_desc);
> > > >      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> > > >    In file included from arch/x86/kernel/alternative.c:17:0:
> > > > >> include/linux/bsearch.h:8:7: error: inlining failed in call to always_inline '__bsearch': function attribute mismatch
> > > >     void *__bsearch(const void *key, const void *base, size_t num, size_t size, cmp_func_t cmp)
> > > >           ^~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1026:6: note: called from here
> > > >       tp = __bsearch(ip, desc->vec, desc->nr_entries,
> > > >       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >               sizeof(struct text_poke_loc),
> > > >               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >               patch_cmp);
> > > >               ~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:977:30: error: inlining failed in call to always_inline 'text_poke_addr': function attribute mismatch
> > > >     static __always_inline void *text_poke_addr(struct text_poke_loc *tp)
> > > >                                  ^~~~~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1033:7: note: called from here
> > > >       if (text_poke_addr(tp) != ip)
> > > >           ^~~~~~~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > > >                     from include/linux/kprobes.h:30,
> > > >                     from arch/x86/kernel/alternative.c:15:
> > > > >> arch/x86/include/asm/text-patching.h:67:28: error: inlining failed in call to always_inline 'text_opcode_size': function attribute mismatch
> > > >     static __always_inline int text_opcode_size(u8 opcode)
> > > >                                ^~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1037:6: note: called from here
> > > >      len = text_opcode_size(tp->opcode);
> > > >      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > > >                     from include/linux/kprobes.h:30,
> > > >                     from arch/x86/kernel/alternative.c:15:
> > > > >> arch/x86/include/asm/text-patching.h:144:6: error: inlining failed in call to always_inline 'int3_emulate_call': function attribute mismatch
> > > >     void int3_emulate_call(struct pt_regs *regs, unsigned long func)
> > > >          ^~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1049:3: note: called from here
> > > >       int3_emulate_call(regs, (long)ip + tp->rel32);
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/kprobes.h:18:0,
> > > >                     from include/linux/kprobes.h:30,
> > > >                     from arch/x86/kernel/alternative.c:15:
> > > > >> arch/x86/include/asm/text-patching.h:122:6: error: inlining failed in call to always_inline 'int3_emulate_jmp': function attribute mismatch
> > > >     void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
> > > >          ^~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1054:3: note: called from here
> > > >       int3_emulate_jmp(regs, (long)ip + tp->rel32);
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > >> arch/x86/kernel/alternative.c:971:29: error: inlining failed in call to always_inline 'put_desc': function attribute mismatch
> > > >     static __always_inline void put_desc(struct bp_patching_desc *desc)
> > > >                                 ^~~~~~~~
> > > >    arch/x86/kernel/alternative.c:1064:2: note: called from here
> > > >      put_desc(desc);
> > > >      ^~~~~~~~~~~~~~
> > > > --
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > >    arch/x86/kernel/traps.c: In function 'do_int3':
> > > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > > >     static __always_inline int preempt_count(void)
> > > >                                ^~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/current.h:5:0,
> > > >                     from include/linux/sched.h:12,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > >    include/linux/preempt.h:102:20: note: called from here
> > > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > > >                        ^~~~~~~~~~~~~~~
> > > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > > >                                              ^
> > > >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> > > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > > >       ^~~~~~
> > > >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> > > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > > >              ^~~~~~
> > > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/hardirq.h:7:0,
> > > >                     from include/linux/interrupt.h:11,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> > > >     static __always_inline void ftrace_nmi_enter(void)
> > > >                                 ^~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > >    include/linux/hardirq.h:85:3: note: called from here
> > > >       ftrace_nmi_enter();    \
> > > >       ^~~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/sched.h:12:0,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> > > >      current->lockdep_recursion += LOCKDEP_OFF; \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> > > >       lockdep_off();     \
> > > >       ^~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> > > >      current->hardirq_context++;  \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> > > >       trace_hardirq_enter();    \
> > > >       ^~~~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> > > >     static __always_inline void __preempt_count_add(int val)
> > > >                                 ^~~~~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > >    include/linux/hardirq.h:87:3: note: called from here
> > > >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > > >     static __always_inline int preempt_count(void)
> > > >                                ^~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/current.h:5:0,
> > > >                     from include/linux/sched.h:12,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > >    include/linux/preempt.h:102:20: note: called from here
> > > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > > >                        ^~~~~~~~~~~~~~~
> > > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > > >                                              ^
> > > >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> > > >       BUG_ON(!in_nmi());    \
> > > >       ^~~~~~
> > > >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> > > >       BUG_ON(!in_nmi());    \
> > > >               ^~~~~~
> > > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/sched.h:12:0,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> > > >      current->hardirq_context--;  \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> > > >       trace_hardirq_exit();    \
> > > >       ^~~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> > > >      current->lockdep_recursion -= LOCKDEP_OFF; \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> > > >       lockdep_on();     \
> > > >       ^~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/hardirq.h:7:0,
> > > >                     from include/linux/interrupt.h:11,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> > > >     static __always_inline void ftrace_nmi_exit(void)
> > > >                                 ^~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > >    include/linux/hardirq.h:98:3: note: called from here
> > > >       ftrace_nmi_exit();    \
> > > >       ^~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86/kernel/traps.c:15:
> > > >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> > > >     static __always_inline void __preempt_count_sub(int val)
> > > >                                 ^~~~~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86/kernel/traps.c:16:
> > > >    include/linux/hardirq.h:97:3: note: called from here
> > > >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    arch/x86/kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > > --
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > >    arch/x86//kernel/traps.c: In function 'do_int3':
> > > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > > >     static __always_inline int preempt_count(void)
> > > >                                ^~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/current.h:5:0,
> > > >                     from include/linux/sched.h:12,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > >    include/linux/preempt.h:102:20: note: called from here
> > > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > > >                        ^~~~~~~~~~~~~~~
> > > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > > >                                              ^
> > > >    include/linux/hardirq.h:86:3: note: in expansion of macro 'BUG_ON'
> > > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > > >       ^~~~~~
> > > >    include/linux/hardirq.h:86:10: note: in expansion of macro 'in_nmi'
> > > >       BUG_ON(in_nmi() == NMI_MASK);   \
> > > >              ^~~~~~
> > > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/hardirq.h:7:0,
> > > >                     from include/linux/interrupt.h:11,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > > >> include/linux/ftrace_irq.h:10:29: error: inlining failed in call to always_inline 'ftrace_nmi_enter': function attribute mismatch
> > > >     static __always_inline void ftrace_nmi_enter(void)
> > > >                                 ^~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > >    include/linux/hardirq.h:85:3: note: called from here
> > > >       ftrace_nmi_enter();    \
> > > >       ^~~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/sched.h:12:0,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/lockdep.h:304:2: note: in expansion of macro 'current'
> > > >      current->lockdep_recursion += LOCKDEP_OFF; \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:84:3: note: in expansion of macro 'lockdep_off'
> > > >       lockdep_off();     \
> > > >       ^~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/irqflags.h:40:2: note: in expansion of macro 'current'
> > > >      current->hardirq_context++;  \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:89:3: note: in expansion of macro 'trace_hardirq_enter'
> > > >       trace_hardirq_enter();    \
> > > >       ^~~~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > >    arch/x86/include/asm/preempt.h:77:29: error: inlining failed in call to always_inline '__preempt_count_add': function attribute mismatch
> > > >     static __always_inline void __preempt_count_add(int val)
> > > >                                 ^~~~~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > >    include/linux/hardirq.h:87:3: note: called from here
> > > >       __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:521:2: note: in expansion of macro 'nmi_enter'
> > > >      nmi_enter();
> > > >      ^~~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > > >> arch/x86/include/asm/preempt.h:24:28: error: inlining failed in call to always_inline 'preempt_count': function attribute mismatch
> > > >     static __always_inline int preempt_count(void)
> > > >                                ^~~~~~~~~~~~~
> > > >    In file included from arch/x86/include/asm/current.h:5:0,
> > > >                     from include/linux/sched.h:12,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > >    include/linux/preempt.h:102:20: note: called from here
> > > >     #define in_nmi()  (preempt_count() & NMI_MASK)
> > > >                        ^~~~~~~~~~~~~~~
> > > >    include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
> > > >     # define unlikely(x) __builtin_expect(!!(x), 0)
> > > >                                              ^
> > > >    include/linux/hardirq.h:96:3: note: in expansion of macro 'BUG_ON'
> > > >       BUG_ON(!in_nmi());    \
> > > >       ^~~~~~
> > > >    include/linux/hardirq.h:96:11: note: in expansion of macro 'in_nmi'
> > > >       BUG_ON(!in_nmi());    \
> > > >               ^~~~~~
> > > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/sched.h:12:0,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/irqflags.h:44:2: note: in expansion of macro 'current'
> > > >      current->hardirq_context--;  \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:94:3: note: in expansion of macro 'trace_hardirq_exit'
> > > >       trace_hardirq_exit();    \
> > > >       ^~~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > > >> arch/x86/include/asm/current.h:13:44: error: inlining failed in call to always_inline 'get_current': function attribute mismatch
> > > >     static __always_inline struct task_struct *get_current(void)
> > > >                                                ^~~~~~~~~~~
> > > >    arch/x86/include/asm/current.h:18:17: note: called from here
> > > >     #define current get_current()
> > > >                     ^~~~~~~~~~~~~
> > > >    include/linux/lockdep.h:309:2: note: in expansion of macro 'current'
> > > >      current->lockdep_recursion -= LOCKDEP_OFF; \
> > > >      ^~~~~~~
> > > >    include/linux/hardirq.h:99:3: note: in expansion of macro 'lockdep_on'
> > > >       lockdep_on();     \
> > > >       ^~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/hardirq.h:7:0,
> > > >                     from include/linux/interrupt.h:11,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > > >> include/linux/ftrace_irq.h:18:29: error: inlining failed in call to always_inline 'ftrace_nmi_exit': function attribute mismatch
> > > >     static __always_inline void ftrace_nmi_exit(void)
> > > >                                 ^~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > >    include/linux/hardirq.h:98:3: note: called from here
> > > >       ftrace_nmi_exit();    \
> > > >       ^~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > >    In file included from include/linux/preempt.h:78:0,
> > > >                     from include/linux/rcupdate.h:27,
> > > >                     from include/linux/rculist.h:11,
> > > >                     from include/linux/pid.h:5,
> > > >                     from include/linux/sched.h:14,
> > > >                     from include/linux/context_tracking.h:5,
> > > >                     from arch/x86//kernel/traps.c:15:
> > > >    arch/x86/include/asm/preempt.h:82:29: error: inlining failed in call to always_inline '__preempt_count_sub': function attribute mismatch
> > > >     static __always_inline void __preempt_count_sub(int val)
> > > >                                 ^~~~~~~~~~~~~~~~~~~
> > > >    In file included from include/linux/interrupt.h:11:0,
> > > >                     from arch/x86//kernel/traps.c:16:
> > > >    include/linux/hardirq.h:97:3: note: called from here
> > > >       __preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
> > > >       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    arch/x86//kernel/traps.c:543:2: note: in expansion of macro 'nmi_exit'
> > > >      nmi_exit();
> > > >      ^~~~~~~~
> > > > ..
> > > >
> > > > vim +/try_get_desc +961 arch/x86/kernel/alternative.c
> > > >
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  959
> > > > 809106a6157bce Thomas Gleixner            2020-01-21  960  static __always_inline
> > > > 809106a6157bce Thomas Gleixner            2020-01-21 @961  struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp)
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  962  {
> > > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  963     struct bp_patching_desc *desc = READ_ONCE_NOCHECK(*descp); /* rcu_dereference */
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  964
> > > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  965     if (!desc || !arch_atomic_inc_not_zero(&desc->refs))
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  966             return NULL;
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  967
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  968     return desc;
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  969  }
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  970
> > > > 809106a6157bce Thomas Gleixner            2020-01-21 @971  static __always_inline void put_desc(struct bp_patching_desc *desc)
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  972  {
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  973     smp_mb__before_atomic();
> > > > a9d380bd4091e7 Peter Zijlstra             2020-01-24  974     arch_atomic_dec(&desc->refs);
> > > > 1f676247f36a4b Peter Zijlstra             2019-12-11  975  }
> > > > c0213b0ac03cf6 Daniel Bristot de Oliveira 2019-06-12  976
> > > >
> > > > :::::: The code at line 961 was first introduced by commit
> > > > :::::: 809106a6157bce0fff76bfc7864e7ce34080abe0 x86/int3: Ensure that poke_int3_handler() is not traced
> > > >
> > > > :::::: TO: Thomas Gleixner <tglx@linutronix.de>
> > > > :::::: CC: Peter Zijlstra <peterz@infradead.org>
> > > >
> > > > ---
> > > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
> > >
> > >

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 15:23       ` Dmitry Vyukov
@ 2020-03-05 15:55         ` Peter Zijlstra
  2020-03-05 16:29           ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Zijlstra @ 2020-03-05 15:55 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 05, 2020 at 04:23:11PM +0100, Dmitry Vyukov wrote:
> Compilers just don't allow this: asking to inline sanitized function
> into a non-sanitized function. But I don't know the ptrace/alternative
> code good enough to suggest the right alternative (don't call
> user_mode, copy user_mode, or something else).

Does it work if we inline into a .c file and build it with:

  KASAN_SANITIZE := n
  UBSAN_SANITIZE := n
  KCOV_INSTRUMENT := n

Which would be effectively the very same, just more cumbersome.

> Maybe we could replace no_sanitize with calls to
> kasan_disable_current/kasan_enable_current around the section of code
> where you don't want to see kasan reports.

It's not that we don't want to see the reports, the problem is that the
execution context is too fragile to call into random code. We've not yet
completely set up a normal C environment, even though we're more or less
running C.

This is very early exception entry where we still need to frob hardware
state and set up things.

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 15:55         ` Peter Zijlstra
@ 2020-03-05 16:29           ` Dmitry Vyukov
  2020-03-05 18:47             ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-05 16:29 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 4:55 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Thu, Mar 05, 2020 at 04:23:11PM +0100, Dmitry Vyukov wrote:
> > Compilers just don't allow this: asking to inline sanitized function
> > into a non-sanitized function. But I don't know the ptrace/alternative
> > code good enough to suggest the right alternative (don't call
> > user_mode, copy user_mode, or something else).
>
> Does it work if we inline into a .c file and build it with:
>
>   KASAN_SANITIZE := n
>   UBSAN_SANITIZE := n
>   KCOV_INSTRUMENT := n
>
> Which would be effectively the very same, just more cumbersome.

I think it should work, because then user_mode will also not be instrumented.

> > Maybe we could replace no_sanitize with calls to
> > kasan_disable_current/kasan_enable_current around the section of code
> > where you don't want to see kasan reports.
>
> It's not that we don't want to see the reports, the problem is that the
> execution context is too fragile to call into random code. We've not yet
> completely set up a normal C environment, even though we're more or less
> running C.
>
> This is very early exception entry where we still need to frob hardware
> state and set up things.

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 16:29           ` Dmitry Vyukov
@ 2020-03-05 18:47             ` Peter Zijlstra
  2020-03-05 20:13               ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Zijlstra @ 2020-03-05 18:47 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 05, 2020 at 05:29:27PM +0100, Dmitry Vyukov wrote:
> On Thu, Mar 5, 2020 at 4:55 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Thu, Mar 05, 2020 at 04:23:11PM +0100, Dmitry Vyukov wrote:
> > > Compilers just don't allow this: asking to inline sanitized function
> > > into a non-sanitized function. But I don't know the ptrace/alternative
> > > code good enough to suggest the right alternative (don't call
> > > user_mode, copy user_mode, or something else).
> >
> > Does it work if we inline into a .c file and build it with:
> >
> >   KASAN_SANITIZE := n
> >   UBSAN_SANITIZE := n
> >   KCOV_INSTRUMENT := n
> >
> > Which would be effectively the very same, just more cumbersome.
> 
> I think it should work, because then user_mode will also not be instrumented.

Right, but then I have to ask how this is different vs inlining things
into a __no_sanitize function.

Anyway, I'll go move code around so we can do this..

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 18:47             ` Peter Zijlstra
@ 2020-03-05 20:13               ` Dmitry Vyukov
  2020-03-05 20:28                 ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-05 20:13 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 7:47 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Thu, Mar 05, 2020 at 05:29:27PM +0100, Dmitry Vyukov wrote:
> > On Thu, Mar 5, 2020 at 4:55 PM Peter Zijlstra <peterz@infradead.org> wrote:
> > >
> > > On Thu, Mar 05, 2020 at 04:23:11PM +0100, Dmitry Vyukov wrote:
> > > > Compilers just don't allow this: asking to inline sanitized function
> > > > into a non-sanitized function. But I don't know the ptrace/alternative
> > > > code good enough to suggest the right alternative (don't call
> > > > user_mode, copy user_mode, or something else).
> > >
> > > Does it work if we inline into a .c file and build it with:
> > >
> > >   KASAN_SANITIZE := n
> > >   UBSAN_SANITIZE := n
> > >   KCOV_INSTRUMENT := n
> > >
> > > Which would be effectively the very same, just more cumbersome.
> >
> > I think it should work, because then user_mode will also not be instrumented.
>
> Right, but then I have to ask how this is different vs inlining things
> into a __no_sanitize function.

We ask compiler to do slightly different things in these cases. In the
original case we asked to sanitize user_mode. If we have a separate
file, we ask to not sanitize user_mode. A more explicit analog of this
would be to introduce user_mode2 with no_sanitize attribute and call
it from the poke_int3_handler.
Strictly saying what you are going to do is sort of ODR violation,
because now we have user_mode that is sanitized and another user_mode
which is not sanitized (different behavior). It should work for
force_inline functions because we won't actually have the user_mode
symbol materizalied. But generally one needs to be careful with such
tricks, say if the function would be inline and compiled to a real
symbol, an instrumented or non-instrumented version will be chosen
randomly and we may end up with silent unexpected results.

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 20:13               ` Dmitry Vyukov
@ 2020-03-05 20:28                 ` Peter Zijlstra
  2020-03-06  5:34                   ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Zijlstra @ 2020-03-05 20:28 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 05, 2020 at 09:13:26PM +0100, Dmitry Vyukov wrote:

> > Right, but then I have to ask how this is different vs inlining things
> > into a __no_sanitize function.
> 
> We ask compiler to do slightly different things in these cases. In the
> original case we asked to sanitize user_mode. If we have a separate
> file, we ask to not sanitize user_mode. A more explicit analog of this
> would be to introduce user_mode2 with no_sanitize attribute and call
> it from the poke_int3_handler.
> Strictly saying what you are going to do is sort of ODR violation,
> because now we have user_mode that is sanitized and another user_mode
> which is not sanitized (different behavior). It should work for
> force_inline functions because we won't actually have the user_mode
> symbol materizalied. But generally one needs to be careful with such
> tricks, say if the function would be inline and compiled to a real
> symbol, an instrumented or non-instrumented version will be chosen
> randomly and we may end up with silent unexpected results.

Right, so I'd completely understand the compiler yelling at me if the
functions were indeed instantiated, but exactly because of the
force-inline I was expecting it to actually work.

A well, can't have it all it seems.

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-05 20:28                 ` Peter Zijlstra
@ 2020-03-06  5:34                   ` Dmitry Vyukov
  2020-03-06  9:51                     ` Peter Zijlstra
  0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-06  5:34 UTC (permalink / raw)
  To: kbuild-all

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

On Thu, Mar 5, 2020 at 9:29 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Thu, Mar 05, 2020 at 09:13:26PM +0100, Dmitry Vyukov wrote:
>
> > > Right, but then I have to ask how this is different vs inlining things
> > > into a __no_sanitize function.
> >
> > We ask compiler to do slightly different things in these cases. In the
> > original case we asked to sanitize user_mode. If we have a separate
> > file, we ask to not sanitize user_mode. A more explicit analog of this
> > would be to introduce user_mode2 with no_sanitize attribute and call
> > it from the poke_int3_handler.
> > Strictly saying what you are going to do is sort of ODR violation,
> > because now we have user_mode that is sanitized and another user_mode
> > which is not sanitized (different behavior). It should work for
> > force_inline functions because we won't actually have the user_mode
> > symbol materizalied. But generally one needs to be careful with such
> > tricks, say if the function would be inline and compiled to a real
> > symbol, an instrumented or non-instrumented version will be chosen
> > randomly and we may end up with silent unexpected results.
>
> Right, so I'd completely understand the compiler yelling at me if the
> functions were indeed instantiated, but exactly because of the
> force-inline I was expecting it to actually work.

But then the compiler will start to silently and randomly sanitizing
functions that developer asked to not sanitize and not sanitizing that
developers asked to sanitize, without any developer visibility and
control.
It's just happens so that in this single, very particular case it's
what you would need. But there are lots and lots of cases where it's
the opposite of what you would want.  Say, consider, poke_int3_handler
gets inlines in LTO build, and compiler says: you know what, I am just
going to silently ignore your no_sanitize attribute to give you fun of
re-debugging the issue you think you fixed ;)

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-06  5:34                   ` Dmitry Vyukov
@ 2020-03-06  9:51                     ` Peter Zijlstra
  2020-03-06 10:06                       ` Dmitry Vyukov
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Zijlstra @ 2020-03-06  9:51 UTC (permalink / raw)
  To: kbuild-all

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

On Fri, Mar 06, 2020 at 06:34:49AM +0100, Dmitry Vyukov wrote:

> Say, consider, poke_int3_handler
> gets inlines in LTO build, and compiler says: you know what, I am just
> going to silently ignore your no_sanitize attribute to give you fun of
> re-debugging the issue you think you fixed ;)

*groan*, can't LTO still mess things up when combining translation units
build with different sanitize flags?

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

* Re: [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch
  2020-03-06  9:51                     ` Peter Zijlstra
@ 2020-03-06 10:06                       ` Dmitry Vyukov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Vyukov @ 2020-03-06 10:06 UTC (permalink / raw)
  To: kbuild-all

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

On Fri, Mar 6, 2020 at 10:51 AM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Fri, Mar 06, 2020 at 06:34:49AM +0100, Dmitry Vyukov wrote:
>
> > Say, consider, poke_int3_handler
> > gets inlines in LTO build, and compiler says: you know what, I am just
> > going to silently ignore your no_sanitize attribute to give you fun of
> > re-debugging the issue you think you fixed ;)
>
> *groan*, can't LTO still mess things up when combining translation units
> build with different sanitize flags?

It shouldn't. Why? It can preserve and respect the attributes/flags.

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

end of thread, other threads:[~2020-03-06 10:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-29 14:37 [peterz-queue:core/rcu 31/33] arch/x86/kernel/alternative.c:961:26: error: inlining failed in call to always_inline 'try_get_desc': function attribute mismatch kbuild test robot
2020-03-05 13:43 ` Peter Zijlstra
2020-03-05 15:00   ` Dmitry Vyukov
2020-03-05 15:10     ` Dmitry Vyukov
2020-03-05 15:23       ` Dmitry Vyukov
2020-03-05 15:55         ` Peter Zijlstra
2020-03-05 16:29           ` Dmitry Vyukov
2020-03-05 18:47             ` Peter Zijlstra
2020-03-05 20:13               ` Dmitry Vyukov
2020-03-05 20:28                 ` Peter Zijlstra
2020-03-06  5:34                   ` Dmitry Vyukov
2020-03-06  9:51                     ` Peter Zijlstra
2020-03-06 10:06                       ` Dmitry Vyukov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.