Skip to content
Snippets Groups Projects
  1. Dec 05, 2024
  2. Jun 18, 2024
  3. Mar 06, 2024
    • Peter Xu's avatar
      mm/treewide: replace pud_large() with pud_leaf() · 0a845e0f
      Peter Xu authored
      pud_large() is always defined as pud_leaf().  Merge their usages.  Chose
      pud_leaf() because pud_leaf() is a global API, while pud_large() is not.
      
      Link: https://lkml.kernel.org/r/20240305043750.93762-9-peterx@redhat.com
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Muchun Song <muchun.song@linux.dev>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Yang Shi <shy828301@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      0a845e0f
    • Peter Xu's avatar
      mm/treewide: replace pmd_large() with pmd_leaf() · 2f709f7b
      Peter Xu authored
      pmd_large() is always defined as pmd_leaf().  Merge their usages.  Chose
      pmd_leaf() because pmd_leaf() is a global API, while pmd_large() is not.
      
      Link: https://lkml.kernel.org/r/20240305043750.93762-8-peterx@redhat.com
      
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Reviewed-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Muchun Song <muchun.song@linux.dev>
      Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Yang Shi <shy828301@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      2f709f7b
  4. Sep 19, 2023
  5. Aug 30, 2023
    • Heiko Carstens's avatar
      s390/set_memory: add __set_memory() variant · 850612c8
      Heiko Carstens authored
      
      Add a __set_memory_yy() variant for all set_memory_yy()
      implementations. The new variant takes start and end void pointers,
      which allows them to be used without the usual unsigned long cast.
      
      However more important: the new variant can be used for areas larger
      than 8TB. The old variant comes with an "int numpages" parameter, which
      overflows with more than 8TB. Given that for debug_pagealloc
      set_memory_4k() is used on the whole kernel mapping this is not only a
      theoretical problem, but must be fixed.
      
      Changing all set_memory_yy() variants only on s390 to take an "unsigned
      long numpages" parameter is not possible, since the common module code
      requires an int parameter from all architectures on these functions.
      See module_set_memory().
      
      Therefore change/fix this on s390 only with a new interface, and address
      common code later.
      
      Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      850612c8
  6. Jul 11, 2023
    • Rick Edgecombe's avatar
      mm: Move pte/pmd_mkwrite() callers with no VMA to _novma() · 6ecc21bb
      Rick Edgecombe authored
      
      The x86 Shadow stack feature includes a new type of memory called shadow
      stack. This shadow stack memory has some unusual properties, which requires
      some core mm changes to function properly.
      
      One of these unusual properties is that shadow stack memory is writable,
      but only in limited ways. These limits are applied via a specific PTE
      bit combination. Nevertheless, the memory is writable, and core mm code
      will need to apply the writable permissions in the typical paths that
      call pte_mkwrite(). Future patches will make pte_mkwrite() take a VMA, so
      that the x86 implementation of it can know whether to create regular
      writable or shadow stack mappings.
      
      But there are a couple of challenges to this. Modifying the signatures of
      each arch pte_mkwrite() implementation would be error prone because some
      are generated with macros and would need to be re-implemented. Also, some
      pte_mkwrite() callers operate on kernel memory without a VMA.
      
      So this can be done in a three step process. First pte_mkwrite() can be
      renamed to pte_mkwrite_novma() in each arch, with a generic pte_mkwrite()
      added that just calls pte_mkwrite_novma(). Next callers without a VMA can
      be moved to pte_mkwrite_novma(). And lastly, pte_mkwrite() and all callers
      can be changed to take/pass a VMA.
      
      Earlier work did the first step, so next move the callers that don't have
      a VMA to pte_mkwrite_novma(). Also do the same for pmd_mkwrite().  This
      will be ok for the shadow stack feature, as these callers are on kernel
      memory which will not need to be made shadow stack, and the other
      architectures only currently support one type of memory in pte_mkwrite()
      
      Signed-off-by: default avatarRick Edgecombe <rick.p.edgecombe@intel.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/all/20230613001108.3040476-3-rick.p.edgecombe%40intel.com
      6ecc21bb
  7. May 17, 2023
  8. Apr 20, 2023
    • Heiko Carstens's avatar
      s390/mm: use VM_FLUSH_RESET_PERMS in module_alloc() · 34e4c79f
      Heiko Carstens authored
      
      Make use of the set_direct_map() calls for module allocations.
      In particular:
      
      - All changes to read-only permissions in kernel VA mappings are also
        applied to the direct mapping. Note that execute permissions are
        intentionally not applied to the direct mapping in order to make
        sure that all allocated pages within the direct mapping stay
        non-executable
      
      - module_alloc() passes the VM_FLUSH_RESET_PERMS to __vmalloc_node_range()
        to make sure that all implicit permission changes made to the direct
        mapping are reset when the allocated vm area is freed again
      
      Side effects: the direct mapping will be fragmented depending on how many
      vm areas with VM_FLUSH_RESET_PERMS and/or explicit page permission changes
      are allocated and freed again.
      
      For example, just after boot of a system the direct mapping statistics look
      like:
      
      $cat /proc/meminfo
      ...
      DirectMap4k:      111628 kB
      DirectMap1M:    16665600 kB
      DirectMap2G:           0 kB
      
      Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      34e4c79f
    • Heiko Carstens's avatar
      s390/mm: enable ARCH_HAS_SET_DIRECT_MAP · 0490d6d7
      Heiko Carstens authored
      
      Implement the set_direct_map_*() API, which allows to invalidate and set
      default permissions to pages within the direct mapping.
      
      Note that kernel_page_present(), which is also supposed to be part of this
      API, is intentionally not implemented. The reason for this is that
      kernel_page_present() is only used (and currently only makes sense) for
      suspend/resume, which isn't supported on s390.
      
      Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      0490d6d7
  9. Apr 13, 2023
  10. Mar 20, 2023
  11. Mar 01, 2022
  12. Oct 26, 2021
  13. Aug 25, 2021
    • Heiko Carstens's avatar
      s390/mm,pageattr: fix walk_pte_level() early exit · c4f0e5cf
      Heiko Carstens authored
      
      In case of splitting to 4k mapping the early exit in walk_pte_level()
      must only be taken iff flags is equal to SET_MEMORY_4K.
      Currently the early exit is taken if the flag is set, and also others
      might be set. This may lead to the situation that a mapping is split
      but other changes are not done, like e.g. setting pages to R/W.
      
      There is currently no such caller, but there might be in the future.
      
      Fixes: b3e1a00c ("s390/mm: implement set_memory_4k()")
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      c4f0e5cf
  14. Aug 05, 2021
  15. Jul 30, 2021
  16. Sep 14, 2020
  17. Jun 09, 2020
    • Mike Rapoport's avatar
      mm: consolidate pte_index() and pte_offset_*() definitions · 974b9b2c
      Mike Rapoport authored
      All architectures define pte_index() as
      
      	(address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)
      
      and all architectures define pte_offset_kernel() as an entry in the array
      of PTEs indexed by the pte_index().
      
      For the most architectures the pte_offset_kernel() implementation relies
      on the availability of pmd_page_vaddr() that converts a PMD entry value to
      the virtual address of the page containing PTEs array.
      
      Let's move x86 definitions of the PTE accessors to the generic place in
      <linux/pgtable.h> and then simply drop the respective definitions from the
      other architectures.
      
      The architectures that didn't provide pmd_page_vaddr() are updated to have
      that defined.
      
      The generic implementation of pte_offset_kernel() can be overridden by an
      architecture and alpha makes use of this because it has special ordering
      requirements for its version of pte_offset_kernel().
      
      [rppt@linux.ibm.com: v2]
        Link: http://lkml.kernel.org/r/20200514170327.31389-11-rppt@kernel.org
      [rppt@linux.ibm.com: update]
        Link: http://lkml.kernel.org/r/20200514170327.31389-12-rppt@kernel.org
      [rppt@linux.ibm.com: update]
        Link: http://lkml.kernel.org/r/20200514170327.31389-13-rppt@kernel.org
      [akpm@linux-foundation.org: fix x86 warning]
      [sfr@canb.auug.org.au: fix powerpc build]
        Link: http://lkml.kernel.org/r/20200607153443.GB738695@linux.ibm.com
      
      
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200514170327.31389-10-rppt@kernel.org
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      974b9b2c
    • Mike Rapoport's avatar
      mm: pgtable: add shortcuts for accessing kernel PMD and PTE · e05c7b1f
      Mike Rapoport authored
      The powerpc 32-bit implementation of pgtable has nice shortcuts for
      accessing kernel PMD and PTE for a given virtual address.  Make these
      helpers available for all architectures.
      
      [rppt@linux.ibm.com: microblaze: fix page table traversal in setup_rt_frame()]
        Link: http://lkml.kernel.org/r/20200518191511.GD1118872@kernel.org
      
      
      [akpm@linux-foundation.org: s/pmd_ptr_k/pmd_off_k/ in various powerpc places]
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200514170327.31389-9-rppt@kernel.org
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e05c7b1f
    • Mike Rapoport's avatar
      mm: don't include asm/pgtable.h if linux/mm.h is already included · e31cf2f4
      Mike Rapoport authored
      
      Patch series "mm: consolidate definitions of page table accessors", v2.
      
      The low level page table accessors (pXY_index(), pXY_offset()) are
      duplicated across all architectures and sometimes more than once.  For
      instance, we have 31 definition of pgd_offset() for 25 supported
      architectures.
      
      Most of these definitions are actually identical and typically it boils
      down to, e.g.
      
      static inline unsigned long pmd_index(unsigned long address)
      {
              return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
      }
      
      static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
      {
              return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
      }
      
      These definitions can be shared among 90% of the arches provided
      XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.
      
      For architectures that really need a custom version there is always
      possibility to override the generic version with the usual ifdefs magic.
      
      These patches introduce include/linux/pgtable.h that replaces
      include/asm-generic/pgtable.h and add the definitions of the page table
      accessors to the new header.
      
      This patch (of 12):
      
      The linux/mm.h header includes <asm/pgtable.h> to allow inlining of the
      functions involving page table manipulations, e.g.  pte_alloc() and
      pmd_alloc().  So, there is no point to explicitly include <asm/pgtable.h>
      in the files that include <linux/mm.h>.
      
      The include statements in such cases are remove with a simple loop:
      
      	for f in $(git grep -l "include <linux/mm.h>") ; do
      		sed -i -e '/include <asm\/pgtable.h>/ d' $f
      	done
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Cain <bcain@codeaurora.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Greg Ungerer <gerg@linux-m68k.org>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ley Foon Tan <ley.foon.tan@intel.com>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Nick Hu <nickhu@andestech.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
      Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
      
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e31cf2f4
  18. Mar 23, 2020
  19. Jul 30, 2018
  20. Nov 02, 2017
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  21. Jul 26, 2017
  22. Jul 25, 2017
  23. Jun 12, 2017
  24. May 09, 2017
  25. Apr 26, 2017
  26. Feb 17, 2017
    • Paul Gortmaker's avatar
      s390: mm: Audit and remove any unnecessary uses of module.h · ff24b07a
      Paul Gortmaker authored
      
      Historically a lot of these existed because we did not have
      a distinction between what was modular code and what was providing
      support to modules via EXPORT_SYMBOL and friends.  That changed
      when we forked out support for the latter into the export.h file.
      
      This means we should be able to reduce the usage of module.h
      in code that is obj-y Makefile or bool Kconfig.  The advantage
      in doing so is that module.h itself sources about 15 other headers;
      adding significantly to what we feed cpp, and it can obscure what
      headers we are effectively using.
      
      Since module.h was the source for init.h (for __init) and for
      export.h (for EXPORT_SYMBOL) we consider each change instance
      for the presence of either and replace as needed.  An instance
      where module_param was used without moduleparam.h was also fixed,
      as well as an implict use of asm/elf.h header.
      
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      ff24b07a
  27. Feb 08, 2017
    • Martin Schwidefsky's avatar
      s390: add no-execute support · 57d7f939
      Martin Schwidefsky authored
      
      Bit 0x100 of a page table, segment table of region table entry
      can be used to disallow code execution for the virtual addresses
      associated with the entry.
      
      There is one tricky bit, the system call to return from a signal
      is part of the signal frame written to the user stack. With a
      non-executable stack this would stop working. To avoid breaking
      things the protection fault handler checks the opcode that caused
      the fault for 0x0a77 (sys_sigreturn) and 0x0aad (sys_rt_sigreturn)
      and injects a system call. This is preferable to the alternative
      solution with a stub function in the vdso because it works for
      vdso=off and statically linked binaries as well.
      
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      57d7f939
  28. Aug 24, 2016
  29. Aug 10, 2016
    • Heiko Carstens's avatar
      s390/pageattr: handle numpages parameter correctly · 4d81aaa5
      Heiko Carstens authored
      
      Both set_memory_ro() and set_memory_rw() will modify the page
      attributes of at least one page, even if the numpages parameter is
      zero.
      
      The author expected that calling these functions with numpages == zero
      would never happen. However with the new 444d13ff ("modules: add
      ro_after_init support") feature this happens frequently.
      
      Therefore do the right thing and make these two functions return
      gracefully if nothing should be done.
      
      Fixes crashes on module load like this one:
      
      Unable to handle kernel pointer dereference in virtual kernel address space
      Failing address: 000003ff80008000 TEID: 000003ff80008407
      Fault in home space mode while using kernel ASCE.
      AS:0000000000d18007 R3:00000001e6aa4007 S:00000001e6a10800 P:00000001e34ee21d
      Oops: 0004 ilc:3 [#1] SMP
      Modules linked in: x_tables
      CPU: 10 PID: 1 Comm: systemd Not tainted 4.7.0-11895-g3fa9045 #4
      Hardware name: IBM              2964 N96              703              (LPAR)
      task: 00000001e9118000 task.stack: 00000001e9120000
      Krnl PSW : 0704e00180000000 00000000005677f8 (rb_erase+0xf0/0x4d0)
                 R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3
      Krnl GPRS: 000003ff80008b20 000003ff80008b20 000003ff80008b70 0000000000b9d608
                 000003ff80008b20 0000000000000000 00000001e9123e88 000003ff80008950
                 00000001e485ab40 000003ff00000000 000003ff80008b00 00000001e4858480
                 0000000100000000 000003ff80008b68 00000000001d5998 00000001e9123c28
      Krnl Code: 00000000005677e8: ec1801c3007c        cgij    %r1,0,8,567b6e
                 00000000005677ee: e32010100020        cg      %r2,16(%r1)
                #00000000005677f4: a78401c2            brc     8,567b78
                >00000000005677f8: e35010080024        stg     %r5,8(%r1)
                 00000000005677fe: ec5801af007c        cgij    %r5,0,8,567b5c
                 0000000000567804: e30050000024        stg     %r0,0(%r5)
                 000000000056780a: ebacf0680004        lmg     %r10,%r12,104(%r15)
                 0000000000567810: 07fe                bcr     15,%r14
      Call Trace:
      ([<000003ff80008900>] __this_module+0x0/0xffffffffffffd700 [x_tables])
      ([<0000000000264fd4>] do_init_module+0x12c/0x220)
      ([<00000000001da14a>] load_module+0x24e2/0x2b10)
      ([<00000000001da976>] SyS_finit_module+0xbe/0xd8)
      ([<0000000000803b26>] system_call+0xd6/0x264)
      Last Breaking-Event-Address:
       [<000000000056771a>] rb_erase+0x12/0x4d0
       Kernel panic - not syncing: Fatal exception: panic_on_oops
      
      Reported-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Reported-and-tested-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
      Fixes: e8a97e42 ("s390/pageattr: allow kernel page table splitting")
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      4d81aaa5
  30. Jun 14, 2016
    • Heiko Carstens's avatar
      s390/mm: fix compile for PAGE_DEFAULT_KEY != 0 · de3fa841
      Heiko Carstens authored
      
      The usual problem for code that is ifdef'ed out is that it doesn't
      compile after a while. That's also the case for the storage key
      initialisation code, if it would be used (set PAGE_DEFAULT_KEY to
      something not zero):
      
      ./arch/s390/include/asm/page.h: In function 'storage_key_init_range':
      ./arch/s390/include/asm/page.h:36:2: error: implicit declaration of function '__storage_key_init_range'
      
      Since the code itself has been useful for debugging purposes several
      times, remove the ifdefs and make sure the code gets compiler
      coverage. The cost for this is eight bytes.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      de3fa841
  31. Jun 13, 2016
    • Heiko Carstens's avatar
      s390/pgtable: add mapping statistics · 37cd944c
      Heiko Carstens authored
      
      Add statistics that show how memory is mapped within the kernel
      identity mapping. This is more or less the same like git
      commit ce0c0e50 ("x86, generic: CPA add statistics about state
      of direct mapping v4") for x86.
      
      I also intentionally copied the lower case "k" within DirectMap4k vs
      the upper case "M" and "G" within the two other lines. Let's have
      consistent inconsistencies across architectures.
      
      The output of /proc/meminfo now contains these additional lines:
      
      DirectMap4k:        2048 kB
      DirectMap1M:     3991552 kB
      DirectMap2G:     4194304 kB
      
      The implementation on s390 is lockless unlike the x86 version, since I
      assume changes to the kernel mapping are a very rare event. Therefore
      it really doesn't matter if these statistics could potentially be
      inconsistent if read while kernel pages tables are being changed.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      37cd944c
    • Heiko Carstens's avatar
      s390/pageattr: allow kernel page table splitting · e8a97e42
      Heiko Carstens authored
      
      set_memory_ro() and set_memory_rw() currently only work on 4k
      mappings, which is good enough for module code aka the vmalloc area.
      
      However we stumbled already twice into the need to make this also work
      on larger mappings:
      - the ro after init patch set
      - the crash kernel resize code
      
      Therefore this patch implements automatic kernel page table splitting
      if e.g. set_memory_ro() would be called on parts of a 2G mapping.
      This works quite the same as the x86 code, but is much simpler.
      
      In order to make this work and to be architecturally compliant we now
      always use the csp, cspg or crdte instructions to replace valid page
      table entries. This means that set_memory_ro() and set_memory_rw()
      will be much more expensive than before. In order to avoid huge
      latencies the code contains a couple of cond_resched() calls.
      
      The current code only splits page tables, but does not merge them if
      it would be possible.  The reason for this is that currently there is
      no real life scenarion where this would really happen. All current use
      cases that I know of only change access rights once during the life
      time. If that should change we can still implement kernel page table
      merging at a later time.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      e8a97e42
    • Heiko Carstens's avatar
      s390/mm: always use PAGE_KERNEL when mapping pages · 3e76ee99
      Heiko Carstens authored
      
      Always use PAGE_KERNEL when re-enabling pages within the kernel
      mapping due to debug pagealloc. Without using this pgprot value
      pte_mkwrite() and pte_wrprotect() won't work on such mappings after an
      unmap -> map cycle anymore.
      
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      3e76ee99
Loading