1. 18 Oct, 2019 19 commits
    • Jiri Slaby's avatar
      x86/asm: Remove the last GLOBAL user and remove the macro · b4edca15
      Jiri Slaby authored
      Convert the remaining 32bit users and remove the GLOBAL macro finally.
      In particular, this means to use SYM_ENTRY for the singlestepping hack
      region.
      
      Exclude the global definition of GLOBAL from x86 too.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-20-jslaby@suse.cz
      b4edca15
    • Jiri Slaby's avatar
      x86/asm/realmode: Use SYM_DATA_* instead of GLOBAL · 78f44330
      Jiri Slaby authored
      GLOBAL had several meanings and is going away. Convert all the data
      marked using GLOBAL to use SYM_DATA_START or SYM_DATA instead.
      
      Note that SYM_DATA_END_LABEL is used to generate tr_gdt_end too.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Pingfan Liu <kernelfans@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-19-jslaby@suse.cz
      78f44330
    • Jiri Slaby's avatar
      x86/asm: Use SYM_INNER_LABEL instead of GLOBAL · 26ba4e57
      Jiri Slaby authored
      The GLOBAL macro had several meanings and is going away. Convert all the
      inner function labels marked with GLOBAL to use SYM_INNER_LABEL instead.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-18-jslaby@suse.cz
      26ba4e57
    • Jiri Slaby's avatar
      x86/asm: Do not annotate functions with GLOBAL · 37818afd
      Jiri Slaby authored
      GLOBAL is an x86's custom macro and is going to die very soon. It was
      meant for global symbols, but here, it was used for functions. Instead,
      use the new macros SYM_FUNC_START* and SYM_CODE_START* (depending on the
      type of the function) which are dedicated to global functions. And since
      they both require a closing by SYM_*_END, do that here too.
      
      startup_64, which does not use GLOBAL but uses .globl explicitly, is
      converted too.
      
      "No alignments" are preserved.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-arch@vger.kernel.org
      Cc: Maran Wilson <maran.wilson@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-17-jslaby@suse.cz
      37818afd
    • Jiri Slaby's avatar
      x86/asm/purgatory: Start using annotations · b16fed65
      Jiri Slaby authored
      Purgatory used no annotations at all. So include linux/linkage.h and
      annotate everything:
      
      * code by SYM_CODE_*
      * data by SYM_DATA_*
      
       [ bp: Fixup comment in gdt: ]
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Alexios Zavras <alexios.zavras@intel.com>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-16-jslaby@suse.cz
      b16fed65
    • Jiri Slaby's avatar
      xen/pvh: Annotate data appropriately · 1de5bdce
      Jiri Slaby authored
      Use the new SYM_DATA_START_LOCAL, and SYM_DATA_END* macros to get:
      
        0000     8 OBJECT  LOCAL  DEFAULT    6 gdt
        0008    32 OBJECT  LOCAL  DEFAULT    6 gdt_start
        0028     0 OBJECT  LOCAL  DEFAULT    6 gdt_end
        0028   256 OBJECT  LOCAL  DEFAULT    6 early_stack
        0128     0 OBJECT  LOCAL  DEFAULT    6 early_stack
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Andy Shevchenko <andy@infradead.org>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-arch@vger.kernel.org
      Cc: platform-driver-x86@vger.kernel.org
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191011115108.12392-15-jslaby@suse.cz
      1de5bdce
    • Jiri Slaby's avatar
      x86/um: Annotate data appropriately · 773a37b1
      Jiri Slaby authored
      Use the new SYM_DATA_START and SYM_DATA_END_LABEL macros for vdso_start.
      
      Result is:
        0000  2376 OBJECT  GLOBAL DEFAULT    4 vdso_start
        0948     0 OBJECT  GLOBAL DEFAULT    4 vdso_end
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarRichard Weinberger <richard@nod.at>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Cc: user-mode-linux-user@lists.sourceforge.net
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-14-jslaby@suse.cz
      773a37b1
    • Jiri Slaby's avatar
      x86/boot: Annotate data appropriately · b8c3f9b5
      Jiri Slaby authored
      Use the new SYM_DATA, SYM_DATA_START, and SYM_DATA_END* macros for data,
      so that the data in the object file look sane:
      
        Value   Size Type    Bind   Vis      Ndx Name
          0000    10 OBJECT  GLOBAL DEFAULT    3 efi32_boot_gdt
          000a    10 OBJECT  LOCAL  DEFAULT    3 save_gdt
          0014     8 OBJECT  LOCAL  DEFAULT    3 func_rt_ptr
          001c    48 OBJECT  GLOBAL DEFAULT    3 efi_gdt64
          004c     0 OBJECT  LOCAL  DEFAULT    3 efi_gdt64_end
      
          0000    48 OBJECT  LOCAL  DEFAULT    3 gdt
          0030     0 OBJECT  LOCAL  DEFAULT    3 gdt_end
          0030     8 OBJECT  LOCAL  DEFAULT    3 efi_config
          0038    49 OBJECT  GLOBAL DEFAULT    3 efi32_config
          0069    49 OBJECT  GLOBAL DEFAULT    3 efi64_config
      
      All have correct size and type now.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-13-jslaby@suse.cz
      b8c3f9b5
    • Jiri Slaby's avatar
      x86/asm/head: Annotate data appropriately · b1bd27b9
      Jiri Slaby authored
      Use the new SYM_DATA, SYM_DATA_START, and SYM_DATA_END in both 32 and 64
      bit head_*.S. In the 64-bit version, define also
      SYM_DATA_START_PAGE_ALIGNED locally using the new SYM_START. It is used
      in the code instead of NEXT_PAGE() which was defined in this file and
      had been using the obsolete macro GLOBAL().
      
      Now, the data in the 64-bit object file look sane:
        Value   Size Type    Bind   Vis      Ndx Name
          0000  4096 OBJECT  GLOBAL DEFAULT   15 init_level4_pgt
          1000  4096 OBJECT  GLOBAL DEFAULT   15 level3_kernel_pgt
          2000  2048 OBJECT  GLOBAL DEFAULT   15 level2_kernel_pgt
          3000  4096 OBJECT  GLOBAL DEFAULT   15 level2_fixmap_pgt
          4000  4096 OBJECT  GLOBAL DEFAULT   15 level1_fixmap_pgt
          5000     2 OBJECT  GLOBAL DEFAULT   15 early_gdt_descr
          5002     8 OBJECT  LOCAL  DEFAULT   15 early_gdt_descr_base
          500a     8 OBJECT  GLOBAL DEFAULT   15 phys_base
          0000     8 OBJECT  GLOBAL DEFAULT   17 initial_code
          0008     8 OBJECT  GLOBAL DEFAULT   17 initial_gs
          0010     8 OBJECT  GLOBAL DEFAULT   17 initial_stack
          0000     4 OBJECT  GLOBAL DEFAULT   19 early_recursion_flag
          1000  4096 OBJECT  GLOBAL DEFAULT   19 early_level4_pgt
          2000 0x40000 OBJECT  GLOBAL DEFAULT   19 early_dynamic_pgts
          0000  4096 OBJECT  GLOBAL DEFAULT   22 empty_zero_page
      
      All have correct size and type now.
      
      Note that this also removes implicit 16B alignment previously inserted
      by ENTRY:
      
      * initial_code, setup_once_ref, initial_page_table, initial_stack,
        boot_gdt are still aligned
      * early_gdt_descr is now properly aligned as was intended before ENTRY
        was added there long time ago
      * phys_base's alignment is kept by an explicitly added new alignment
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Maran Wilson <maran.wilson@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-12-jslaby@suse.cz
      b1bd27b9
    • Jiri Slaby's avatar
      x86/asm/entry: Annotate interrupt symbols properly · cc66936e
      Jiri Slaby authored
      * annotate functions properly by SYM_CODE_START, SYM_CODE_START_LOCAL*
        and SYM_CODE_END -- these are not C-like functions, so they have to
        be annotated using CODE.
      * use SYM_INNER_LABEL* for labels being in the middle of other functions
        This prevents nested labels annotations.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-11-jslaby@suse.cz
      cc66936e
    • Jiri Slaby's avatar
      x86/asm: Annotate aliases · e9b9d020
      Jiri Slaby authored
      _key_expansion_128 is an alias to _key_expansion_256a, __memcpy to
      memcpy, xen_syscall32_target to xen_sysenter_target, and so on. Annotate
      them all using the new SYM_FUNC_START_ALIAS, SYM_FUNC_START_LOCAL_ALIAS,
      and SYM_FUNC_END_ALIAS. This will make the tools generating the
      debuginfo happy as it avoids nesting and double symbols.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: Juergen Gross <jgross@suse.com> [xen parts]
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-crypto@vger.kernel.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191011115108.12392-10-jslaby@suse.cz
      e9b9d020
    • Jiri Slaby's avatar
      x86/uaccess: Annotate local function · fa972201
      Jiri Slaby authored
      .Lcopy_user_handle_tail is a self-standing local function, annotate it
      as such using SYM_CODE_START_LOCAL.
      
      Again, no functional change, just documentation.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-9-jslaby@suse.cz
      fa972201
    • Jiri Slaby's avatar
      x86/boot: Annotate local functions · deff8a24
      Jiri Slaby authored
      .Lrelocated, .Lpaging_enabled, .Lno_longmode, and .Lin_pm32 are
      self-standing local functions, annotate them as such and preserve "no
      alignment".
      
      The annotations do not generate anything yet.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Wei Huang <wei@redhat.com>
      Cc: x86-ml <x86@kernel.org>
      Cc: Xiaoyao Li <xiaoyao.li@linux.intel.com>
      Link: https://lkml.kernel.org/r/20191011115108.12392-8-jslaby@suse.cz
      deff8a24
    • Jiri Slaby's avatar
      x86/asm/crypto: Annotate local functions · 74d8b90a
      Jiri Slaby authored
      Use the newly added SYM_FUNC_START_LOCAL to annotate beginnings of all
      functions which do not have ".globl" annotation, but their endings are
      annotated by ENDPROC. This is needed to balance ENDPROC for tools that
      generate debuginfo.
      
      These function names are not prepended with ".L" as they might appear in
      call traces and they wouldn't be visible after such change.
      
      To be symmetric, the functions' ENDPROCs are converted to the new
      SYM_FUNC_END.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-crypto@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-7-jslaby@suse.cz
      74d8b90a
    • Jiri Slaby's avatar
      x86/asm: Annotate local pseudo-functions · ef77e688
      Jiri Slaby authored
      Use the newly added SYM_CODE_START_LOCAL* to annotate beginnings of
      all pseudo-functions (those ending with END until now) which do not
      have ".globl" annotation. This is needed to balance END for tools that
      generate debuginfo. Note that ENDs are switched to SYM_CODE_END too so
      that everybody can see the pairing.
      
      C-like functions (which handle frame ptr etc.) are not annotated here,
      hence SYM_CODE_* macros are used here, not SYM_FUNC_*. Note that the
      32bit version of early_idt_handler_common already had ENDPROC -- switch
      that to SYM_CODE_END for the same reason as above (and to be the same as
      64bit).
      
      While early_idt_handler_common is LOCAL, it's name is not prepended with
      ".L" as it happens to appear in call traces.
      
      bad_get_user*, and bad_put_user are now aligned, as they are separate
      functions. They do not mind to be aligned -- no need to be compact
      there.
      
      early_idt_handler_common is aligned now too, as it is after
      early_idt_handler_array, so as well no need to be compact there.
      
      verify_cpu is self-standing and included in other .S files, so align it
      too.
      
      The others have alignment preserved to what it used to be (using the
      _NOALIGN variant of macros).
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Alexios Zavras <alexios.zavras@intel.com>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Cao jin <caoj.fnst@cn.fujitsu.com>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Maran Wilson <maran.wilson@oracle.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-6-jslaby@suse.cz
      ef77e688
    • Jiri Slaby's avatar
      x86/asm/entry: Annotate THUNKs · 76dc6d60
      Jiri Slaby authored
      Place SYM_*_START_NOALIGN and SYM_*_END around the THUNK macro body.
      Preserve @function by FUNC (64bit) and CODE (32bit). Given it was not
      marked as aligned, use NOALIGN.
      
      The result:
       Value  Size Type    Bind   Vis      Ndx Name
        0000    28 FUNC    GLOBAL DEFAULT    1 trace_hardirqs_on_thunk
        001c    28 FUNC    GLOBAL DEFAULT    1 trace_hardirqs_off_thunk
        0038    24 FUNC    GLOBAL DEFAULT    1 lockdep_sys_exit_thunk
        0050    24 FUNC    GLOBAL DEFAULT    1 ___preempt_schedule
        0068    24 FUNC    GLOBAL DEFAULT    1 ___preempt_schedule_notra
      
      The annotation of .L_restore does not generate anything (at the moment).
      Here, it just serves documentation purposes (as opening and closing
      brackets of functions).
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-5-jslaby@suse.cz
      76dc6d60
    • Jiri Slaby's avatar
      x86/asm: Annotate relocate_kernel_{32,64}.c · 6ec2a968
      Jiri Slaby authored
      There are functions in relocate_kernel_{32,64}.c which are not
      annotated. This makes automatic annotations on them rather hard. So
      annotate all the functions now.
      
      Note that these are not C-like functions, so FUNC is not used. Instead
      CODE markers are used. Also the functions are not aligned, so the
      NOALIGN versions are used:
      
      - SYM_CODE_START_NOALIGN
      - SYM_CODE_START_LOCAL_NOALIGN
      - SYM_CODE_END
      
      The result is:
        0000   108 NOTYPE  GLOBAL DEFAULT    1 relocate_kernel
        006c   165 NOTYPE  LOCAL  DEFAULT    1 identity_mapped
        0146   127 NOTYPE  LOCAL  DEFAULT    1 swap_pages
        0111    53 NOTYPE  LOCAL  DEFAULT    1 virtual_mapped
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Alexios Zavras <alexios.zavras@intel.com>
      Cc: Allison Randal <allison@lohutok.net>
      Cc: Enrico Weigelt <info@metux.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-arch@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-4-jslaby@suse.cz
      6ec2a968
    • Jiri Slaby's avatar
      x86/asm/suspend: Use SYM_DATA for data · 37503f73
      Jiri Slaby authored
      Some global data in the suspend code were marked as `ENTRY'. ENTRY was
      intended for functions and shall be paired with ENDPROC. ENTRY also
      aligns symbols to 16 bytes which creates unnecessary holes.
      
      Note that:
      
      * saved_magic (long) in wakeup_32 is still prepended by section's ALIGN
      * saved_magic (quad) in wakeup_64 follows a bunch of quads which are
        aligned (but need not be aligned to 16)
      
      Since historical markings are being dropped, make proper use of newly
      added SYM_DATA in this code.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarPavel Machek <pavel@ucw.cz>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191011115108.12392-3-jslaby@suse.cz
      37503f73
    • Jiri Slaby's avatar
      linkage: Introduce new macros for assembler symbols · ffedeeb7
      Jiri Slaby authored
      Introduce new C macros for annotations of functions and data in
      assembly. There is a long-standing mess in macros like ENTRY, END,
      ENDPROC and similar. They are used in different manners and sometimes
      incorrectly.
      
      So introduce macros with clear use to annotate assembly as follows:
      
      a) Support macros for the ones below
         SYM_T_FUNC -- type used by assembler to mark functions
         SYM_T_OBJECT -- type used by assembler to mark data
         SYM_T_NONE -- type used by assembler to mark entries of unknown type
      
         They are defined as STT_FUNC, STT_OBJECT, and STT_NOTYPE
         respectively. According to the gas manual, this is the most portable
         way. I am not sure about other assemblers, so this can be switched
         back to %function and %object if this turns into a problem.
         Architectures can also override them by something like ", @function"
         if they need.
      
         SYM_A_ALIGN, SYM_A_NONE -- align the symbol?
         SYM_L_GLOBAL, SYM_L_WEAK, SYM_L_LOCAL -- linkage of symbols
      
      b) Mostly internal annotations, used by the ones below
         SYM_ENTRY -- use only if you have to (for non-paired symbols)
         SYM_START -- use only if you have to (for paired symbols)
         SYM_END -- use only if you have to (for paired symbols)
      
      c) Annotations for code
         SYM_INNER_LABEL_ALIGN -- only for labels in the middle of code
         SYM_INNER_LABEL -- only for labels in the middle of code
      
         SYM_FUNC_START_LOCAL_ALIAS -- use where there are two local names for
      	one function
         SYM_FUNC_START_ALIAS -- use where there are two global names for one
      	function
         SYM_FUNC_END_ALIAS -- the end of LOCAL_ALIASed or ALIASed function
      
         SYM_FUNC_START -- use for global functions
         SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment
         SYM_FUNC_START_LOCAL -- use for local functions
         SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o
      	alignment
         SYM_FUNC_START_WEAK -- use for weak functions
         SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment
         SYM_FUNC_END -- the end of SYM_FUNC_START_LOCAL, SYM_FUNC_START,
      	SYM_FUNC_START_WEAK, ...
      
         For functions with special (non-C) calling conventions:
         SYM_CODE_START -- use for non-C (special) functions
         SYM_CODE_START_NOALIGN -- use for non-C (special) functions, w/o
      	alignment
         SYM_CODE_START_LOCAL -- use for local non-C (special) functions
         SYM_CODE_START_LOCAL_NOALIGN -- use for local non-C (special)
      	functions, w/o alignment
         SYM_CODE_END -- the end of SYM_CODE_START_LOCAL or SYM_CODE_START
      
      d) For data
         SYM_DATA_START -- global data symbol
         SYM_DATA_START_LOCAL -- local data symbol
         SYM_DATA_END -- the end of the SYM_DATA_START symbol
         SYM_DATA_END_LABEL -- the labeled end of SYM_DATA_START symbol
         SYM_DATA -- start+end wrapper around simple global data
         SYM_DATA_LOCAL -- start+end wrapper around simple local data
      
      ==========
      
      The macros allow to pair starts and ends of functions and mark functions
      correctly in the output ELF objects.
      
      All users of the old macros in x86 are converted to use these in further
      patches.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: x86-ml <x86@kernel.org>
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20191011115108.12392-2-jslaby@suse.cz
      ffedeeb7
  2. 11 Oct, 2019 1 commit
    • Jiri Slaby's avatar
      x86/asm: Make more symbols local · 30a2441c
      Jiri Slaby authored
      During the assembly cleanup patchset review, I found more symbols which
      are used only locally. So make them really local by prepending ".L" to
      them. Namely:
      
       - wakeup_idt is used only in realmode/rm/wakeup_asm.S.
       - in_pm32 is used only in boot/pmjump.S.
       - retint_user is used only in entry/entry_64.S, perhaps since commit
         2ec67971 ("x86/entry/64/compat: Remove most of the fast system
         call machinery"), where entry_64_compat's caller was removed.
      
      Drop GLOBAL from all of them too. I do not see more candidates in the
      series.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Acked-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/20191011092213.31470-1-jslaby@suse.czSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      30a2441c
  3. 05 Oct, 2019 2 commits
    • Jiri Slaby's avatar
      x86/asm: Make boot_gdt_descr local · 5aa5cbd2
      Jiri Slaby authored
      As far as I can see, it was never used outside of head_32.S. Not even
      when added in 2004. So make it local.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191003095238.29831-2-jslaby@suse.cz
      5aa5cbd2
    • Jiri Slaby's avatar
      x86/asm: Reorder early variables · 1a8770b7
      Jiri Slaby authored
      Moving early_recursion_flag (4 bytes) after early_level4_pgt (4k) and
      early_dynamic_pgts (256k) saves 4k which are used for alignment of
      early_level4_pgt after early_recursion_flag.
      
      The real improvement is merely on the source code side. Previously it
      was:
      * __INITDATA + .balign
      * early_recursion_flag variable
      * a ton of CPP MACROS
      * __INITDATA (again)
      * early_top_pgt and early_recursion_flag variables
      * .data
      
      Now, it is a bit simpler:
      * a ton of CPP MACROS
      * __INITDATA + .balign
      * early_top_pgt and early_recursion_flag variables
      * early_recursion_flag variable
      * .data
      
      On the binary level the change looks like this:
      Before:
       (sections)
        12 .init.data    00042000  0000000000000000  0000000000000000 00008000  2**12
       (symbols)
        000000       4 OBJECT  GLOBAL DEFAULT   22 early_recursion_flag
        001000    4096 OBJECT  GLOBAL DEFAULT   22 early_top_pgt
        002000 0x40000 OBJECT  GLOBAL DEFAULT   22 early_dynamic_pgts
      
      After:
       (sections)
        12 .init.data    00041004  0000000000000000  0000000000000000 00008000  2**12
       (symbols)
        000000    4096 OBJECT  GLOBAL DEFAULT   22 early_top_pgt
        001000 0x40000 OBJECT  GLOBAL DEFAULT   22 early_dynamic_pgts
        041000       4 OBJECT  GLOBAL DEFAULT   22 early_recursion_flag
      
      So the resulting vmlinux is smaller by 4k with my toolchain as many
      other variables can be placed after early_recursion_flag to fill the
      rest of the page. Note that this is only .init data, so it is freed
      right after being booted anyway. Savings on-disk are none -- compression
      of zeros is easy, so the size of bzImage is the same pre and post the
      change.
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191003095238.29831-1-jslaby@suse.cz
      1a8770b7
  4. 30 Sep, 2019 17 commits
    • Linus Torvalds's avatar
      Linux 5.4-rc1 · 54ecb8f7
      Linus Torvalds authored
      54ecb8f7
    • Linus Torvalds's avatar
      Merge tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · bb48a591
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A bunch of fixes that accumulated in recent weeks, mostly material for
        stable.
      
        Summary:
      
         - fix for regression from 5.3 that prevents to use balance convert
           with single profile
      
         - qgroup fixes: rescan race, accounting leak with multiple writers,
           potential leak after io failure recovery
      
         - fix for use after free in relocation (reported by KASAN)
      
         - other error handling fixups"
      
      * tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: qgroup: Fix reserved data space leak if we have multiple reserve calls
        btrfs: qgroup: Fix the wrong target io_tree when freeing reserved data space
        btrfs: Fix a regression which we can't convert to SINGLE profile
        btrfs: relocation: fix use-after-free on dead relocation roots
        Btrfs: fix race setting up and completing qgroup rescan workers
        Btrfs: fix missing error return if writeback for extent buffer never started
        btrfs: adjust dirty_metadata_bytes after writeback failure of extent buffer
        Btrfs: fix selftests failure due to uninitialized i_mode in test inodes
      bb48a591
    • Linus Torvalds's avatar
      Merge tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux · 80b29b6b
      Linus Torvalds authored
      Pull csky updates from Guo Ren:
       "This round of csky subsystem just some fixups:
      
         - Fix mb() synchronization problem
      
         - Fix dma_alloc_coherent with PAGE_SO attribute
      
         - Fix cache_op failed when cross memory ZONEs
      
         - Optimize arch_sync_dma_for_cpu/device with dma_inv_range
      
         - Fix ioremap function losing
      
         - Fix arch_get_unmapped_area() implementation
      
         - Fix defer cache flush for 610
      
         - Support kernel non-aligned access
      
         - Fix 610 vipt cache flush mechanism
      
         - Fix add zero_fp fixup perf backtrace panic
      
         - Move static keyword to the front of declaration
      
         - Fix csky_pmu.max_period assignment
      
         - Use generic free_initrd_mem()
      
         - entry: Remove unneeded need_resched() loop"
      
      * tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux:
        csky: Move static keyword to the front of declaration
        csky: entry: Remove unneeded need_resched() loop
        csky: Fixup csky_pmu.max_period assignment
        csky: Fixup add zero_fp fixup perf backtrace panic
        csky: Use generic free_initrd_mem()
        csky: Fixup 610 vipt cache flush mechanism
        csky: Support kernel non-aligned access
        csky: Fixup defer cache flush for 610
        csky: Fixup arch_get_unmapped_area() implementation
        csky: Fixup ioremap function losing
        csky: Optimize arch_sync_dma_for_cpu/device with dma_inv_range
        csky/dma: Fixup cache_op failed when cross memory ZONEs
        csky: Fixup dma_alloc_coherent with PAGE_SO attribute
        csky: Fixup mb() synchronization problem
      80b29b6b
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · cef0aa0c
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A few fixes that have trickled in through the merge window:
      
         - Video fixes for OMAP due to panel-dpi driver removal
      
         - Clock fixes for OMAP that broke no-idle quirks + nfsroot on DRA7
      
         - Fixing arch version on ASpeed ast2500
      
         - Two fixes for reset handling on ARM SCMI"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: aspeed: ast2500 is ARMv6K
        reset: reset-scmi: add missing handle initialisation
        firmware: arm_scmi: reset: fix reset_state assignment in scmi_domain_reset
        bus: ti-sysc: Remove unpaired sysc_clkdm_deny_idle()
        ARM: dts: logicpd-som-lv: Fix i2c2 and i2c3 Pin mux
        ARM: dts: am3517-evm: Fix missing video
        ARM: dts: logicpd-torpedo-baseboard: Fix missing video
        ARM: omap2plus_defconfig: Fix missing video
        bus: ti-sysc: Fix handling of invalid clocks
        bus: ti-sysc: Fix clock handling for no-idle quirks
      cef0aa0c
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · cf4f493b
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
       "A few more tracing fixes:
      
         - Fix a buffer overflow by checking nr_args correctly in probes
      
         - Fix a warning that is reported by clang
      
         - Fix a possible memory leak in error path of filter processing
      
         - Fix the selftest that checks for failures, but wasn't failing
      
         - Minor clean up on call site output of a memory trace event"
      
      * tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        selftests/ftrace: Fix same probe error test
        mm, tracing: Print symbol name for call_site in trace events
        tracing: Have error path in predicate_parse() free its allocated memory
        tracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro
        tracing/probe: Fix to check the difference of nr_args before adding probe
      cf4f493b
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · c710364f
      Linus Torvalds authored
      Pull more MMC updates from Ulf Hansson:
       "A couple more updates/fixes for MMC:
      
         - sdhci-pci: Add Genesys Logic GL975x support
      
         - sdhci-tegra: Recover loss in throughput for DMA
      
         - sdhci-of-esdhc: Fix DMA bug"
      
      * tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: host: sdhci-pci: Add Genesys Logic GL975x support
        mmc: tegra: Implement ->set_dma_mask()
        mmc: sdhci: Let drivers define their DMA mask
        mmc: sdhci-of-esdhc: set DMA snooping based on DMA coherence
        mmc: sdhci: improve ADMA error reporting
      c710364f
    • Krzysztof Wilczynski's avatar
      csky: Move static keyword to the front of declaration · 9af032a3
      Krzysztof Wilczynski authored
      Move the static keyword to the front of declaration of
      csky_pmu_of_device_ids, and resolve the following compiler
      warning that can be seen when building with warnings
      enabled (W=1):
      
      arch/csky/kernel/perf_event.c:1340:1: warning:
        ‘static’ is not at beginning of declaration [-Wold-style-declaration]
      Signed-off-by: default avatarKrzysztof Wilczynski <kw@linux.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      9af032a3
    • Valentin Schneider's avatar
      csky: entry: Remove unneeded need_resched() loop · a2139d3b
      Valentin Schneider authored
      Since the enabling and disabling of IRQs within preempt_schedule_irq()
      is contained in a need_resched() loop, we don't need the outer arch
      code loop.
      Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      a2139d3b
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 97f9a3c4
      Linus Torvalds authored
      Pull Documentation/process update from Greg KH:
       "Here are two small Documentation/process/embargoed-hardware-issues.rst
        file updates that missed my previous char/misc pull request.
      
        The first one adds an Intel representative for the process, and the
        second one cleans up the text a bit more when it comes to how the
        disclosure rules work, as it was a bit confusing to some companies"
      
      * tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        Documentation/process: Clarify disclosure rules
        Documentation/process: Volunteer as the ambassador for Intel
      97f9a3c4
    • Linus Torvalds's avatar
      Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 1eb80d6f
      Linus Torvalds authored
      Pull more vfs updates from Al Viro:
       "A couple of misc patches"
      
      * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        afs dynroot: switch to simple_dir_operations
        fs/handle.c - fix up kerneldoc
      1eb80d6f
    • Linus Torvalds's avatar
      Merge tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 7edee522
      Linus Torvalds authored
      Pull more cifs updates from Steve French:
       "Fixes from the recent SMB3 Test events and Storage Developer
        Conference (held the last two weeks).
      
        Here are nine smb3 patches including an important patch for debugging
        traces with wireshark, with three patches marked for stable.
      
        Additional fixes from last week to better handle some newly discovered
        reparse points, and a fix the create/mkdir path for setting the mode
        more atomically (in SMB3 Create security descriptor context), and one
        for path name processing are still being tested so are not included
        here"
      
      * tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        CIFS: Fix oplock handling for SMB 2.1+ protocols
        smb3: missing ACL related flags
        smb3: pass mode bits into create calls
        smb3: Add missing reparse tags
        CIFS: fix max ea value size
        fs/cifs/sess.c: Remove set but not used variable 'capabilities'
        fs/cifs/smb2pdu.c: Make SMB2_notify_init static
        smb3: fix leak in "open on server" perf counter
        smb3: allow decryption keys to be dumped by admin for debugging
      7edee522
    • Mao Han's avatar
      csky: Fixup csky_pmu.max_period assignment · 3a09d8e2
      Mao Han authored
      The csky_pmu.max_period has type u64, and BIT() can only return
      32 bits unsigned long on C-SKY. The initialization for max_period
      will be incorrect when count_width is bigger than 32.
      
      Use BIT_ULL()
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      3a09d8e2
    • Guo Ren's avatar
      csky: Fixup add zero_fp fixup perf backtrace panic · 48ede51f
      Guo Ren authored
      We need set fp zero to let backtrace know the end. The patch fixup perf
      callchain panic problem, because backtrace didn't know what is the end
      of fp.
      Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
      Reported-by: default avatarMao Han <han_mao@c-sky.com>
      48ede51f
    • Mike Rapoport's avatar
      csky: Use generic free_initrd_mem() · fdbdcddc
      Mike Rapoport authored
      The csky implementation of free_initrd_mem() is an open-coded version of
      free_reserved_area() without poisoning.
      
      Remove it and make csky use the generic version of free_initrd_mem().
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      fdbdcddc
    • Linus Torvalds's avatar
      Merge branch 'entropy' · 3f2dc279
      Linus Torvalds authored
      Merge active entropy generation updates.
      
      This is admittedly partly "for discussion".  We need to have a way
      forward for the boot time deadlocks where user space ends up waiting for
      more entropy, but no entropy is forthcoming because the system is
      entirely idle just waiting for something to happen.
      
      While this was triggered by what is arguably a user space bug with
      GDM/gnome-session asking for secure randomness during early boot, when
      they didn't even need any such truly secure thing, the issue ends up
      being that our "getrandom()" interface is prone to that kind of
      confusion, because people don't think very hard about whether they want
      to block for sufficient amounts of entropy.
      
      The approach here-in is to decide to not just passively wait for entropy
      to happen, but to start actively collecting it if it is missing.  This
      is not necessarily always possible, but if the architecture has a CPU
      cycle counter, there is a fair amount of noise in the exact timings of
      reasonably complex loads.
      
      We may end up tweaking the load and the entropy estimates, but this
      should be at least a reasonable starting point.
      
      As part of this, we also revert the revert of the ext4 IO pattern
      improvement that ended up triggering the reported lack of external
      entropy.
      
      * getrandom() active entropy waiting:
        Revert "Revert "ext4: make __ext4_get_inode_loc plug""
        random: try to actively add entropy rather than passively wait for it
      3f2dc279
    • Linus Torvalds's avatar
      Revert "Revert "ext4: make __ext4_get_inode_loc plug"" · 02f03c42
      Linus Torvalds authored
      This reverts commit 72dbcf72.
      
      Instead of waiting forever for entropy that may just not happen, we now
      try to actively generate entropy when required, and are thus hopefully
      avoiding the problem that caused the nice ext4 IO pattern fix to be
      reverted.
      
      So revert the revert.
      
      Cc: Ahmed S. Darwish <darwish.07@gmail.com>
      Cc: Ted Ts'o <tytso@mit.edu>
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: Alexander E. Patrakov <patrakov@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      02f03c42
    • Linus Torvalds's avatar
      random: try to actively add entropy rather than passively wait for it · 50ee7529
      Linus Torvalds authored
      For 5.3 we had to revert a nice ext4 IO pattern improvement, because it
      caused a bootup regression due to lack of entropy at bootup together
      with arguably broken user space that was asking for secure random
      numbers when it really didn't need to.
      
      See commit 72dbcf72 (Revert "ext4: make __ext4_get_inode_loc plug").
      
      This aims to solve the issue by actively generating entropy noise using
      the CPU cycle counter when waiting for the random number generator to
      initialize.  This only works when you have a high-frequency time stamp
      counter available, but that's the case on all modern x86 CPU's, and on
      most other modern CPU's too.
      
      What we do is to generate jitter entropy from the CPU cycle counter
      under a somewhat complex load: calling the scheduler while also
      guaranteeing a certain amount of timing noise by also triggering a
      timer.
      
      I'm sure we can tweak this, and that people will want to look at other
      alternatives, but there's been a number of papers written on jitter
      entropy, and this should really be fairly conservative by crediting one
      bit of entropy for every timer-induced jump in the cycle counter.  Not
      because the timer itself would be all that unpredictable, but because
      the interaction between the timer and the loop is going to be.
      
      Even if (and perhaps particularly if) the timer actually happens on
      another CPU, the cacheline interaction between the loop that reads the
      cycle counter and the timer itself firing is going to add perturbations
      to the cycle counter values that get mixed into the entropy pool.
      
      As Thomas pointed out, with a modern out-of-order CPU, even quite simple
      loops show a fair amount of hard-to-predict timing variability even in
      the absense of external interrupts.  But this tries to take that further
      by actually having a fairly complex interaction.
      
      This is not going to solve the entropy issue for architectures that have
      no CPU cycle counter, but it's not clear how (and if) that is solvable,
      and the hardware in question is largely starting to be irrelevant.  And
      by doing this we can at least avoid some of the even more contentious
      approaches (like making the entropy waiting time out in order to avoid
      the possibly unbounded waiting).
      
      Cc: Ahmed Darwish <darwish.07@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: Nicholas Mc Guire <hofrat@opentech.at>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Willy Tarreau <w@1wt.eu>
      Cc: Alexander E. Patrakov <patrakov@gmail.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      50ee7529
  5. 29 Sep, 2019 1 commit