1. 05 11月, 2019 1 次提交
    • H
      timekeeping/vsyscall: Update VDSO data unconditionally · 52338415
      Huacai Chen 提交于
      The update of the VDSO data is depending on __arch_use_vsyscall() returning
      True. This is a leftover from the attempt to map the features of various
      architectures 1:1 into generic code.
      
      The usage of __arch_use_vsyscall() in the actual vsyscall implementations
      got dropped and replaced by the requirement for the architecture code to
      return U64_MAX if the global clocksource is not usable in the VDSO.
      
      But the __arch_use_vsyscall() check in the update code stayed which causes
      the VDSO data to be stale or invalid when an architecture actually
      implements that function and returns False when the current clocksource is
      not usable in the VDSO.
      
      As a consequence the VDSO implementations of clock_getres(), time(),
      clock_gettime(CLOCK_.*_COARSE) operate on invalid data and return bogus
      information.
      
      Remove the __arch_use_vsyscall() check from the VDSO update function and
      update the VDSO data unconditionally.
      
      [ tglx: Massaged changelog and removed the now useless implementations in
        	asm-generic/ARM64/MIPS ]
      
      Fixes: 44f57d78 ("timekeeping: Provide a generic update_vsyscall() implementation")
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/1571887709-11447-1-git-send-email-chenhc@lemote.com
      52338415
  2. 27 9月, 2019 1 次提交
    • M
      mm: treewide: clarify pgtable_page_{ctor,dtor}() naming · b4ed71f5
      Mark Rutland 提交于
      The naming of pgtable_page_{ctor,dtor}() seems to have confused a few
      people, and until recently arm64 used these erroneously/pointlessly for
      other levels of page table.
      
      To make it incredibly clear that these only apply to the PTE level, and to
      align with the naming of pgtable_pmd_page_{ctor,dtor}(), let's rename them
      to pgtable_pte_page_{ctor,dtor}().
      
      These changes were generated with the following shell script:
      
      ----
      git grep -lw 'pgtable_page_.tor' | while read FILE; do
          sed -i '{s/pgtable_page_ctor/pgtable_pte_page_ctor/}' $FILE;
          sed -i '{s/pgtable_page_dtor/pgtable_pte_page_dtor/}' $FILE;
      done
      ----
      
      ... with the documentation re-flowed to remain under 80 columns, and
      whitespace fixed up in macros to keep backslashes aligned.
      
      There should be no functional change as a result of this patch.
      
      Link: http://lkml.kernel.org/r/20190722141133.3116-1-mark.rutland@arm.comSigned-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>	[m68k]
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Yu Zhao <yuzhao@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b4ed71f5
  3. 26 9月, 2019 6 次提交
    • K
      bug: move WARN_ON() "cut here" into exception handler · a44f71a9
      Kees Cook 提交于
      The original clean up of "cut here" missed the WARN_ON() case (that does
      not have a printk message), which was fixed recently by adding an explicit
      printk of "cut here".  This had the downside of adding a printk() to every
      WARN_ON() caller, which reduces the utility of using an instruction
      exception to streamline the resulting code.  By making this a new BUGFLAG,
      all of these can be removed and "cut here" can be handled by the exception
      handler.
      
      This was very pronounced on PowerPC, but the effect can be seen on x86 as
      well.  The resulting text size of a defconfig build shows some small
      savings from this patch:
      
         text    data     bss     dec     hex filename
      19691167        5134320 1646664 26472151        193eed7 vmlinux.before
      19676362        5134260 1663048 26473670        193f4c6 vmlinux.after
      
      This change also opens the door for creating something like BUG_MSG(),
      where a custom printk() before issuing BUG(), without confusing the "cut
      here" line.
      
      Link: http://lkml.kernel.org/r/201908200943.601DD59DCE@keescook
      Fixes: 6b15f678 ("include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reported-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a44f71a9
    • K
      bug: consolidate __WARN_FLAGS usage · 2da1ead4
      Kees Cook 提交于
      Instead of having separate tests for __WARN_FLAGS, merge the two #ifdef
      blocks and replace the synonym WANT_WARN_ON_SLOWPATH macro.
      
      Link: http://lkml.kernel.org/r/20190819234111.9019-7-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2da1ead4
    • K
      bug: clean up helper macros to remove __WARN_TAINT() · d4bce140
      Kees Cook 提交于
      In preparation for cleaning up "cut here" even more, this removes the
      __WARN_*TAINT() helpers, as they limit the ability to add new BUGFLAG_*
      flags to call sites.  They are removed by expanding them into full
      __WARN_FLAGS() calls.
      
      Link: http://lkml.kernel.org/r/20190819234111.9019-6-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d4bce140
    • K
      bug: consolidate warn_slowpath_fmt() usage · f2f84b05
      Kees Cook 提交于
      Instead of having a separate helper for no printk output, just consolidate
      the logic into warn_slowpath_fmt().
      
      Link: http://lkml.kernel.org/r/20190819234111.9019-4-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f2f84b05
    • K
      bug: rename __WARN_printf_taint() to __WARN_printf() · 89348fc3
      Kees Cook 提交于
      This just renames the helper to improve readability.
      
      Link: http://lkml.kernel.org/r/20190819234111.9019-3-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      89348fc3
    • K
      bug: refactor away warn_slowpath_fmt_taint() · ee871133
      Kees Cook 提交于
      Patch series "Clean up WARN() "cut here" handling", v2.
      
      Christophe Leroy noticed that the fix for missing "cut here" in the WARN()
      case was adding explicit printk() calls instead of teaching the exception
      handler to add it.  This refactors the bug/warn infrastructure to pass
      this information as a new BUGFLAG.
      
      Longer details repeated from the last patch in the series:
      
      bug: move WARN_ON() "cut here" into exception handler
      
      The original cleanup of "cut here" missed the WARN_ON() case (that does
      not have a printk message), which was fixed recently by adding an explicit
      printk of "cut here".  This had the downside of adding a printk() to every
      WARN_ON() caller, which reduces the utility of using an instruction
      exception to streamline the resulting code.  By making this a new BUGFLAG,
      all of these can be removed and "cut here" can be handled by the exception
      handler.
      
      This was very pronounced on PowerPC, but the effect can be seen on x86 as
      well.  The resulting text size of a defconfig build shows some small
      savings from this patch:
      
         text    data     bss     dec     hex filename
      19691167        5134320 1646664 26472151        193eed7 vmlinux.before
      19676362        5134260 1663048 26473670        193f4c6 vmlinux.after
      
      This change also opens the door for creating something like BUG_MSG(),
      where a custom printk() before issuing BUG(), without confusing the "cut
      here" line.
      
      This patch (of 7):
      
      There's no reason to have specialized helpers for passing the warn taint
      down to __warn().  Consolidate and refactor helper macros, removing
      __WARN_printf() and warn_slowpath_fmt_taint().
      
      Link: http://lkml.kernel.org/r/20190819234111.9019-2-keescook@chromium.orgSigned-off-by: NKees Cook <keescook@chromium.org>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Drew Davenport <ddavenport@chromium.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
      Cc: Feng Tang <feng.tang@intel.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: YueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ee871133
  4. 25 9月, 2019 3 次提交
  5. 12 9月, 2019 2 次提交
    • W
      module: Remove leftover '#undef' from export header · 2e6fcfeb
      Will Deacon 提交于
      Commit 7290d580 ("module: use relative references for __ksymtab
      entries") converted the '__put' #define into an assembly macro in
      asm-generic/export.h but forgot to remove the corresponding '#undef'.
      
      Remove the leftover '#undef'.
      
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      2e6fcfeb
    • W
      module: Fix link failure due to invalid relocation on namespace offset · 069e1c07
      Will Deacon 提交于
      Commit 8651ec01 ("module: add support for symbol namespaces.")
      broke linking for arm64 defconfig:
      
        | lib/crypto/arc4.o: In function `__ksymtab_arc4_setkey':
        | arc4.c:(___ksymtab+arc4_setkey+0x8): undefined reference to `no symbol'
        | lib/crypto/arc4.o: In function `__ksymtab_arc4_crypt':
        | arc4.c:(___ksymtab+arc4_crypt+0x8): undefined reference to `no symbol'
      
      This is because the dummy initialisation of the 'namespace_offset' field
      in 'struct kernel_symbol' when using EXPORT_SYMBOL on architectures with
      support for PREL32 locations uses an offset from an absolute address (0)
      in an effort to trick 'offset_to_pointer' into behaving as a NOP,
      allowing non-namespaced symbols to be treated in the same way as those
      belonging to a namespace.
      
      Unfortunately, place-relative relocations require a symbol reference
      rather than an absolute value and, although x86 appears to get away with
      this due to placing the kernel text at the top of the address space, it
      almost certainly results in a runtime failure if the kernel is relocated
      dynamically as a result of KASLR.
      
      Rework 'namespace_offset' so that a value of 0, which cannot occur for a
      valid namespaced symbol, indicates that the corresponding symbol does
      not belong to a namespace.
      
      Cc: Matthias Maennich <maennich@google.com>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Fixes: 8651ec01 ("module: add support for symbol namespaces.")
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Tested-by: NMatthias Maennich <maennich@google.com>
      Tested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NMatthias Maennich <maennich@google.com>
      Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      069e1c07
  6. 10 9月, 2019 2 次提交
    • M
      module: add support for symbol namespaces. · 8651ec01
      Matthias Maennich 提交于
      The EXPORT_SYMBOL_NS() and EXPORT_SYMBOL_NS_GPL() macros can be used to
      export a symbol to a specific namespace.  There are no _GPL_FUTURE and
      _UNUSED variants because these are currently unused, and I'm not sure
      they are necessary.
      
      I didn't add EXPORT_SYMBOL_NS() for ASM exports; this patch sets the
      namespace of ASM exports to NULL by default. In case of relative
      references, it will be relocatable to NULL. If there's a need, this
      should be pretty easy to add.
      
      A module that wants to use a symbol exported to a namespace must add a
      MODULE_IMPORT_NS() statement to their module code; otherwise, modpost
      will complain when building the module, and the kernel module loader
      will emit an error and fail when loading the module.
      
      MODULE_IMPORT_NS() adds a modinfo tag 'import_ns' to the module. That
      tag can be observed by the modinfo command, modpost and kernel/module.c
      at the time of loading the module.
      
      The ELF symbols are renamed to include the namespace with an asm label;
      for example, symbol 'usb_stor_suspend' in namespace USB_STORAGE becomes
      'usb_stor_suspend.USB_STORAGE'.  This allows modpost to do namespace
      checking, without having to go through all the effort of parsing ELF and
      relocation records just to get to the struct kernel_symbols.
      
      On x86_64 I saw no difference in binary size (compression), but at
      runtime this will require a word of memory per export to hold the
      namespace. An alternative could be to store namespaced symbols in their
      own section and use a separate 'struct namespaced_kernel_symbol' for
      that section, at the cost of making the module loader more complex.
      Co-developed-by: NMartijn Coenen <maco@android.com>
      Signed-off-by: NMartijn Coenen <maco@android.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMatthias Maennich <maennich@google.com>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      8651ec01
    • M
      export: explicitly align struct kernel_symbol · ed13fc33
      Matthias Maennich 提交于
      This change allows growing struct kernel_symbol without wasting bytes to
      alignment. It also concretized the alignment of ksymtab entries if
      relative references are used for ksymtab entries.
      
      struct kernel_symbol was already implicitly being aligned to the word
      size, except on x86_64 and m68k, where it is aligned to 16 and 2 bytes,
      respectively.
      
      As far as I can tell there is no requirement for aligning struct
      kernel_symbol to 16 bytes on x86_64, but gcc aligns structs to their
      size, and the linker aligns the custom __ksymtab sections to the largest
      data type contained within, so setting KSYM_ALIGN to 16 was necessary to
      stay consistent with the code generated for non-ASM EXPORT_SYMBOL(). Now
      that non-ASM EXPORT_SYMBOL() explicitly aligns to word size (8),
      KSYM_ALIGN is no longer necessary.
      
      In case of relative references, the alignment has been changed
      accordingly to not waste space when adding new struct members.
      
      As for m68k, struct kernel_symbol is aligned to 2 bytes even though the
      structure itself is 8 bytes; using a 4-byte alignment shouldn't hurt.
      
      I manually verified the output of the __ksymtab sections didn't change
      on x86, x86_64, arm, arm64 and m68k. As expected, the section contents
      didn't change, and the ELF section alignment only changed on x86_64 and
      m68k. Feedback from other archs more than welcome.
      Co-developed-by: NMartijn Coenen <maco@android.com>
      Signed-off-by: NMartijn Coenen <maco@android.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMatthias Maennich <maennich@google.com>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      ed13fc33
  7. 02 9月, 2019 2 次提交
  8. 31 8月, 2019 1 次提交
  9. 28 8月, 2019 1 次提交
  10. 23 8月, 2019 1 次提交
  11. 20 8月, 2019 1 次提交
  12. 14 8月, 2019 1 次提交
  13. 07 8月, 2019 1 次提交
    • L
      error-injection: Consolidate override function definition · 45880f7b
      Leo Yan 提交于
      The function override_function_with_return() is defined separately for
      each architecture and every architecture's definition is almost same
      with each other.  E.g. x86 and powerpc both define function in its own
      asm/error-injection.h header and override_function_with_return() has
      the same definition, the only difference is that x86 defines an extra
      function just_return_func() but it is specific for x86 and is only used
      by x86's override_function_with_return(), so don't need to export this
      function.
      
      This patch consolidates override_function_with_return() definition into
      asm-generic/error-injection.h header, thus all architectures can use the
      common definition.  As result, the architecture specific headers are
      removed; the include/linux/error-injection.h header also changes to
      include asm-generic/error-injection.h header rather than architecture
      header, furthermore, it includes linux/compiler.h for successful
      compilation.
      Reviewed-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      45880f7b
  14. 03 8月, 2019 1 次提交
    • Q
      asm-generic: fix -Wtype-limits compiler warnings · cbedfe11
      Qian Cai 提交于
      Commit d66acc39 ("bitops: Optimise get_order()") introduced a
      compilation warning because "rx_frag_size" is an "ushort" while
      PAGE_SHIFT here is 16.
      
      The commit changed the get_order() to be a multi-line macro where
      compilers insist to check all statements in the macro even when
      __builtin_constant_p(rx_frag_size) will return false as "rx_frag_size"
      is a module parameter.
      
      In file included from ./arch/powerpc/include/asm/page_64.h:107,
                       from ./arch/powerpc/include/asm/page.h:242,
                       from ./arch/powerpc/include/asm/mmu.h:132,
                       from ./arch/powerpc/include/asm/lppaca.h:47,
                       from ./arch/powerpc/include/asm/paca.h:17,
                       from ./arch/powerpc/include/asm/current.h:13,
                       from ./include/linux/thread_info.h:21,
                       from ./arch/powerpc/include/asm/processor.h:39,
                       from ./include/linux/prefetch.h:15,
                       from drivers/net/ethernet/emulex/benet/be_main.c:14:
      drivers/net/ethernet/emulex/benet/be_main.c: In function 'be_rx_cqs_create':
      ./include/asm-generic/getorder.h:54:9: warning: comparison is always
      true due to limited range of data type [-Wtype-limits]
         (((n) < (1UL << PAGE_SHIFT)) ? 0 :  \
               ^
      drivers/net/ethernet/emulex/benet/be_main.c:3138:33: note: in expansion
      of macro 'get_order'
        adapter->big_page_size = (1 << get_order(rx_frag_size)) * PAGE_SIZE;
                                       ^~~~~~~~~
      
      Fix it by moving all of this multi-line macro into a proper function,
      and killing __get_order() off.
      
      [akpm@linux-foundation.org: remove __get_order() altogether]
      [cai@lca.pw: v2]
        Link: http://lkml.kernel.org/r/1564000166-31428-1-git-send-email-cai@lca.pw
      Link: http://lkml.kernel.org/r/1563914986-26502-1-git-send-email-cai@lca.pw
      Fixes: d66acc39 ("bitops: Optimise get_order()")
      Signed-off-by: NQian Cai <cai@lca.pw>
      Reviewed-by: NNathan Chancellor <natechancellor@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jakub Jelinek <jakub@redhat.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Bill Wendling <morbo@google.com>
      Cc: James Y Knight <jyknight@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      cbedfe11
  15. 01 8月, 2019 1 次提交
  16. 31 7月, 2019 1 次提交
  17. 22 7月, 2019 1 次提交
  18. 17 7月, 2019 2 次提交
  19. 13 7月, 2019 2 次提交
    • M
      asm-generic, x86: introduce generic pte_{alloc,free}_one[_kernel] · 5fba4af4
      Mike Rapoport 提交于
      Most architectures have identical or very similar implementation of
      pte_alloc_one_kernel(), pte_alloc_one(), pte_free_kernel() and
      pte_free().
      
      Add a generic implementation that can be reused across architectures and
      enable its use on x86.
      
      The generic implementation uses
      
      	GFP_KERNEL | __GFP_ZERO
      
      for the kernel page tables and
      
      	GFP_KERNEL | __GFP_ZERO | __GFP_ACCOUNT
      
      for the user page tables.
      
      The "base" functions for PTE allocation, namely __pte_alloc_one_kernel()
      and __pte_alloc_one() are intended for the architectures that require
      additional actions after actual memory allocation or must use non-default
      GFP flags.
      
      x86 is switched to use generic pte_alloc_one_kernel(), pte_free_kernel() and
      pte_free().
      
      x86 still implements pte_alloc_one() to allow run-time control of GFP
      flags required for "userpte" command line option.
      
      Link: http://lkml.kernel.org/r/1557296232-15361-2-git-send-email-rppt@linux.ibm.comSigned-off-by: NMike Rapoport <rppt@linux.ibm.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Guo Ren <ren_guo@c-sky.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Sam Creasey <sammy@sammy.net>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5fba4af4
    • M
      asm-generic, x86: add bitops instrumentation for KASAN · 751ad98d
      Marco Elver 提交于
      This adds a new header to asm-generic to allow optionally instrumenting
      architecture-specific asm implementations of bitops.
      
      This change includes the required change for x86 as reference and
      changes the kernel API doc to point to bitops-instrumented.h instead.
      Rationale: the functions in x86's bitops.h are no longer the kernel API
      functions, but instead the arch_ prefixed functions, which are then
      instrumented via bitops-instrumented.h.
      
      Other architectures can similarly add support for asm implementations of
      bitops.
      
      The documentation text was derived from x86 and existing bitops
      asm-generic versions: 1) references to x86 have been removed; 2) as a
      result, some of the text had to be reworded for clarity and consistency.
      
      Tested using lib/test_kasan with bitops tests (pre-requisite patch).
      Bugzilla ref: https://bugzilla.kernel.org/show_bug.cgi?id=198439
      
      Link: http://lkml.kernel.org/r/20190613125950.197667-4-elver@google.comSigned-off-by: NMarco Elver <elver@google.com>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      751ad98d
  20. 09 7月, 2019 1 次提交
  21. 01 7月, 2019 1 次提交
  22. 27 6月, 2019 1 次提交
  23. 24 6月, 2019 2 次提交
  24. 23 6月, 2019 1 次提交
  25. 19 6月, 2019 1 次提交
  26. 08 6月, 2019 1 次提交
    • S
      parisc: add dynamic ftrace · 6ca63662
      Sven Schnelle 提交于
      This patch implements dynamic ftrace for PA-RISC. The required mcount
      call sequences can get pretty long, so instead of patching the
      whole call sequence out of the functions, we are using
      -fpatchable-function-entry from gcc. This puts a configurable amount of
      NOPS before/at the start of the function. Taking do_sys_open() as example,
      which would look like this when the call is patched out:
      
      1036b248:       08 00 02 40     nop
      1036b24c:       08 00 02 40     nop
      1036b250:       08 00 02 40     nop
      1036b254:       08 00 02 40     nop
      
      1036b258 <do_sys_open>:
      1036b258:       08 00 02 40     nop
      1036b25c:       08 03 02 41     copy r3,r1
      1036b260:       6b c2 3f d9     stw rp,-14(sp)
      1036b264:       08 1e 02 43     copy sp,r3
      1036b268:       6f c1 01 00     stw,ma r1,80(sp)
      
      When ftrace gets enabled for this function the kernel will patch these
      NOPs to:
      
      1036b248:       10 19 57 20     <address of ftrace>
      1036b24c:       6f c1 00 80     stw,ma r1,40(sp)
      1036b250:       48 21 3f d1     ldw -18(r1),r1
      1036b254:       e8 20 c0 02     bv,n r0(r1)
      
      1036b258 <do_sys_open>:
      1036b258:       e8 3f 1f df     b,l,n .-c,r1
      1036b25c:       08 03 02 41     copy r3,r1
      1036b260:       6b c2 3f d9     stw rp,-14(sp)
      1036b264:       08 1e 02 43     copy sp,r3
      1036b268:       6f c1 01 00     stw,ma r1,80(sp)
      
      So the first NOP in do_sys_open() will be patched to jump backwards into
      some minimal trampoline code which pushes a stackframe, saves r1 which
      holds the return address, loads the address of the real ftrace function,
      and branches to that location. For 64 Bit things are getting a bit more
      complicated (and longer) because we must make sure that the address of
      ftrace location is 8 byte aligned, and the offset passed to ldd for
      fetching the address is 8 byte aligned as well.
      
      Note that gcc has a bug which misplaces the function label, and needs a
      patch to make dynamic ftrace work. See
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90751 for details.
      Signed-off-by: NSven Schnelle <svens@stackframe.org>
      Signed-off-by: NHelge Deller <deller@gmx.de>
      6ca63662
  27. 05 6月, 2019 1 次提交