1. 03 8月, 2020 1 次提交
  2. 02 8月, 2020 1 次提交
  3. 31 7月, 2020 2 次提交
  4. 30 7月, 2020 2 次提交
    • L
      random32: remove net_rand_state from the latent entropy gcc plugin · 83bdc727
      Linus Torvalds 提交于
      It turns out that the plugin right now ends up being really unhappy
      about the change from 'static' to 'extern' storage that happened in
      commit f227e3ec ("random32: update the net random state on interrupt
      and activity").
      
      This is probably a trivial fix for the latent_entropy plugin, but for
      now, just remove net_rand_state from the list of things the plugin
      worries about.
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Emese Revfy <re.emese@gmail.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Willy Tarreau <w@1wt.eu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      83bdc727
    • W
      random32: update the net random state on interrupt and activity · f227e3ec
      Willy Tarreau 提交于
      This modifies the first 32 bits out of the 128 bits of a random CPU's
      net_rand_state on interrupt or CPU activity to complicate remote
      observations that could lead to guessing the network RNG's internal
      state.
      
      Note that depending on some network devices' interrupt rate moderation
      or binding, this re-seeding might happen on every packet or even almost
      never.
      
      In addition, with NOHZ some CPUs might not even get timer interrupts,
      leaving their local state rarely updated, while they are running
      networked processes making use of the random state.  For this reason, we
      also perform this update in update_process_times() in order to at least
      update the state when there is user or system activity, since it's the
      only case we care about.
      Reported-by: NAmit Klein <aksecurity@gmail.com>
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWilly Tarreau <w@1wt.eu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f227e3ec
  5. 29 7月, 2020 4 次提交
  6. 28 7月, 2020 8 次提交
  7. 27 7月, 2020 1 次提交
    • T
      genirq/affinity: Make affinity setting if activated opt-in · f0c7baca
      Thomas Gleixner 提交于
      John reported that on a RK3288 system the perf per CPU interrupts are all
      affine to CPU0 and provided the analysis:
      
       "It looks like what happens is that because the interrupts are not per-CPU
        in the hardware, armpmu_request_irq() calls irq_force_affinity() while
        the interrupt is deactivated and then request_irq() with IRQF_PERCPU |
        IRQF_NOBALANCING.  
      
        Now when irq_startup() runs with IRQ_STARTUP_NORMAL, it calls
        irq_setup_affinity() which returns early because IRQF_PERCPU and
        IRQF_NOBALANCING are set, leaving the interrupt on its original CPU."
      
      This was broken by the recent commit which blocked interrupt affinity
      setting in hardware before activation of the interrupt. While this works in
      general, it does not work for this particular case. As contrary to the
      initial analysis not all interrupt chip drivers implement an activate
      callback, the safe cure is to make the deferred interrupt affinity setting
      at activation time opt-in.
      
      Implement the necessary core logic and make the two irqchip implementations
      for which this is required opt-in. In hindsight this would have been the
      right thing to do, but ...
      
      Fixes: baedb87d ("genirq/affinity: Handle affinity setting on inactive interrupts correctly")
      Reported-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Acked-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/87blk4tzgm.fsf@nanos.tec.linutronix.de
      f0c7baca
  8. 25 7月, 2020 3 次提交
  9. 24 7月, 2020 4 次提交
    • J
      tpm: Unify the mismatching TPM space buffer sizes · 6c4e79d9
      Jarkko Sakkinen 提交于
      The size of the buffers for storing context's and sessions can vary from
      arch to arch as PAGE_SIZE can be anything between 4 kB and 256 kB (the
      maximum for PPC64). Define a fixed buffer size set to 16 kB. This should be
      enough for most use with three handles (that is how many we allow at the
      moment). Parametrize the buffer size while doing this, so that it is easier
      to revisit this later on if required.
      
      Cc: stable@vger.kernel.org
      Reported-by: NStefan Berger <stefanb@linux.ibm.com>
      Fixes: 745b361e ("tpm: infrastructure for TPM spaces")
      Reviewed-by: NJerry Snitselaar <jsnitsel@redhat.com>
      Tested-by: NStefan Berger <stefanb@linux.ibm.com>
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      6c4e79d9
    • T
      tpm: Require that all digests are present in TCG_PCR_EVENT2 structures · 7f3d176f
      Tyler Hicks 提交于
      Require that the TCG_PCR_EVENT2.digests.count value strictly matches the
      value of TCG_EfiSpecIdEvent.numberOfAlgorithms in the event field of the
      TCG_PCClientPCREvent event log header. Also require that
      TCG_EfiSpecIdEvent.numberOfAlgorithms is non-zero.
      
      The TCG PC Client Platform Firmware Profile Specification section 9.1
      (Family "2.0", Level 00 Revision 1.04) states:
      
       For each Hash algorithm enumerated in the TCG_PCClientPCREvent entry,
       there SHALL be a corresponding digest in all TCG_PCR_EVENT2 structures.
       Note: This includes EV_NO_ACTION events which do not extend the PCR.
      
      Section 9.4.5.1 provides this description of
      TCG_EfiSpecIdEvent.numberOfAlgorithms:
      
       The number of Hash algorithms in the digestSizes field. This field MUST
       be set to a value of 0x01 or greater.
      
      Enforce these restrictions, as required by the above specification, in
      order to better identify and ignore invalid sequences of bytes at the
      end of an otherwise valid TPM2 event log. Firmware doesn't always have
      the means necessary to inform the kernel of the actual event log size so
      the kernel's event log parsing code should be stringent when parsing the
      event log for resiliency against firmware bugs. This is true, for
      example, when firmware passes the event log to the kernel via a reserved
      memory region described in device tree.
      
      POWER and some ARM systems use the "linux,sml-base" and "linux,sml-size"
      device tree properties to describe the memory region used to pass the
      event log from firmware to the kernel. Unfortunately, the
      "linux,sml-size" property describes the size of the entire reserved
      memory region rather than the size of the event long within the memory
      region and the event log format does not include information describing
      the size of the event log.
      
      tpm_read_log_of(), in drivers/char/tpm/eventlog/of.c, is where the
      "linux,sml-size" property is used. At the end of that function,
      log->bios_event_log_end is pointing at the end of the reserved memory
      region. That's typically 0x10000 bytes offset from "linux,sml-base",
      depending on what's defined in the device tree source.
      
      The firmware event log only fills a portion of those 0x10000 bytes and
      the rest of the memory region should be zeroed out by firmware. Even in
      the case of a properly zeroed bytes in the remainder of the memory
      region, the only thing allowing the kernel's event log parser to detect
      the end of the event log is the following conditional in
      __calc_tpm2_event_size():
      
              if (event_type == 0 && event_field->event_size == 0)
                      size = 0;
      
      If that wasn't there, __calc_tpm2_event_size() would think that a 16
      byte sequence of zeroes, following an otherwise valid event log, was
      a valid event.
      
      However, problems can occur if a single bit is set in the offset
      corresponding to either the TCG_PCR_EVENT2.eventType or
      TCG_PCR_EVENT2.eventSize fields, after the last valid event log entry.
      This could confuse the parser into thinking that an additional entry is
      present in the event log and exposing this invalid entry to userspace in
      the /sys/kernel/security/tpm0/binary_bios_measurements file. Such
      problems have been seen if firmware does not fully zero the memory
      region upon a warm reboot.
      
      This patch significantly raises the bar on how difficult it is for
      stale/invalid memory to confuse the kernel's event log parser but
      there's still, ultimately, a reliance on firmware to properly initialize
      the remainder of the memory region reserved for the event log as the
      parser cannot be expected to detect a stale but otherwise properly
      formatted firmware event log entry.
      
      Fixes: fd5c7869 ("tpm: fix handling of the TPM 2.0 event logs")
      Signed-off-by: NTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      7f3d176f
    • Y
      tcp: allow at most one TLP probe per flight · 76be93fc
      Yuchung Cheng 提交于
      Previously TLP may send multiple probes of new data in one
      flight. This happens when the sender is cwnd limited. After the
      initial TLP containing new data is sent, the sender receives another
      ACK that acks partial inflight.  It may re-arm another TLP timer
      to send more, if no further ACK returns before the next TLP timeout
      (PTO) expires. The sender may send in theory a large amount of TLP
      until send queue is depleted. This only happens if the sender sees
      such irregular uncommon ACK pattern. But it is generally undesirable
      behavior during congestion especially.
      
      The original TLP design restrict only one TLP probe per inflight as
      published in "Reducing Web Latency: the Virtue of Gentle Aggression",
      SIGCOMM 2013. This patch changes TLP to send at most one probe
      per inflight.
      
      Note that if the sender is app-limited, TLP retransmits old data
      and did not have this issue.
      Signed-off-by: NYuchung Cheng <ycheng@google.com>
      Signed-off-by: NNeal Cardwell <ncardwell@google.com>
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      76be93fc
    • M
      dm integrity: fix integrity recalculation that is improperly skipped · 5df96f2b
      Mikulas Patocka 提交于
      Commit adc0daad ("dm: report suspended
      device during destroy") broke integrity recalculation.
      
      The problem is dm_suspended() returns true not only during suspend,
      but also during resume. So this race condition could occur:
      1. dm_integrity_resume calls queue_work(ic->recalc_wq, &ic->recalc_work)
      2. integrity_recalc (&ic->recalc_work) preempts the current thread
      3. integrity_recalc calls if (unlikely(dm_suspended(ic->ti))) goto unlock_ret;
      4. integrity_recalc exits and no recalculating is done.
      
      To fix this race condition, add a function dm_post_suspending that is
      only true during the postsuspend phase and use it instead of
      dm_suspended().
      
      Signed-off-by: Mikulas Patocka <mpatocka redhat com>
      Fixes: adc0daad ("dm: report suspended device during destroy")
      Cc: stable vger kernel org # v4.18+
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      5df96f2b
  10. 23 7月, 2020 5 次提交
  11. 22 7月, 2020 3 次提交
    • R
      i2c: drop duplicated word in the header file · aca7ed09
      Randy Dunlap 提交于
      Drop the doubled word "be" in a comment.
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NWolfram Sang <wsa@kernel.org>
      aca7ed09
    • E
      fs-verity: use smp_load_acquire() for ->i_verity_info · f3db0bed
      Eric Biggers 提交于
      Normally smp_store_release() or cmpxchg_release() is paired with
      smp_load_acquire().  Sometimes smp_load_acquire() can be replaced with
      the more lightweight READ_ONCE().  However, for this to be safe, all the
      published memory must only be accessed in a way that involves the
      pointer itself.  This may not be the case if allocating the object also
      involves initializing a static or global variable, for example.
      
      fsverity_info::tree_params.hash_alg->tfm is a crypto_ahash object that's
      internal to and is allocated by the crypto subsystem.  So by using
      READ_ONCE() for ->i_verity_info, we're relying on internal
      implementation details of the crypto subsystem.
      
      Remove this fragile assumption by using smp_load_acquire() instead.
      
      Also fix the cmpxchg logic to correctly execute an ACQUIRE barrier when
      losing the cmpxchg race, since cmpxchg doesn't guarantee a memory
      barrier on failure.
      
      (Note: I haven't seen any real-world problems here.  This change is just
      fixing the code to be guaranteed correct and less fragile.)
      
      Fixes: fd2d1acf ("fs-verity: add the hook for file ->open()")
      Link: https://lore.kernel.org/r/20200721225920.114347-6-ebiggers@kernel.orgSigned-off-by: NEric Biggers <ebiggers@google.com>
      f3db0bed
    • E
      fscrypt: use smp_load_acquire() for ->i_crypt_info · ab673b98
      Eric Biggers 提交于
      Normally smp_store_release() or cmpxchg_release() is paired with
      smp_load_acquire().  Sometimes smp_load_acquire() can be replaced with
      the more lightweight READ_ONCE().  However, for this to be safe, all the
      published memory must only be accessed in a way that involves the
      pointer itself.  This may not be the case if allocating the object also
      involves initializing a static or global variable, for example.
      
      fscrypt_info includes various sub-objects which are internal to and are
      allocated by other kernel subsystems such as keyrings and crypto.  So by
      using READ_ONCE() for ->i_crypt_info, we're relying on internal
      implementation details of these other kernel subsystems.
      
      Remove this fragile assumption by using smp_load_acquire() instead.
      
      (Note: I haven't seen any real-world problems here.  This change is just
      fixing the code to be guaranteed correct and less fragile.)
      
      Fixes: e37a784d ("fscrypt: use READ_ONCE() to access ->i_crypt_info")
      Link: https://lore.kernel.org/r/20200721225920.114347-5-ebiggers@kernel.orgSigned-off-by: NEric Biggers <ebiggers@google.com>
      ab673b98
  12. 21 7月, 2020 4 次提交
  13. 20 7月, 2020 1 次提交
  14. 18 7月, 2020 1 次提交
    • B
      blk-cgroup: show global disk stats in root cgroup io.stat · ef45fe47
      Boris Burkov 提交于
      In order to improve consistency and usability in cgroup stat accounting,
      we would like to support the root cgroup's io.stat.
      
      Since the root cgroup has processes doing io even if the system has no
      explicitly created cgroups, we need to be careful to avoid overhead in
      that case.  For that reason, the rstat algorithms don't handle the root
      cgroup, so just turning the file on wouldn't give correct statistics.
      
      To get around this, we simulate flushing the iostat struct by filling it
      out directly from global disk stats. The result is a root cgroup io.stat
      file consistent with both /proc/diskstats and io.stat.
      
      Note that in order to collect the disk stats, we needed to iterate over
      devices. To facilitate that, we had to change the linkage of a disk_type
      to external so that it can be used from blk-cgroup.c to iterate over
      disks.
      Suggested-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NBoris Burkov <boris@bur.io>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      ef45fe47