1. 14 Apr, 2021 7 commits
    • James Bottomley's avatar
      security: keys: trusted: fix TPM2 authorizations · de66514d
      James Bottomley authored
      In TPM 1.2 an authorization was a 20 byte number.  The spec actually
      recommended you to hash variable length passwords and use the sha1
      hash as the authorization.  Because the spec doesn't require this
      hashing, the current authorization for trusted keys is a 40 digit hex
      number.  For TPM 2.0 the spec allows the passing in of variable length
      passwords and passphrases directly, so we should allow that in trusted
      keys for ease of use.  Update the 'blobauth' parameter to take this
      into account, so we can now use plain text passwords for the keys.
      
      so before
      
      keyctl add trusted kmk "new 32 blobauth=f572d396fae9206628714fb2ce00f72e94f2258fkeyhandle=81000001" @u
      
      after we will accept both the old hex sha1 form as well as a new
      directly supplied password:
      
      keyctl add trusted kmk "new 32 blobauth=hello keyhandle=81000001" @u
      
      Since a sha1 hex code must be exactly 40 bytes long and a direct
      password must be 20 or less, we use the length as the discriminator
      for which form is input.
      
      Note this is both and enhancement and a potential bug fix.  The TPM
      2.0 spec requires us to strip leading zeros, meaning empyty
      authorization is a zero length HMAC whereas we're currently passing in
      20 bytes of zeros.  A lot of TPMs simply accept this as OK, but the
      Microsoft TPM emulator rejects it with TPM_RC_BAD_AUTH, so this patch
      makes the Microsoft TPM emulator work with trusted keys.
      
      Fixes: 0fe54803 ("keys, trusted: seal/unseal with TPM 2.0 chips")
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      de66514d
    • James Bottomley's avatar
      oid_registry: Add TCG defined OIDS for TPM keys · 1c6476e9
      James Bottomley authored
      The TCG has defined an OID prefix "2.23.133.10.1" for the various TPM
      key uses.  We've defined three of the available numbers:
      
      2.23.133.10.1.3 TPM Loadable key.  This is an asymmetric key (Usually
      		RSA2048 or Elliptic Curve) which can be imported by a
      		TPM2_Load() operation.
      
      2.23.133.10.1.4 TPM Importable Key.  This is an asymmetric key (Usually
      		RSA2048 or Elliptic Curve) which can be imported by a
      		TPM2_Import() operation.
      
      Both loadable and importable keys are specific to a given TPM, the
      difference is that a loadable key is wrapped with the symmetric
      secret, so must have been created by the TPM itself.  An importable
      key is wrapped with a DH shared secret, and may be created without
      access to the TPM provided you know the public part of the parent key.
      
      2.23.133.10.1.5 TPM Sealed Data.  This is a set of data (up to 128
      		bytes) which is sealed by the TPM.  It usually
      		represents a symmetric key and must be unsealed before
      		use.
      
      The ASN.1 binary key form starts of with this OID as the first element
      of a sequence, giving the binary form a unique recognizable identity
      marker regardless of encoding.
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      1c6476e9
    • James Bottomley's avatar
      lib: Add ASN.1 encoder · b0706762
      James Bottomley authored
      We have a need in the TPM2 trusted keys to return the ASN.1 form of the TPM
      key blob so it can be operated on by tools outside of the kernel.  The
      specific tools are the openssl_tpm2_engine, openconnect and the Intel
      tpm2-tss-engine.  To do that, we have to be able to read and write the same
      binary key format the tools use.  The current ASN.1 decoder does fine for
      reading, but we need pieces of an ASN.1 encoder to write the key blob in
      binary compatible form.
      
      For backwards compatibility, the trusted key reader code will still accept
      the two TPM2B quantities that it uses today, but the writer will only
      output the ASN.1 form.
      
      The current implementation only encodes the ASN.1 bits we actually need.
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      b0706762
    • Stefan Berger's avatar
      tpm: vtpm_proxy: Avoid reading host log when using a virtual device · 9716ac65
      Stefan Berger authored
      Avoid allocating memory and reading the host log when a virtual device
      is used since this log is of no use to that driver. A virtual
      device can be identified through the flag TPM_CHIP_FLAG_VIRTUAL, which
      is only set for the tpm_vtpm_proxy driver.
      
      Cc: stable@vger.kernel.org
      Fixes: 6f99612e ("tpm: Proxy driver for supporting multiple emulated TPMs")
      Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      9716ac65
    • Stefan Berger's avatar
      tpm: acpi: Check eventlog signature before using it · 3dcd1566
      Stefan Berger authored
      Check the eventlog signature before using it. This avoids using an
      empty log, as may be the case when QEMU created the ACPI tables,
      rather than probing the EFI log next. This resolves an issue where
      the EFI log was empty since an empty ACPI log was used.
      
      Cc: stable@vger.kernel.org
      Fixes: 85467f63 ("tpm: Add support for event log pointer found in TPM2 ACPI table")
      Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      3dcd1566
    • Stefan Berger's avatar
      tpm: efi: Use local variable for calculating final log size · 48cff270
      Stefan Berger authored
      When tpm_read_log_efi is called multiple times, which happens when
      one loads and unloads a TPM2 driver multiple times, then the global
      variable efi_tpm_final_log_size will at some point become a negative
      number due to the subtraction of final_events_preboot_size occurring
      each time. Use a local variable to avoid this integer underflow.
      
      The following issue is now resolved:
      
      Mar  8 15:35:12 hibinst kernel: Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      Mar  8 15:35:12 hibinst kernel: Workqueue: tpm-vtpm vtpm_proxy_work [tpm_vtpm_proxy]
      Mar  8 15:35:12 hibinst kernel: RIP: 0010:__memcpy+0x12/0x20
      Mar  8 15:35:12 hibinst kernel: Code: 00 b8 01 00 00 00 85 d2 74 0a c7 05 44 7b ef 00 0f 00 00 00 c3 cc cc cc 66 66 90 66 90 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
      Mar  8 15:35:12 hibinst kernel: RSP: 0018:ffff9ac4c0fcfde0 EFLAGS: 00010206
      Mar  8 15:35:12 hibinst kernel: RAX: ffff88f878cefed5 RBX: ffff88f878ce9000 RCX: 1ffffffffffffe0f
      Mar  8 15:35:12 hibinst kernel: RDX: 0000000000000003 RSI: ffff9ac4c003bff9 RDI: ffff88f878cf0e4d
      Mar  8 15:35:12 hibinst kernel: RBP: ffff9ac4c003b000 R08: 0000000000001000 R09: 000000007e9d6073
      Mar  8 15:35:12 hibinst kernel: R10: ffff9ac4c003b000 R11: ffff88f879ad3500 R12: 0000000000000ed5
      Mar  8 15:35:12 hibinst kernel: R13: ffff88f878ce9760 R14: 0000000000000002 R15: ffff88f77de7f018
      Mar  8 15:35:12 hibinst kernel: FS:  0000000000000000(0000) GS:ffff88f87bd00000(0000) knlGS:0000000000000000
      Mar  8 15:35:12 hibinst kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      Mar  8 15:35:12 hibinst kernel: CR2: ffff9ac4c003c000 CR3: 00000001785a6004 CR4: 0000000000060ee0
      Mar  8 15:35:12 hibinst kernel: Call Trace:
      Mar  8 15:35:12 hibinst kernel: tpm_read_log_efi+0x152/0x1a7
      Mar  8 15:35:12 hibinst kernel: tpm_bios_log_setup+0xc8/0x1c0
      Mar  8 15:35:12 hibinst kernel: tpm_chip_register+0x8f/0x260
      Mar  8 15:35:12 hibinst kernel: vtpm_proxy_work+0x16/0x60 [tpm_vtpm_proxy]
      Mar  8 15:35:12 hibinst kernel: process_one_work+0x1b4/0x370
      Mar  8 15:35:12 hibinst kernel: worker_thread+0x53/0x3e0
      Mar  8 15:35:12 hibinst kernel: ? process_one_work+0x370/0x370
      
      Cc: stable@vger.kernel.org
      Fixes: 166a2809 ("tpm: Don't duplicate events from the final event log in the TCG2 log")
      Signed-off-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      48cff270
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 50987bec
      Linus Torvalds authored
      Pull tracing fix from Steven Rostedt:
       "Fix a memory link in dyn_event_release().
      
        An error path exited the function before freeing the allocated 'argv'
        variable"
      
      * tag 'trace-v5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing/dynevent: Fix a memory leak in an error handling path
      50987bec
  2. 13 Apr, 2021 2 commits
  3. 12 Apr, 2021 1 commit
  4. 11 Apr, 2021 5 commits
  5. 10 Apr, 2021 10 commits
    • Linus Torvalds's avatar
      Merge branch 'for-5.12-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu · 52e44129
      Linus Torvalds authored
      Pull percpu fix from Dennis Zhou:
       "This contains a fix for sporadically failing atomic percpu
        allocations.
      
        I only caught it recently while I was reviewing a new series [1] and
        simultaneously saw reports by btrfs in xfstests [2] and [3].
      
        In v5.9, memcg accounting was extended to percpu done by adding a
        second type of chunk. I missed an interaction with the free page float
        count used to ensure we can support atomic allocations. If one type of
        chunk has no free pages, but the other has enough to satisfy the free
        page float requirement, we will not repopulate the free pages for the
        former type of chunk. This led to the sporadically failing atomic
        allocations"
      
      Link: https://lore.kernel.org/linux-mm/20210324190626.564297-1-guro@fb.com/ [1]
      Link: https://lore.kernel.org/linux-mm/20210401185158.3275.409509F4@e16-tech.com/ [2]
      Link: https://lore.kernel.org/linux-mm/CAL3q7H5RNBjCi708GH7jnczAOe0BLnacT9C+OBgA-Dx9jhB6SQ@mail.gmail.com/ [3]
      
      * 'for-5.12-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu:
        percpu: make pcpu_nr_empty_pop_pages per chunk type
      52e44129
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · efc2da92
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Seven fixes, all in drivers.
      
        The hpsa three are the most extensive and the most problematic: it's a
        packed structure misalignment that oopses on ia64 but looks like it
        would also oops on quite a few non-x86 architectures.
      
        The pm80xx is a regression and the rest are bug fixes for patches in
        the misc tree"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: scsi_transport_srp: Don't block target in SRP_PORT_LOST state
        scsi: target: iscsi: Fix zero tag inside a trace event
        scsi: pm80xx: Fix chip initialization failure
        scsi: ufs: core: Fix wrong Task Tag used in task management request UPIUs
        scsi: ufs: core: Fix task management request completion timeout
        scsi: hpsa: Add an assert to prevent __packed reintroduction
        scsi: hpsa: Fix boot on ia64 (atomic_t alignment)
        scsi: hpsa: Use __packed on individual structs, not header-wide
      efc2da92
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.12-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 95c7b075
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Some some more powerpc fixes for 5.12:
      
         - Fix an oops triggered by ptrace when CONFIG_PPC_FPU_REGS=n
      
         - Fix an oops on sigreturn when the VDSO is unmapped on 32-bit
      
         - Fix vdso_wrapper.o not being rebuilt everytime vdso.so is rebuilt
      
        Thanks to Christophe Leroy"
      
      * tag 'powerpc-5.12-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/vdso: Make sure vdso_wrapper.o is rebuilt everytime vdso.so is rebuilt
        powerpc/signal32: Fix Oops on sigreturn with unmapped VDSO
        powerpc/ptrace: Don't return error when getting/setting FP regs without CONFIG_PPC_FPU_REGS
      95c7b075
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.12-rc7' of... · d5fa1dad
      Linus Torvalds authored
      Merge tag 'driver-core-5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fix from Greg KH:
       "Here is a single driver core fix for 5.12-rc7 to resolve a reported
        problem that caused some devices to lockup when booting. It has been
        in linux-next with no reported issues"
      
      * tag 'driver-core-5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        driver core: Fix locking bug in deferred_probe_timeout_work_func()
      d5fa1dad
    • Linus Torvalds's avatar
      Merge tag 'usb-5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 445e09e7
      Linus Torvalds authored
      Pull USB/Thunderbolt fixes from Greg KH:
       "Here are a few small USB and Thunderbolt driver fixes for 5.12-rc7 for
        reported issues:
      
         - thunderbolt leaks and off-by-one fix
      
         - cdnsp deque fix
      
         - usbip fixes for syzbot-reported issues
      
        All have been in linux-next with no reported problems"
      
      * tag 'usb-5.12-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usbip: synchronize event handler with sysfs code paths
        usbip: vudc synchronize sysfs code paths
        usbip: stub-dev synchronize sysfs code paths
        usbip: add sysfs_lock to synchronize sysfs code paths
        thunderbolt: Fix off by one in tb_port_find_retimer()
        thunderbolt: Fix a leak in tb_retimer_add()
        usb: cdnsp: Fixes issue with dequeuing requests after disabling endpoint
      445e09e7
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 12a0cf72
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "A mixture of driver and documentation bugfixes for I2C"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: imx: mention Oleksij as maintainer of the binding docs
        i2c: exynos5: correct top kerneldoc
        i2c: designware: Adjust bus_freq_hz when refuse high speed mode set
        i2c: hix5hd2: use the correct HiSilicon copyright
        i2c: gpio: update email address in binding docs
        i2c: imx: drop me as maintainer of binding docs
        i2c: stm32f4: Mundane typo fix
        I2C: JZ4780: Fix bug for Ingenic X1000.
        i2c: turn recovery error on init to debug
      12a0cf72
    • Naohiro Aota's avatar
      btrfs: zoned: move superblock logging zone location · 53b74fa9
      Naohiro Aota authored
      Moves the location of the superblock logging zones. The new locations of
      the logging zones are now determined based on fixed block addresses
      instead of on fixed zone numbers.
      
      The old placement method based on fixed zone numbers causes problems when
      one needs to inspect a file system image without access to the drive zone
      information. In such case, the super block locations cannot be reliably
      determined as the zone size is unknown. By locating the superblock logging
      zones using fixed addresses, we can scan a dumped file system image without
      the zone information since a super block copy will always be present at or
      after the fixed known locations.
      
      Introduce the following three pairs of zones containing fixed offset
      locations, regardless of the device zone size.
      
        - primary superblock: offset   0B (and the following zone)
        - first copy:         offset 512G (and the following zone)
        - Second copy:        offset   4T (4096G, and the following zone)
      
      If a logging zone is outside of the disk capacity, we do not record the
      superblock copy.
      
      The first copy position is much larger than for a non-zoned filesystem,
      which is at 64M.  This is to avoid overlapping with the log zones for
      the primary superblock. This higher location is arbitrary but allows
      supporting devices with very large zone sizes, plus some space around in
      between.
      
      Such large zone size is unrealistic and very unlikely to ever be seen in
      real devices. Currently, SMR disks have a zone size of 256MB, and we are
      expecting ZNS drives to be in the 1-4GB range, so this limit gives us
      room to breathe. For now, we only allow zone sizes up to 8GB. The
      maximum zone size that would still fit in the space is 256G.
      
      The fixed location addresses are somewhat arbitrary, with the intent of
      maintaining superblock reliability for smaller and larger devices, with
      the preference for the latter. For this reason, there are two superblocks
      under the first 1T. This should cover use cases for physical devices and
      for emulated/device-mapper devices.
      
      The superblock logging zones are reserved for superblock logging and
      never used for data or metadata blocks. Note that we only reserve the
      two zones per primary/copy actually used for superblock logging. We do
      not reserve the ranges of zones possibly containing superblocks with the
      largest supported zone size (0-16GB, 512G-528GB, 4096G-4112G).
      
      The zones containing the fixed location offsets used to store
      superblocks on a non-zoned volume are also reserved to avoid confusion.
      Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      53b74fa9
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · d4961772
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "Here's the latest pile of clk driver and clk framework fixes for this
        release:
      
         - Two clk framework fixes for a long standing issue in
           clk_notifier_{register,unregister}() where we used a pointer that
           was for a struct containing a list head when there was no container
           struct
      
         - A compile warning fix for socfpga that's good to have
      
         - A double free problem with devm registered fixed factor clks
      
         - One last fix to the Qualcomm camera clk driver to use the right clk
           ops so clks don't get stuck and stop working because the firmware
           takes them for a ride"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: fixed: fix double free in resource managed fixed-factor clock
        clk: fix invalid usage of list cursor in unregister
        clk: fix invalid usage of list cursor in register
        clk: qcom: camcc: Update the clock ops for the SC7180
        clk: socfpga: fix iomem pointer cast on 64-bit
      d4961772
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.12-2020-04-09' of... · 9288e1f7
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.12-2020-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tool fixes from Arnaldo Carvalho de Melo:
      
       - Fix wrong LBR block sorting in 'perf report'
      
       - Fix 'perf inject' repipe usage when consuming perf.data files
      
       - Avoid potential buffer overrun when decoding ARM SPE hardware tracing
         packets, bug found using a fuzzer
      
      * tag 'perf-tools-fixes-for-v5.12-2020-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf arm-spe: Avoid potential buffer overrun
        perf report: Fix wrong LBR block sorting
        perf inject: Fix repipe usage
      9288e1f7
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · adb2c417
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "14 patches.
      
        Subsystems affected by this patch series: mm (kasan, gup, pagecache,
        and kfence), MAINTAINERS, mailmap, nds32, gcov, ocfs2, ia64, and lib"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS
        kfence, x86: fix preemptible warning on KPTI-enabled systems
        lib/test_kasan_module.c: suppress unused var warning
        kasan: fix conflict with page poisoning
        fs: direct-io: fix missing sdio->boundary
        ia64: fix user_stack_pointer() for ptrace()
        ocfs2: fix deadlock between setattr and dio_end_io_write
        gcov: re-fix clang-11+ support
        nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
        mm/gup: check page posion status for coredump.
        .mailmap: fix old email addresses
        mailmap: update email address for Jordan Crouse
        treewide: change my e-mail address, fix my name
        MAINTAINERS: update CZ.NIC's Turris information
      adb2c417
  6. 09 Apr, 2021 15 commits