1. 14 Jan, 2021 3 commits
  2. 12 Jan, 2021 37 commits
    • Martin Kepplinger's avatar
      arm64: dts: imx8mq-librem5: set regulators boot-on · 6b506c4c
      Martin Kepplinger authored
      
      
      Expect all those regulators to be turned on initially.
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      6b506c4c
    • Martin Kepplinger's avatar
      arm64: dts: imx8mq-librem5: enable the LCD panel · e2449a7d
      Martin Kepplinger authored
      
      
      This enables the Librem5's ft8006p based LCD panel driven by the
      imx8mq's Northwest Logic DSI IP core and mxsfb display controller.
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      e2449a7d
    • Guido Gunther's avatar
      arm64: dts: imx8mq-librem5: Add LCD_1V8 regulator · f3052a40
      Guido Gunther authored
      
      
      It's a supply for to touch and LCD.
      Signed-off-by: Guido Gunther's avatarGuido Günther <agx@sigxcpu.org>
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      f3052a40
    • Guido Gunther's avatar
      arm64: dts: imx8mq-librem5: Add usb-c chip as supplier for the charger · 9926e93a
      Guido Gunther authored
      
      
      The tps65982 feeds the bq25895 charge controller on the Librem 5.
      Signed-off-by: Guido Gunther's avatarGuido Günther <agx@sigxcpu.org>
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      9926e93a
    • Guido Gunther's avatar
      arm64: dts: imx8mq-librem5: Don't mark buck3 as always on · 7a147cd9
      Guido Gunther authored
      
      
      With the pmic driver fixed we can now shut off the regulator in the gpc.
      Signed-off-by: Guido Gunther's avatarGuido Günther <agx@sigxcpu.org>
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      7a147cd9
    • Guido Gunther's avatar
      arm64: dts: imx8mq-librem5: Mark charger IRQ as High-Z · 4b10dbc2
      Guido Gunther authored
      
      
      This is consistent with other IRQs and makes keeps currents low.
      Signed-off-by: Guido Gunther's avatarGuido Günther <agx@sigxcpu.org>
      Signed-off-by: Martin Kepplinger's avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      4b10dbc2
    • Guido Gunther's avatar
      fixup! Add gitlab-ci · 83541459
      Guido Gunther authored
      83541459
    • Guido Gunther's avatar
      arm64: defconfig: Enable more DM/MD targets · 0ceff24f
      Guido Gunther authored
      
      
      Most notably DM_CRYPT for disk encryption but things like snapshot, etc.
      are useful on embedded as well and the others make sense on arm64
      servers.
      Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
      0ceff24f
    • Guido Gunther's avatar
      arm54: defconfig: Enable apparmor · 3de4654a
      Guido Gunther authored
      
      
      Many distributions ship that by default.
      Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
      3de4654a
    • Guido Gunther's avatar
      b8dcfd59
    • Guido Gunther's avatar
      arm64: defconfig: Enable vibra-pwm · 3420704f
      Guido Gunther authored
      
      
      Haptic motor for the Librem 5
      Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
      3420704f
    • Guido Gunther's avatar
      9b43dd0d
    • Guido Gunther's avatar
      8fbc5d83
    • Guido Gunther's avatar
      arm64: defconfig: Enable BPF and CGROUP netfilter matcheso · ed216d61
      Guido Gunther authored
      
      
      systemd can use this and complaines like
      
          File /lib/systemd/system/systemd-hostnamed.service:9 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling
      
      if not there.
      Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
      ed216d61
    • Angus Ainslie (Purism)'s avatar
      Add gitlab-ci · ad36566d
      Angus Ainslie (Purism) authored
      ad36566d
    • Stephen Rothwell's avatar
      df869cab
    • Stephen Rothwell's avatar
      Merge branch 'akpm/master' · e3f8c10f
      Stephen Rothwell authored
      e3f8c10f
    • John Hubbard's avatar
      secretmem-test-add-basic-selftest-for-memfd_secret2-fix · ee7113e7
      John Hubbard authored
      fix build
      
      Link: https://lkml.kernel.org/r/248f928b-1383-48ea-8584-ec10146e60c9@nvidia.com
      
      
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      ee7113e7
    • Mike Rapoport's avatar
      secretmem: test: add basic selftest for memfd_secret(2) · 213fc23f
      Mike Rapoport authored
      The test verifies that file descriptor created with memfd_secret does
      not allow read/write operations, that secret memory mappings respect
      RLIMIT_MEMLOCK and that remote accesses with process_vm_read() and
      ptrace() to the secret memory fail.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-11-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      213fc23f
    • Stephen Rothwell's avatar
    • Andrew Morton's avatar
      arch-mm-wire-up-memfd_secret-system-call-were-relevant-fix · 5160ac6f
      Andrew Morton authored
      
      
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Mike Rapoport <rppt@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      5160ac6f
    • Mike Rapoport's avatar
      arch, mm: wire up memfd_secret system call where relevant · c4fdacd2
      Mike Rapoport authored
      Wire up memfd_secret system call on architectures that define
      ARCH_HAS_SET_DIRECT_MAP, namely arm64, risc-v and x86.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-10-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      c4fdacd2
    • Mike Rapoport's avatar
      PM: hibernate: disable when there are active secretmem users · b5540b77
      Mike Rapoport authored
      It is unsafe to allow saving of secretmem areas to the hibernation snapshot
      as they would be visible after the resume and this essentially will defeat
      the purpose of secret memory mappings.
      
      Prevent hibernation whenever there are active secret memory users.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-9-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      b5540b77
    • Mike Rapoport's avatar
      secretmem: add memcg accounting · 4f64833e
      Mike Rapoport authored
      Account memory consumed by secretmem to memcg. The accounting is updated
      when the memory is actually allocated and freed.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-8-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      4f64833e
    • Mike Rapoport's avatar
      secretmem: use PMD-size pages to amortize direct map fragmentation · ffb5f9e0
      Mike Rapoport authored
      Removing a PAGE_SIZE page from the direct map every time such page is
      allocated for a secret memory mapping will cause severe fragmentation of
      the direct map. This fragmentation can be reduced by using PMD-size pages
      as a pool for small pages for secret memory mappings.
      
      Add a gen_pool per secretmem inode and lazily populate this pool with
      PMD-size pages.
      
      As pages allocated by secretmem become unmovable, use CMA to back large
      page caches so that page allocator won't be surprised by failing attempt to
      migrate these pages.
      
      The CMA area used by secretmem is controlled by the "secretmem=" kernel
      parameter. This allows explicit control over the memory available for
      secretmem and provides upper hard limit for secretmem consumption.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-7-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      ffb5f9e0
    • Mike Rapoport's avatar
      mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas-fix · 3867cb6a
      Mike Rapoport authored
      restore original white space
      
      Link: https://lkml.kernel.org/r/20201220060536.GB392333@linux.ibm.com
      
      
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      3867cb6a
    • Mike Rapoport's avatar
      mm: introduce memfd_secret system call to create "secret" memory areas · e6476a5a
      Mike Rapoport authored
      Introduce "memfd_secret" system call with the ability to create memory
      areas visible only in the context of the owning process and not mapped not
      only to other processes but in the kernel page tables as well.
      
      The user will create a file descriptor using the memfd_secret() system
      call. The memory areas created by mmap() calls from this file descriptor
      will be unmapped from the kernel direct map and they will be only mapped in
      the page table of the owning mm.
      
      The secret memory remains accessible in the process context using uaccess
      primitives, but it is not accessible using direct/linear map addresses.
      
      Functions in the follow_page()/get_user_page() family will refuse to return
      a page that belongs to the secret memory area.
      
      A page that was a part of the secret memory area is cleared when it is
      freed.
      
      The following example demonstrates creation of a secret mapping (error
      handling is omitted):
      
      	fd = memfd_secret(0);
      	ftruncate(fd, MAP_SIZE);
      	ptr = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-6-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: default avatarHagen Paul Pfeifer <hagen@jauu.net>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      e6476a5a
    • Anders Roxell's avatar
      kfence: fix implicit function declaration · 9f6ddaea
      Anders Roxell authored
      When building kfence the following error shows up:
      
      In file included from mm/kfence/report.c:13:
      arch/arm64/include/asm/kfence.h: In function `kfence_protect_page':
      arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function `set_memory_valid' [-Werror=implicit-function-declaration]
         12 |  set_memory_valid(addr, 1, !protect);
            |  ^~~~~~~~~~~~~~~~
      
      Use the correct include both
      f2b7c491916d ("set_memory: allow querying whether set_direct_map_*() is actually enabled")
      and 4c4c75881536 ("arm64, kfence: enable KFENCE for ARM64") went in the
      same day via different trees.
      
      Link: https://lkml.kernel.org/r/20201204121804.1532849-1-anders.roxell@linaro.org
      
      Signed-off-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
      Cc: Marco Elver <elver@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      9f6ddaea
    • Mike Rapoport's avatar
      set_memory: allow querying whether set_direct_map_*() is actually enabled · a5e6a1e9
      Mike Rapoport authored
      On arm64, set_direct_map_*() functions may return 0 without actually
      changing the linear map. This behaviour can be controlled using kernel
      parameters, so we need a way to determine at runtime whether calls to
      set_direct_map_invalid_noflush() and set_direct_map_default_noflush() have
      any effect.
      
      Extend set_memory API with can_set_direct_map() function that allows
      checking if calling set_direct_map_*() will actually change the page table,
      replace several occurrences of open coded checks in arm64 with the new
      function and provide a generic stub for architectures that always modify
      page tables upon calls to set_direct_map APIs.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-5-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      a5e6a1e9
    • Andrew Morton's avatar
      set_memory-allow-set_direct_map__noflush-for-multiple-pages-fix · 1334ec75
      Andrew Morton authored
      
      
      fix kernel/power/snapshot.c
      
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      1334ec75
    • Mike Rapoport's avatar
      set_memory: allow set_direct_map_*_noflush() for multiple pages · beee7cc0
      Mike Rapoport authored
      The underlying implementations of set_direct_map_invalid_noflush() and
      set_direct_map_default_noflush() allow updating multiple contiguous pages
      at once.
      
      Add numpages parameter to set_direct_map_*_noflush() to expose this ability
      with these APIs.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-4-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Acked-by: Catalin Marinas <catalin.marinas@arm.com>	[arm64]
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      beee7cc0
    • Mike Rapoport's avatar
      mmap: make mlock_future_check() global · 8af1bcfe
      Mike Rapoport authored
      It will be used by the upcoming secret memory implementation.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-3-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      8af1bcfe
    • Mike Rapoport's avatar
      mm: add definition of PMD_PAGE_ORDER · 66c7b0ba
      Mike Rapoport authored
      Patch series "mm: introduce memfd_secret system call to create "secret" memory areas", v14.
      
      This is an implementation of "secret" mappings backed by a file descriptor.
      
      The file descriptor backing secret memory mappings is created using a
      dedicated memfd_secret system call The desired protection mode for the
      memory is configured using flags parameter of the system call.  The mmap()
      of the file descriptor created with memfd_secret() will create a "secret"
      memory mapping.  The pages in that mapping will be marked as not present
      in the direct map and will be present only in the page table of the owning
      mm.
      
      Although normally Linux userspace mappings are protected from other users,
      such secret mappings are useful for environments where a hostile tenant is
      trying to trick the kernel into giving them access to other tenants
      mappings.
      
      Additionally, in the future the secret mappings may be used as a mean to
      protect guest memory in a virtual machine host.
      
      For demonstration of secret memory usage we've created a userspace library
      
      https://git.kernel.org/pub/scm/linux/kernel/git/jejb/secret-memory-preloader.git
      
      that does two things: the first is act as a preloader for openssl to
      redirect all the OPENSSL_malloc calls to secret memory meaning any secret
      keys get automatically protected this way and the other thing it does is
      expose the API to the user who needs it.  We anticipate that a lot of the
      use cases would be like the openssl one: many toolkits that deal with
      secret keys already have special handling for the memory to try to give
      them greater protection, so this would simply be pluggable into the
      toolkits without any need for user application modification.
      
      Hiding secret memory mappings behind an anonymous file allows (ab)use of
      the page cache for tracking pages allocated for the "secret" mappings as
      well as using address_space_operations for e.g.  page migration callbacks.
      
      The anonymous file may be also used implicitly, like hugetlb files, to
      implement mmap(MAP_SECRET) and use the secret memory areas with "native"
      mm ABIs in the future.
      
      To limit fragmentation of the direct map to splitting only PUD-size pages,
      I've added an amortizing cache of PMD-size pages to each file descriptor
      that is used as an allocation pool for the secret memory areas.
      
      As the memory allocated by secretmem becomes unmovable, we use CMA to back
      large page caches so that page allocator won't be surprised by failing
      attempt to migrate these pages.
      
      This patch (of 10):
      
      The definition of PMD_PAGE_ORDER denoting the number of base pages in the
      second-level leaf page is already used by DAX and maybe handy in other
      cases as well.
      
      Several architectures already have definition of PMD_ORDER as the size of
      second level page table, so to avoid conflict with these definitions use
      PMD_PAGE_ORDER name and update DAX respectively.
      
      Link: https://lkml.kernel.org/r/20201203062949.5484-1-rppt@kernel.org
      Link: https://lkml.kernel.org/r/20201203062949.5484-2-rppt@kernel.org
      
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christopher Lameter <cl@linux.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Elena Reshetova <elena.reshetova@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Bottomley <jejb@linux.ibm.com>
      Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Shakeel Butt <shakeelb@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tycho Andersen <tycho@tycho.ws>
      Cc: Will Deacon <will@kernel.org>
      Cc: Hagen Paul Pfeifer <hagen@jauu.net>
      Cc: Palmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      66c7b0ba
    • Stephen Rothwell's avatar
      Merge branch 'akpm-current/current' · 30b38549
      Stephen Rothwell authored
      30b38549
    • Stephen Rothwell's avatar
      Merge remote-tracking branch 'notifications/notifications-pipe-core' · 0eefb080
      Stephen Rothwell authored
      # Conflicts:
      #	arch/alpha/kernel/syscalls/syscall.tbl
      #	arch/arm/tools/syscall.tbl
      #	arch/arm64/include/asm/unistd.h
      #	arch/arm64/include/asm/unistd32.h
      #	arch/ia64/kernel/syscalls/syscall.tbl
      #	arch/m68k/kernel/syscalls/syscall.tbl
      #	arch/microblaze/kernel/syscalls/syscall.tbl
      #	arch/mips/kernel/syscalls/syscall_n32.tbl
      #	arch/mips/kernel/syscalls/syscall_n64.tbl
      #	arch/mips/kernel/syscalls/syscall_o32.tbl
      #	arch/parisc/kernel/syscalls/syscall.tbl
      #	arch/powerpc/kernel/syscalls/syscall.tbl
      #	arch/s390/kernel/syscalls/syscall.tbl
      #	arch/sh/kernel/syscalls/syscall.tbl
      #	arch/sparc/kernel/syscalls/syscall.tbl
      #	arch/x86/entry/syscalls/syscall_32.tbl
      #	arch/x86/entry/syscalls/syscall_64.tbl
      #	arch/xtensa/kernel/syscalls/syscall.tbl
      #	include/uapi/asm-generic/unistd.h
      0eefb080
    • Stephen Rothwell's avatar
      5fdcde87
    • Stephen Rothwell's avatar
      3c1e6a5f