]> Git Repo - linux.git/commitdiff
Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
authorLinus Torvalds <[email protected]>
Thu, 16 Aug 2018 04:16:02 +0000 (21:16 -0700)
committerLinus Torvalds <[email protected]>
Thu, 16 Aug 2018 04:16:02 +0000 (21:16 -0700)
Pull random updates from Ted Ts'o:
 "Some changes to trust cpu-based hwrng (such as RDRAND) for
  initializing hashed pointers and (optionally, controlled by a config
  option) to initialize the CRNG to avoid boot hangs"

* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
  random: Make crng state queryable
  random: remove preempt disabled region
  random: add a config option to trust the CPU's hwrng
  vsprintf: Add command line option debug_boot_weak_hash
  vsprintf: Use hw RNG for ptr_key
  random: Return nbytes filled from hw RNG
  random: Fix whitespace pre random-bytes work

1  2 
Documentation/admin-guide/kernel-parameters.txt
lib/vsprintf.c

index a32f2a1267919296f378bc04a6994c79b2ebbd65,0c8f7889efa1f9122bbfeaf5b2369090e6dfa093..0c883029881aca7e231d54dffea32aebe40945eb
  
        debug           [KNL] Enable kernel debugging (events log level).
  
+       debug_boot_weak_hash
+                       [KNL] Enable printing [hashed] pointers early in the
+                       boot sequence.  If enabled, we use a weak hash instead
+                       of siphash to hash pointers.  Use this option if you are
+                       seeing instances of '(___ptrval___)') and need to see a
+                       value (hashed pointer) instead. Cryptographically
+                       insecure, please do not use on production kernels.
        debug_locks_verbose=
                        [KNL] verbose self-tests
                        Format=<0|1>
        disable=        [IPV6]
                        See Documentation/networking/ipv6.txt.
  
 +      hardened_usercopy=
 +                        [KNL] Under CONFIG_HARDENED_USERCOPY, whether
 +                        hardening is enabled for this boot. Hardened
 +                        usercopy checking is used to protect the kernel
 +                        from reading or writing beyond known memory
 +                        allocation boundaries as a proactive defense
 +                        against bounds-checking flaws in the kernel's
 +                        copy_to_user()/copy_from_user() interface.
 +                on      Perform hardened usercopy checks (default).
 +                off     Disable hardened usercopy checks.
 +
        disable_radix   [PPC]
                        Disable RADIX MMU mode on POWER9
  
                        (virtualized real and unpaged mode) on capable
                        Intel chips. Default is 1 (enabled)
  
 +      kvm-intel.vmentry_l1d_flush=[KVM,Intel] Mitigation for L1 Terminal Fault
 +                      CVE-2018-3620.
 +
 +                      Valid arguments: never, cond, always
 +
 +                      always: L1D cache flush on every VMENTER.
 +                      cond:   Flush L1D on VMENTER only when the code between
 +                              VMEXIT and VMENTER can leak host memory.
 +                      never:  Disables the mitigation
 +
 +                      Default is cond (do L1 cache flush in specific instances)
 +
        kvm-intel.vpid= [KVM,Intel] Disable Virtual Processor Identification
                        feature (tagged TLBs) on capable Intel chips.
                        Default is 1 (enabled)
  
 +      l1tf=           [X86] Control mitigation of the L1TF vulnerability on
 +                            affected CPUs
 +
 +                      The kernel PTE inversion protection is unconditionally
 +                      enabled and cannot be disabled.
 +
 +                      full
 +                              Provides all available mitigations for the
 +                              L1TF vulnerability. Disables SMT and
 +                              enables all mitigations in the
 +                              hypervisors, i.e. unconditional L1D flush.
 +
 +                              SMT control and L1D flush control via the
 +                              sysfs interface is still possible after
 +                              boot.  Hypervisors will issue a warning
 +                              when the first VM is started in a
 +                              potentially insecure configuration,
 +                              i.e. SMT enabled or L1D flush disabled.
 +
 +                      full,force
 +                              Same as 'full', but disables SMT and L1D
 +                              flush runtime control. Implies the
 +                              'nosmt=force' command line option.
 +                              (i.e. sysfs control of SMT is disabled.)
 +
 +                      flush
 +                              Leaves SMT enabled and enables the default
 +                              hypervisor mitigation, i.e. conditional
 +                              L1D flush.
 +
 +                              SMT control and L1D flush control via the
 +                              sysfs interface is still possible after
 +                              boot.  Hypervisors will issue a warning
 +                              when the first VM is started in a
 +                              potentially insecure configuration,
 +                              i.e. SMT enabled or L1D flush disabled.
 +
 +                      flush,nosmt
 +
 +                              Disables SMT and enables the default
 +                              hypervisor mitigation.
 +
 +                              SMT control and L1D flush control via the
 +                              sysfs interface is still possible after
 +                              boot.  Hypervisors will issue a warning
 +                              when the first VM is started in a
 +                              potentially insecure configuration,
 +                              i.e. SMT enabled or L1D flush disabled.
 +
 +                      flush,nowarn
 +                              Same as 'flush', but hypervisors will not
 +                              warn when a VM is started in a potentially
 +                              insecure configuration.
 +
 +                      off
 +                              Disables hypervisor mitigations and doesn't
 +                              emit any warnings.
 +
 +                      Default is 'flush'.
 +
 +                      For details see: Documentation/admin-guide/l1tf.rst
 +
        l2cr=           [PPC]
  
        l3cr=           [PPC]
        nosmt           [KNL,S390] Disable symmetric multithreading (SMT).
                        Equivalent to smt=1.
  
 +                      [KNL,x86] Disable symmetric multithreading (SMT).
 +                      nosmt=force: Force disable SMT, cannot be undone
 +                                   via the sysfs control file.
 +
        nospectre_v2    [X86] Disable all mitigations for the Spectre variant 2
                        (indirect branch prediction) vulnerability. System may
                        allow data leaks with this option, which is equivalent
  
        nosync          [HW,M68K] Disables sync negotiation for all devices.
  
 -      notsc           [BUGS=X86-32] Disable Time Stamp Counter
 -
        nowatchdog      [KNL] Disable both lockup detectors, i.e.
                        soft-lockup and NMI watchdog (hard-lockup).
  
                        Set time (s) after boot for CPU-hotplug testing.
  
        rcutorture.onoff_interval= [KNL]
 -                      Set time (s) between CPU-hotplug operations, or
 -                      zero to disable CPU-hotplug testing.
 +                      Set time (jiffies) between CPU-hotplug operations,
 +                      or zero to disable CPU-hotplug testing.
  
        rcutorture.shuffle_interval= [KNL]
                        Set task-shuffle interval (s).  Shuffling tasks
                        This parameter controls whether the Speculative Store
                        Bypass optimization is used.
  
 +                      On x86 the options are:
 +
                        on      - Unconditionally disable Speculative Store Bypass
                        off     - Unconditionally enable Speculative Store Bypass
                        auto    - Kernel detects whether the CPU model contains an
                        seccomp - Same as "prctl" above, but all seccomp threads
                                  will disable SSB unless they explicitly opt out.
  
 -                      Not specifying this option is equivalent to
 -                      spec_store_bypass_disable=auto.
 -
                        Default mitigations:
                        X86:    If CONFIG_SECCOMP=y "seccomp", otherwise "prctl"
  
 +                      On powerpc the options are:
 +
 +                      on,auto - On Power8 and Power9 insert a store-forwarding
 +                                barrier on kernel entry and exit. On Power7
 +                                perform a software flush on kernel entry and
 +                                exit.
 +                      off     - No action.
 +
 +                      Not specifying this option is equivalent to
 +                      spec_store_bypass_disable=auto.
 +
        spia_io_base=   [HW,MTD]
        spia_fio_base=
        spia_pedr=
        xirc2ps_cs=     [NET,PCMCIA]
                        Format:
                        <irq>,<irq_mask>,<io>,<full_duplex>,<do_sound>,<lockup_hack>[,<irq2>[,<irq3>[,<irq4>]]]
 +
 +      xhci-hcd.quirks         [USB,KNL]
 +                      A hex value specifying bitmask with supplemental xhci
 +                      host controller quirks. Meaning of each bit can be
 +                      consulted in header drivers/usb/host/xhci.h.
diff --combined lib/vsprintf.c
index cda1862302875e05097f4979b4e20203f1015ba8,1ee2829f3b54a69b63f7a3d20cd14bd4d0886b56..d5b3a3f95c01c870591a26413c0fb90c6d9f0fc2
@@@ -1651,6 -1651,17 +1651,17 @@@ char *device_node_string(char *buf, cha
        return widen_string(buf, buf - buf_start, end, spec);
  }
  
+ /* Make pointers available for printing early in the boot sequence. */
+ static int debug_boot_weak_hash __ro_after_init;
+ static int __init debug_boot_weak_hash_enable(char *str)
+ {
+       debug_boot_weak_hash = 1;
+       pr_info("debug_boot_weak_hash enabled\n");
+       return 0;
+ }
+ early_param("debug_boot_weak_hash", debug_boot_weak_hash_enable);
  static DEFINE_STATIC_KEY_TRUE(not_filled_random_ptr_key);
  static siphash_key_t ptr_key __read_mostly;
  
@@@ -1675,8 -1686,16 +1686,16 @@@ static struct random_ready_callback ran
  
  static int __init initialize_ptr_random(void)
  {
-       int ret = add_random_ready_callback(&random_ready);
+       int key_size = sizeof(ptr_key);
+       int ret;
  
+       /* Use hw RNG if available. */
+       if (get_random_bytes_arch(&ptr_key, key_size) == key_size) {
+               static_branch_disable(&not_filled_random_ptr_key);
+               return 0;
+       }
+       ret = add_random_ready_callback(&random_ready);
        if (!ret) {
                return 0;
        } else if (ret == -EALREADY) {
@@@ -1695,6 -1714,12 +1714,12 @@@ static char *ptr_to_id(char *buf, char 
        const char *str = sizeof(ptr) == 8 ? "(____ptrval____)" : "(ptrval)";
        unsigned long hashval;
  
+       /* When debugging early boot use non-cryptographically secure hash. */
+       if (unlikely(debug_boot_weak_hash)) {
+               hashval = hash_long((unsigned long)ptr, 32);
+               return pointer_string(buf, end, (const void *)hashval, spec);
+       }
        if (static_branch_unlikely(&not_filled_random_ptr_key)) {
                spec.field_width = 2 * sizeof(ptr);
                /* string length must be less than default_width */
@@@ -1942,7 -1967,6 +1967,7 @@@ char *pointer(const char *fmt, char *bu
                case 'F':
                        return device_node_string(buf, end, ptr, spec, fmt + 1);
                }
 +              break;
        case 'x':
                return pointer_string(buf, end, ptr, spec);
        }
This page took 0.103985 seconds and 4 git commands to generate.