A set of fixes for x86:

 - Ensure that direct mapping alias is always flushed when changing page
   attributes. The optimization for small ranges failed to do so when
   the virtual address was in the vmalloc or module space.

 - Unbreak the trace event registration for syscalls without arguments
   caused by the refactoring of the SYSCALL_DEFINE0() macro.

 - Move the printk in the TSC deadline timer code to a place where it is
   guaranteed to only be called once during boot and cannot be rearmed by
   clearing warn_once after boot. If it's invoked post boot then lockdep
   rightfully complains about a potential deadlock as the calling context
   is different.

 - A series of fixes for objtool and the ORC unwinder addressing variety
   of small issues:

     Stack offset tracking for indirect CFAs in objtool ignored subsequent
     pushs and pops

     Repair the unwind hints in the register clearing entry ASM code

     Make the unwinding in the low level exit to usermode code stop after
     switching to the trampoline stack. The unwind hint is not longer valid
     and the ORC unwinder emits a warning as it can't find the registers
     anymore.

     Fix the unwind hints in switch_to_asm() and rewind_stack_do_exit()
     which caused objtool to generate bogus ORC data.

     Prevent unwinder warnings when dumping the stack of a non-current
     task as there is no way to be sure about the validity because the
     dumped stack can be a moving target.

     Make the ORC unwinder behave the same way as the frame pointer
     unwinder when dumping an inactive tasks stack and do not skip the
     first frame.

     Prevent ORC unwinding before ORC data has been initialized

     Immediately terminate unwinding when a unknown ORC entry type is
     found.

     Prevent premature stop of the unwinder caused by IRET frames.

     Fix another infinite loop in objtool caused by a negative offset which
     was not catched.

     Address a few build warnings in the ORC unwinder and add missing
     static/ro_after_init annotations
x86/unwind/orc: Move ORC sorting variables under !CONFIG_MODULES

Fix the following warnings seen with !CONFIG_MODULES:

  arch/x86/kernel/unwind_orc.c:29:26: warning: 'cur_orc_table' defined but not used [-Wunused-variable]
     29 | static struct orc_entry *cur_orc_table = __start_orc_unwind;
        |                          ^~~~~~~~~~~~~
  arch/x86/kernel/unwind_orc.c:28:13: warning: 'cur_orc_ip_table' defined but not used [-Wunused-variable]
     28 | static int *cur_orc_ip_table = __start_orc_unwind_ip;
        |             ^~~~~~~~~~~~~~~~

Fixes: 153eb2223c79 ("x86/unwind/orc: Convert global variables to static")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linux Next Mailing List <linux-next@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20200428071640.psn5m7eh3zt2in4v@treble
1 file changed