Skip to content
Snippets Groups Projects
  1. Jul 06, 2023
  2. Jun 26, 2023
  3. Jun 21, 2023
  4. Jun 14, 2023
    • Eric Biggers's avatar
      fsverity: rework fsverity_get_digest() again · 74836ecb
      Eric Biggers authored
      Address several issues with the calling convention and documentation of
      fsverity_get_digest():
      
      - Make it provide the hash algorithm as either a FS_VERITY_HASH_ALG_*
        value or HASH_ALGO_* value, at the caller's choice, rather than only a
        HASH_ALGO_* value as it did before.  This allows callers to work with
        the fsverity native algorithm numbers if they want to.  HASH_ALGO_* is
        what IMA uses, but other users (e.g. overlayfs) should use
        FS_VERITY_HASH_ALG_* to match fsverity-utils and the fsverity UAPI.
      
      - Make it return the digest size so that it doesn't need to be looked up
        separately.  Use the return value for this, since 0 works nicely for
        the "file doesn't have fsverity enabled" case.  This also makes it
        clear that no other errors are possible.
      
      - Rename the 'digest' parameter to 'raw_digest' and clearly document
        that it is only useful in combination with the algorithm ID.  This
        hopefully clears up a point of confusion.
      
      - Export it to modules, since overlayfs will need it for checking the
        fsverity digests of lowerdata files
        (https://lore.kernel.org/r/dd294a44e8f401e6b5140029d8355f88748cd8fd.1686565330.git.alexl@redhat.com).
      
      Acked-by: Mimi Zohar <zohar@linux.ibm.com> # for the IMA piece
      Link: https://lore.kernel.org/r/20230612190047.59755-1-ebiggers@kernel.org
      
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      74836ecb
  5. Jun 12, 2023
    • Mickaël Salaün's avatar
      hostfs: Fix ephemeral inodes · 74ce793b
      Mickaël Salaün authored
      
      hostfs creates a new inode for each opened or created file, which
      created useless inode allocations and forbade identifying a host file
      with a kernel inode.
      
      Fix this uncommon filesystem behavior by tying kernel inodes to host
      file's inode and device IDs.  Even if the host filesystem inodes may be
      recycled, this cannot happen while a file referencing it is opened,
      which is the case with hostfs.  It should be noted that hostfs inode IDs
      may not be unique for the same hostfs superblock because multiple host's
      (backed) superblocks may be used.
      
      Delete inodes when dropping them to force backed host's file descriptors
      closing.
      
      This enables to entirely remove ARCH_EPHEMERAL_INODES, and then makes
      Landlock fully supported by UML.  This is very useful for testing
      changes.
      
      These changes also factor out and simplify some helpers thanks to the
      new hostfs_inode_update() and the hostfs_iget() revamp: read_name(),
      hostfs_create(), hostfs_lookup(), hostfs_mknod(), and
      hostfs_fill_sb_common().
      
      A following commit with new Landlock tests check this new hostfs inode
      consistency.
      
      Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Acked-by: default avatarRichard Weinberger <richard@nod.at>
      Link: https://lore.kernel.org/r/20230612191430.339153-2-mic@digikod.net
      
      
      Signed-off-by: default avatarMickaël Salaün <mic@digikod.net>
      74ce793b
  6. Jun 09, 2023
    • Lorenzo Stoakes's avatar
      mm/gup: remove vmas parameter from get_user_pages_remote() · ca5e8632
      Lorenzo Stoakes authored
      The only instances of get_user_pages_remote() invocations which used the
      vmas parameter were for a single page which can instead simply look up the
      VMA directly. In particular:-
      
      - __update_ref_ctr() looked up the VMA but did nothing with it so we simply
        remove it.
      
      - __access_remote_vm() was already using vma_lookup() when the original
        lookup failed so by doing the lookup directly this also de-duplicates the
        code.
      
      We are able to perform these VMA operations as we already hold the
      mmap_lock in order to be able to call get_user_pages_remote().
      
      As part of this work we add get_user_page_vma_remote() which abstracts the
      VMA lookup, error handling and decrementing the page reference count should
      the VMA lookup fail.
      
      This forms part of a broader set of patches intended to eliminate the vmas
      parameter altogether.
      
      [akpm@linux-foundation.org: avoid passing NULL to PTR_ERR]
      Link: https://lkml.kernel.org/r/d20128c849ecdbf4dd01cc828fcec32127ed939a.1684350871.git.lstoakes@gmail.com
      
      
      Signed-off-by: default avatarLorenzo Stoakes <lstoakes@gmail.com>
      Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> (for arm64)
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: Janosch Frank <frankja@linux.ibm.com> (for s390)
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Christian König <christian.koenig@amd.com>
      Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jarkko Sakkinen <jarkko@kernel.org>
      Cc: Jason Gunthorpe <jgg@nvidia.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ca5e8632
  7. Jun 08, 2023
  8. Jun 06, 2023
  9. Jun 05, 2023
  10. Jun 02, 2023
    • Paul Moore's avatar
      selinux: fix Makefile for versions of make < v4.3 · ec4a491d
      Paul Moore authored
      
      As noted in the comments of this commit, the current SELinux Makefile
      requires features found in make v4.3 or later, which is problematic
      as the Linux Kernel currently only requires make v3.82.  This patch
      fixes the SELinux Makefile so that it works properly on these older
      versions of make, and adds a couple of comments to the Makefile about
      how it can be improved once make v4.3 is required by the kernel.
      
      Fixes: 6f933aa7 ("selinux: more Makefile tweaks")
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      ec4a491d
  11. Jun 01, 2023
  12. May 30, 2023
    • Ondrej Mosnacek's avatar
      selinux: make labeled NFS work when mounted before policy load · cec5fe70
      Ondrej Mosnacek authored
      
      Currently, when an NFS filesystem that supports passing LSM/SELinux
      labels is mounted during early boot (before the SELinux policy is
      loaded), it ends up mounted without the labeling support (i.e. with
      Fedora policy all files get the generic NFS label
      system_u:object_r:nfs_t:s0).
      
      This is because the information that the NFS mount supports passing
      labels (communicated to the LSM layer via the kern_flags argument of
      security_set_mnt_opts()) gets lost and when the policy is loaded the
      mount is initialized as if the passing is not supported.
      
      Fix this by noting the "native labeling" in newsbsec->flags (using a new
      SE_SBNATIVE flag) on the pre-policy-loaded call of
      selinux_set_mnt_opts() and then making sure it is respected on the
      second call from delayed_superblock_init().
      
      Additionally, make inode_doinit_with_dentry() initialize the inode's
      label from its extended attributes whenever it doesn't find it already
      intitialized by the filesystem. This is needed to properly initialize
      pre-existing inodes when delayed_superblock_init() is called. It should
      not trigger in any other cases (and if it does, it's still better to
      initialize the correct label instead of leaving the inode unlabeled).
      
      Fixes: eb9ae686 ("SELinux: Add new labeling type native labels")
      Tested-by: default avatarScott Mayhew <smayhew@redhat.com>
      Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
      [PM: fixed 'Fixes' tag format]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      cec5fe70
    • Xiu Jianfeng's avatar
      selinux: cleanup exit_sel_fs() declaration · 29cd55fe
      Xiu Jianfeng authored
      
      exit_sel_fs() has been removed since commit f22f9aaf ("selinux:
      remove the runtime disable functionality").
      
      Signed-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      29cd55fe
  13. May 25, 2023
  14. May 24, 2023
  15. May 23, 2023
  16. May 18, 2023
  17. May 11, 2023
    • Roberto Sassu's avatar
      smack: Record transmuting in smk_transmuted · 2c085f3a
      Roberto Sassu authored
      
      smack_dentry_create_files_as() determines whether transmuting should occur
      based on the label of the parent directory the new inode will be added to,
      and not the label of the directory where it is created.
      
      This helps for example to do transmuting on overlayfs, since the latter
      first creates the inode in the working directory, and then moves it to the
      correct destination.
      
      However, despite smack_dentry_create_files_as() provides the correct label,
      smack_inode_init_security() does not know from passed information whether
      or not transmuting occurred. Without this information,
      smack_inode_init_security() cannot set SMK_INODE_CHANGED in smk_flags,
      which will result in the SMACK64TRANSMUTE xattr not being set in
      smack_d_instantiate().
      
      Thus, add the smk_transmuted field to the task_smack structure, and set it
      in smack_dentry_create_files_as() to smk_task if transmuting occurred. If
      smk_task is equal to smk_transmuted in smack_inode_init_security(), act as
      if transmuting was successful but without taking the label from the parent
      directory (the inode label was already set correctly from the current
      credentials in smack_inode_alloc_security()).
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      2c085f3a
    • Roberto Sassu's avatar
      smack: Retrieve transmuting information in smack_inode_getsecurity() · 3a3d8fce
      Roberto Sassu authored
      
      Enhance smack_inode_getsecurity() to retrieve the value for
      SMACK64TRANSMUTE from the inode security blob, similarly to SMACK64.
      
      This helps to display accurate values in the situation where the security
      labels come from mount options and not from xattrs.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      3a3d8fce
  18. May 08, 2023
Loading