1. 12 Apr, 2024 1 commit
    • Enrico Bravi's avatar
      ima: add crypto agility support for template-hash algorithm · 9fa8e762
      Enrico Bravi authored
      The template hash showed by the ascii_runtime_measurements and
      binary_runtime_measurements is the one calculated using sha1 and there is
      no possibility to change this value, despite the fact that the template
      hash is calculated using the hash algorithms corresponding to all the PCR
      banks configured in the TPM.
      
      Add the support to retrieve the ima log with the template data hash
      calculated with a specific hash algorithm.
      Add a new file in the securityfs ima directory for each hash algo
      configured in a PCR bank of the TPM. Each new file has the name with
      the following structure:
      
              {binary, ascii}_runtime_measurements_<hash_algo_name>
      
      Legacy files are kept, to avoid breaking existing applications, but as
      symbolic links which point to {binary, ascii}_runtime_measurements_sha1
      files. These two files are created even if a TPM chip is not detected or
      the sha1 bank is not configured in the TPM.
      
      As example, in the case a TPM chip is present and sha256 is the only
      configured PCR bank, the listing of the securityfs ima directory is the
      following:
      
      lr--r--r-- [...] ascii_runtime_measurements -> ascii_runtime_measurements_sha1
      -r--r----- [...] ascii_runtime_measurements_sha1
      -r--r----- [...] ascii_runtime_measurements_sha256
      lr--r--r-- [...] binary_runtime_measurements -> binary_runtime_measurements_sha1
      -r--r----- [...] binary_runtime_measurements_sha1
      -r--r----- [...] binary_runtime_measurements_sha256
      --w------- [...] policy
      -r--r----- [...] runtime_measurements_count
      -r--r----- [...] violations
      Signed-off-by: default avatarEnrico Bravi <enrico.bravi@polito.it>
      Signed-off-by: default avatarSilvia Sisinni <silvia.sisinni@polito.it>
      Reviewed-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      9fa8e762
  2. 09 Apr, 2024 10 commits
  3. 08 Apr, 2024 3 commits
    • Gustavo A. R. Silva's avatar
      integrity: Avoid -Wflex-array-member-not-at-end warnings · 38aa3f5a
      Gustavo A. R. Silva authored
      -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting
      ready to enable it globally.
      
      There is currently an object (`hdr)` in `struct ima_max_digest_data`
      that contains a flexible structure (`struct ima_digest_data`):
      
       struct ima_max_digest_data {
              struct ima_digest_data hdr;
              u8 digest[HASH_MAX_DIGESTSIZE];
       } __packed;
      
      So, in order to avoid ending up with a flexible-array member in the
      middle of a struct, we use the `__struct_group()` helper to separate
      the flexible array from the rest of the members in the flexible
      structure:
      
      struct ima_digest_data {
              __struct_group(ima_digest_data_hdr, hdr, __packed,
      
              ... the rest of the members
      
              );
              u8 digest[];
      } __packed;
      
      And similarly for `struct evm_ima_xattr_data`.
      
      With the change described above, we can now declare an object of the
      type of the tagged `struct ima_digest_data_hdr`, without embedding the
      flexible array in the middle of another struct:
      
       struct ima_max_digest_data {
              struct ima_digest_data_hdr hdr;
              u8 digest[HASH_MAX_DIGESTSIZE];
       } __packed;
      
      And similarly for `struct evm_digest` and `struct evm_xattr`.
      
      We also use `container_of()` whenever we need to retrieve a pointer to
      the flexible structure.
      
      So, with these changes, fix the following warnings:
      
      security/integrity/evm/evm.h:64:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/evm/../integrity.h:40:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/evm/../integrity.h:68:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/ima/../integrity.h:40:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/ima/../integrity.h:68:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/integrity.h:40:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/integrity.h:68:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/platform_certs/../integrity.h:40:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      security/integrity/platform_certs/../integrity.h:68:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
      
      Link: https://github.com/KSPP/linux/issues/202Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      38aa3f5a
    • Mimi Zohar's avatar
      ima: define an init_module critical data record · cc293c84
      Mimi Zohar authored
      The init_module syscall loads an ELF image into kernel space without
      measuring the buffer containing the ELF image.  To close this kernel
      module integrity gap, define a new critical-data record which includes
      the hash of the ELF image.
      
      Instead of including the buffer data in the IMA measurement list,
      include the hash of the buffer data to avoid large IMA measurement
      list records.  The buffer data hash would be the same value as the
      finit_module syscall file hash.
      
      To enable measuring the init_module buffer and other critical data from
      boot, define "ima_policy=critical_data" on the boot command line.  Since
      builtin policies are not persistent, a custom IMA policy must include
      the rule as well: measure func=CRITICAL_DATA label=modules
      
      To verify the template data hash value, first convert the buffer data
      hash to binary:
      grep "init_module" \
      	/sys/kernel/security/integrity/ima/ascii_runtime_measurements | \
      	tail -1 | cut -d' ' -f 6 | xxd -r -p | sha256sum
      Reported-by: default avatarKen Goldman <kgold@linux.ibm.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      cc293c84
    • Stefan Berger's avatar
      ima: Fix use-after-free on a dentry's dname.name · be84f32b
      Stefan Berger authored
      ->d_name.name can change on rename and the earlier value can be freed;
      there are conditions sufficient to stabilize it (->d_lock on dentry,
      ->d_lock on its parent, ->i_rwsem exclusive on the parent's inode,
      rename_lock), but none of those are met at any of the sites. Take a stable
      snapshot of the name instead.
      
      Link: https://lore.kernel.org/all/20240202182732.GE2087318@ZenIV/Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      be84f32b
  4. 07 Apr, 2024 4 commits
  5. 06 Apr, 2024 13 commits
  6. 05 Apr, 2024 9 commits
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.9-20240405' of git://git.kernel.dk/linux · 4f72ed49
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
      
       - Backport of some fixes that came up during development of the 6.10
         io_uring patches. This includes some kbuf cleanups and reference
         fixes.
      
       - Disable multishot read if we don't have NOWAIT support on the target
      
       - Fix for a dependency issue with workqueue flushing
      
      * tag 'io_uring-6.9-20240405' of git://git.kernel.dk/linux:
        io_uring/kbuf: hold io_buffer_list reference over mmap
        io_uring/kbuf: protect io_buffer_list teardown with a reference
        io_uring/kbuf: get rid of bl->is_ready
        io_uring/kbuf: get rid of lower BGID lists
        io_uring: use private workqueue for exit work
        io_uring: disable io-wq execution of multishot NOWAIT requests
        io_uring/rw: don't allow multishot reads without NOWAIT support
      4f72ed49
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 4de2ff26
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "The most important is the libsas fix, which is a problem for DMA to a
        kmalloc'd structure too small causing cache line interference. The
        other fixes (all in drivers) are mostly for allocation length fixes,
        error leg unwinding, suspend races and a missing retry"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: ufs: core: Fix MCQ mode dev command timeout
        scsi: libsas: Align SMP request allocation to ARCH_DMA_MINALIGN
        scsi: sd: Unregister device if device_add_disk() failed in sd_probe()
        scsi: ufs: core: WLUN suspend dev/link state error recovery
        scsi: mylex: Fix sysfs buffer lengths
      4de2ff26
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 84985eb2
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Fix NIOS2 boot with external DTB
      
       - Add missing synchronization needed between fw_devlink and DT overlay
         removals
      
       - Fix some unit-address regex's to be hex only
      
       - Drop some 10+ year old "unstable binding" statements
      
       - Add new SoCs to QCom UFS binding
      
       - Add TPM bindings to TPM maintainers
      
      * tag 'devicetree-fixes-for-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        nios2: Only use built-in devicetree blob if configured to do so
        dt-bindings: timer: narrow regex for unit address to hex numbers
        dt-bindings: soc: fsl: narrow regex for unit address to hex numbers
        dt-bindings: remoteproc: ti,davinci: remove unstable remark
        dt-bindings: clock: ti: remove unstable remark
        dt-bindings: clock: keystone: remove unstable remark
        of: module: prevent NULL pointer dereference in vsnprintf()
        dt-bindings: ufs: qcom: document SM6125 UFS
        dt-bindings: ufs: qcom: document SC7180 UFS
        dt-bindings: ufs: qcom: document SC8180X UFS
        of: dynamic: Synchronize of_changeset_destroy() with the devlink removals
        driver core: Introduce device_link_wait_removal()
        docs: dt-bindings: add missing address/size-cells to example
        MAINTAINERS: Add TPM DT bindings to TPM maintainers
      84985eb2
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2024-04-05-11-30' of... · af709adf
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2024-04-05-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "8 hotfixes, 3 are cc:stable
      
        There are a couple of fixups for this cycle's vmalloc changes and one
        for the stackdepot changes. And a fix for a very old x86 PAT issue
        which can cause a warning splat"
      
      * tag 'mm-hotfixes-stable-2024-04-05-11-30' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        stackdepot: rename pool_index to pool_index_plus_1
        x86/mm/pat: fix VM_PAT handling in COW mappings
        MAINTAINERS: change vmware.com addresses to broadcom.com
        selftests/mm: include strings.h for ffsl
        mm: vmalloc: fix lockdep warning
        mm: vmalloc: bail out early in find_vmap_area() if vmap is not init
        init: open output files from cpio unpacking with O_LARGEFILE
        mm/secretmem: fix GUP-fast succeeding on secretmem folios
      af709adf
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · c7830236
      Linus Torvalds authored
      Pull arm64 fix from Catalin Marinas:
       "arm64/ptrace fix to use the correct SVE layout based on the saved
        floating point state rather than the TIF_SVE flag. The latter may be
        left on during syscalls even if the SVE state is discarded"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64/ptrace: Use saved floating point state type to determine SVE layout
      c7830236
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 261b8e89
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A fix for an __{get,put}_kernel_nofault to avoid an uninitialized
         value causing spurious failures
      
       - compat_vdso.so.dbg is now installed to the standard install location
      
       - A fix to avoid initializing PERF_SAMPLE_BRANCH_*-related events, as
         they aren't supported and will just later fail
      
       - A fix to make AT_VECTOR_SIZE_ARCH correct now that we're providing
         AT_MINSIGSTKSZ
      
       - pgprot_nx() is now implemented, which fixes vmap W^X protection
      
       - A fix for the vector save/restore code, which at least manifests as
         corrupted vector state when a signal is taken
      
       - A fix for a race condition in instruction patching
      
       - A fix to avoid leaking the kernel-mode GP to userspace, which is a
         kernel pointer leak that can be used to defeat KASLR in various ways
      
       - A handful of smaller fixes to build warnings, an overzealous printk,
         and some missing tracing annotations
      
      * tag 'riscv-for-linus-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: process: Fix kernel gp leakage
        riscv: Disable preemption when using patch_map()
        riscv: Fix warning by declaring arch_cpu_idle() as noinstr
        riscv: use KERN_INFO in do_trap
        riscv: Fix vector state restore in rt_sigreturn()
        riscv: mm: implement pgprot_nx
        riscv: compat_vdso: align VDSOAS build log
        RISC-V: Update AT_VECTOR_SIZE_ARCH for new AT_MINSIGSTKSZ
        riscv: Mark __se_sys_* functions __used
        drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported
        riscv: compat_vdso: install compat_vdso.so.dbg to /lib/modules/*/vdso/
        riscv: hwprobe: do not produce frtace relocation
        riscv: Fix spurious errors from __get/put_kernel_nofault
        riscv: mm: Fix prototype to avoid discarding const
      261b8e89
    • Linus Torvalds's avatar
      Merge tag 's390-6.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 50094473
      Linus Torvalds authored
      Pull s390 fixes from Alexander Gordeev:
      
       - Fix missing NULL pointer check when determining guest/host fault
      
       - Mark all functions in asm/atomic_ops.h, asm/atomic.h and
         asm/preempt.h as __always_inline to avoid unwanted instrumentation
      
       - Fix removal of a Processor Activity Instrumentation (PAI) sampling
         event in PMU device driver
      
       - Align system call table on 8 bytes
      
      * tag 's390-6.9-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/entry: align system call table on 8 bytes
        s390/pai: fix sampling event removal for PMU device driver
        s390/preempt: mark all functions __always_inline
        s390/atomic: mark all functions __always_inline
        s390/mm: fix NULL pointer dereference
      50094473
    • Linus Torvalds's avatar
      Merge tag 'pm-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2f9fd9e4
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "Fix a recent Energy Model change that went against a recent scheduler
        change made independently (Vincent Guittot)"
      
      * tag 'pm-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        PM: EM: fix wrong utilization estimation in em_cpu_energy()
      2f9fd9e4
    • Linus Torvalds's avatar
      Merge tag 'thermal-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · b21defcb
      Linus Torvalds authored
      Pull thermal control fixes from Rafael Wysocki:
       "These fix two power allocator thermal governor issues and an ACPI
        thermal driver regression that all were introduced during the 6.8
        development cycle.
      
        Specifics:
      
         - Allow the power allocator thermal governor to bind to a thermal
           zone without cooling devices and/or without trip points (Nikita
           Travkin)
      
         - Make the ACPI thermal driver register a tripless thermal zone when
           it cannot find any usable trip points instead of returning an error
           from acpi_thermal_add() (Stephen Horvath)"
      
      * tag 'thermal-6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        thermal: gov_power_allocator: Allow binding without trip points
        thermal: gov_power_allocator: Allow binding without cooling devices
        ACPI: thermal: Register thermal zones without valid trip points
      b21defcb