1. 22 Sep, 2020 2 commits
    • Eric Biggers's avatar
      ext4: factor out ext4_xattr_credits_for_new_inode() · 177cc0e7
      Eric Biggers authored
      To compute a new inode's xattr credits, we need to know whether the
      inode will be encrypted or not.  When we switch to use the new helper
      function fscrypt_prepare_new_inode(), we won't find out whether the
      inode will be encrypted until slightly later than is currently the case.
      That will require moving the code block that computes the xattr credits.
      
      To make this easier and reduce the length of __ext4_new_inode(), move
      this code block into a new function ext4_xattr_credits_for_new_inode().
      
      Link: https://lore.kernel.org/r/20200917041136.178600-3-ebiggers@kernel.orgSigned-off-by: default avatarEric Biggers <ebiggers@google.com>
      177cc0e7
    • Eric Biggers's avatar
      fscrypt: add fscrypt_prepare_new_inode() and fscrypt_set_context() · a992b20c
      Eric Biggers authored
      fscrypt_get_encryption_info() is intended to be GFP_NOFS-safe.  But
      actually it isn't, since it uses functions like crypto_alloc_skcipher()
      which aren't GFP_NOFS-safe, even when called under memalloc_nofs_save().
      Therefore it can deadlock when called from a context that needs
      GFP_NOFS, e.g. during an ext4 transaction or between f2fs_lock_op() and
      f2fs_unlock_op().  This happens when creating a new encrypted file.
      
      We can't fix this by just not setting up the key for new inodes right
      away, since new symlinks need their key to encrypt the symlink target.
      
      So we need to set up the new inode's key before starting the
      transaction.  But just calling fscrypt_get_encryption_info() earlier
      doesn't work, since it assumes the encryption context is already set,
      and the encryption context can't be set until the transaction.
      
      The recently proposed fscrypt support for the ceph filesystem
      (https://lkml.kernel.org/linux-fscrypt/20200821182813.52570-1-jlayton@kernel.org/T/#u)
      will have this same ordering problem too, since ceph will need to
      encrypt new symlinks before setting their encryption context.
      
      Finally, f2fs can deadlock when the filesystem is mounted with
      '-o test_dummy_encryption' and a new file is created in an existing
      unencrypted directory.  Similarly, this is caused by holding too many
      locks when calling fscrypt_get_encryption_info().
      
      To solve all these problems, add new helper functions:
      
      - fscrypt_prepare_new_inode() sets up a new inode's encryption key
        (fscrypt_info), using the parent directory's encryption policy and a
        new random nonce.  It neither reads nor writes the encryption context.
      
      - fscrypt_set_context() persists the encryption context of a new inode,
        using the information from the fscrypt_info already in memory.  This
        replaces fscrypt_inherit_context().
      
      Temporarily keep fscrypt_inherit_context() around until all filesystems
      have been converted to use fscrypt_set_context().
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Link: https://lore.kernel.org/r/20200917041136.178600-2-ebiggers@kernel.orgSigned-off-by: default avatarEric Biggers <ebiggers@google.com>
      a992b20c
  2. 07 Sep, 2020 3 commits
  3. 06 Sep, 2020 4 commits
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.9-2020-09-06' of git://git.kernel.dk/linux-block · a8205e31
      Linus Torvalds authored
      Pull more io_uring fixes from Jens Axboe:
       "Two followup fixes. One is fixing a regression from this merge window,
        the other is two commits fixing cancelation of deferred requests.
      
        Both have gone through full testing, and both spawned a few new
        regression test additions to liburing.
      
         - Don't play games with const, properly store the output iovec and
           assign it as needed.
      
         - Deferred request cancelation fix (Pavel)"
      
      * tag 'io_uring-5.9-2020-09-06' of git://git.kernel.dk/linux-block:
        io_uring: fix linked deferred ->files cancellation
        io_uring: fix cancel of deferred reqs with ->files
        io_uring: fix explicit async read/write mapping for large segments
      a8205e31
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 2ccdd9f8
      Linus Torvalds authored
      Pull iommu fixes from Joerg Roedel:
      
       - three Intel VT-d fixes to fix address handling on 32bit, fix a NULL
         pointer dereference bug and serialize a hardware register access as
         required by the VT-d spec.
      
       - two patches for AMD IOMMU to force AMD GPUs into translation mode
         when memory encryption is active and disallow using IOMMUv2
         functionality.  This makes the AMDGPU driver work when memory
         encryption is active.
      
       - two more fixes for AMD IOMMU to fix updating the Interrupt Remapping
         Table Entries.
      
       - MAINTAINERS file update for the Qualcom IOMMU driver.
      
      * tag 'iommu-fixes-v5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Handle 36bit addressing for x86-32
        iommu/amd: Do not use IOMMUv2 functionality when SME is active
        iommu/amd: Do not force direct mapping when SME is active
        iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE
        iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
        iommu/vt-d: Fix NULL pointer dereference in dev_iommu_priv_set()
        iommu/vt-d: Serialize IOMMU GCMD register modifications
        MAINTAINERS: Update QUALCOMM IOMMU after Arm SMMU drivers move
      2ccdd9f8
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-09-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 015b3155
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
      
       - more generic entry code ABI fallout
      
       - debug register handling bugfixes
      
       - fix vmalloc mappings on 32-bit kernels
      
       - kprobes instrumentation output fix on 32-bit kernels
      
       - fix over-eager WARN_ON_ONCE() on !SMAP hardware
      
       - NUMA debugging fix
      
       - fix Clang related crash on !RETPOLINE kernels
      
      * tag 'x86-urgent-2020-09-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/entry: Unbreak 32bit fast syscall
        x86/debug: Allow a single level of #DB recursion
        x86/entry: Fix AC assertion
        tracing/kprobes, x86/ptrace: Fix regs argument order for i386
        x86, fakenuma: Fix invalid starting node ID
        x86/mm/32: Bring back vmalloc faulting on x86_32
        x86/cmdline: Disable jump tables for cmdline.c
      015b3155
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.9-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 68beef57
      Linus Torvalds authored
      Pull xen updates from Juergen Gross:
       "A small series for fixing a problem with Xen PVH guests when running
        as backends (e.g. as dom0).
      
        Mapping other guests' memory is now working via ZONE_DEVICE, thus not
        requiring to abuse the memory hotplug functionality for that purpose"
      
      * tag 'for-linus-5.9-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen: add helpers to allocate unpopulated memory
        memremap: rename MEMORY_DEVICE_DEVDAX to MEMORY_DEVICE_GENERIC
        xen/balloon: add header guard
      68beef57
  4. 05 Sep, 2020 28 commits
  5. 04 Sep, 2020 3 commits