]> Git Repo - linux.git/commitdiff
Merge tag 'integrity-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar...
authorLinus Torvalds <[email protected]>
Mon, 22 Feb 2021 01:08:06 +0000 (17:08 -0800)
committerLinus Torvalds <[email protected]>
Mon, 22 Feb 2021 01:08:06 +0000 (17:08 -0800)
Pull IMA updates from Mimi Zohar:
 "New is IMA support for measuring kernel critical data, as per usual
  based on policy. The first example measures the in memory SELinux
  policy. The second example measures the kernel version.

  In addition are four bug fixes to address memory leaks and a missing
  'static' function declaration"

* tag 'integrity-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
  integrity: Make function integrity_add_key() static
  ima: Free IMA measurement buffer after kexec syscall
  ima: Free IMA measurement buffer on error
  IMA: Measure kernel version in early boot
  selinux: include a consumer of the new IMA critical data hook
  IMA: define a builtin critical data measurement policy
  IMA: extend critical data hook to limit the measurement based on a label
  IMA: limit critical data measurement based on a label
  IMA: add policy rule to measure critical data
  IMA: define a hook to measure kernel integrity critical data
  IMA: add support to measure buffer data hash
  IMA: generalize keyring specific measurement constructs
  evm: Fix memleak in init_desc

1  2 
Documentation/admin-guide/kernel-parameters.txt
security/selinux/include/security.h
security/selinux/ss/services.c

index 07f9372b494aa134740facf4d2821a489545333c,65a0c4c9ab182b1efdcf3a255420cb4f18e2a529..4fc20f9af2fb945c5334e05c1a35a750c377eefc
        arcrimi=        [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards
                        Format: <io>,<irq>,<nodeID>
  
 +      arm64.nobti     [ARM64] Unconditionally disable Branch Target
 +                      Identification support
 +
 +      arm64.nopauth   [ARM64] Unconditionally disable Pointer Authentication
 +                      support
 +
        ataflop=        [HW,M68k]
  
        atarimouse=     [HW,MOUSE] Atari Mouse
                        insecure, please do not use on production kernels.
  
        debug_locks_verbose=
 -                      [KNL] verbose self-tests
 -                      Format=<0|1>
 +                      [KNL] verbose locking self-tests
 +                      Format: <int>
                        Print debugging info while doing the locking API
                        self-tests.
 -                      We default to 0 (no extra messages), setting it to
 -                      1 will print _a lot_ more information - normally
 -                      only useful to kernel developers.
 +                      Bitmask for the various LOCKTYPE_ tests. Defaults to 0
 +                      (no extra messages), setting it to -1 (all bits set)
 +                      will print _a_lot_ more information - normally only
 +                      useful to lockdep developers.
  
        debug_objects   [KNL] Enable object debugging
  
                        causing system reset or hang due to sending
                        INIT from AP to BSP.
  
 -      perf_v4_pmi=    [X86,INTEL]
 -                      Format: <bool>
 -                      Disable Intel PMU counter freezing feature.
 -                      The feature only exists starting from
 -                      Arch Perfmon v4 (Skylake and newer).
 -
        disable_ddw     [PPC/PSERIES]
                        Disable Dynamic DMA Window support. Use this
                        to workaround buggy firmware.
        ima_policy=     [IMA]
                        The builtin policies to load during IMA setup.
                        Format: "tcb | appraise_tcb | secure_boot |
-                                fail_securely"
+                                fail_securely | critical_data"
  
                        The "tcb" policy measures all programs exec'd, files
                        mmap'd for exec, and all files opened with the read
                        filesystems with the SB_I_UNVERIFIABLE_SIGNATURE
                        flag.
  
+                       The "critical_data" policy measures kernel integrity
+                       critical data.
        ima_tcb         [IMA] Deprecated.  Use ima_policy= instead.
                        Load a policy which meets the needs of the Trusted
                        Computing Base.  This means IMA will measure all
        kvm-arm.mode=
                        [KVM,ARM] Select one of KVM/arm64's modes of operation.
  
 +                      nvhe: Standard nVHE-based mode, without support for
 +                            protected guests.
 +
                        protected: nVHE-based mode with support for guests whose
                                   state is kept private from the host.
                                   Not valid if the kernel is running in EL2.
                        For example, to override I2C bus2:
                        omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100
  
 -      oprofile.timer= [HW]
 -                      Use timer interrupt instead of performance counters
 -
 -      oprofile.cpu_type=      Force an oprofile cpu type
 -                      This might be useful if you have an older oprofile
 -                      userland or if you want common events.
 -                      Format: { arch_perfmon }
 -                      arch_perfmon: [X86] Force use of architectural
 -                              perfmon on Intel CPUs instead of the
 -                              CPU specific event set.
 -                      timer: [X86] Force use of architectural NMI
 -                              timer mode (see also oprofile.timer
 -                              for generic hr timer mode)
 -
        oops=panic      Always panic on oopses. Default is to just kill the
                        process, but there is a small probability of
                        deadlocking the machine.
                        Format: {"off"}
                        Disable Hardware Transactional Memory
  
 +      preempt=        [KNL]
 +                      Select preemption mode if you have CONFIG_PREEMPT_DYNAMIC
 +                      none - Limited to cond_resched() calls
 +                      voluntary - Limited to cond_resched() and might_sleep() calls
 +                      full - Any section that isn't explicitly preempt disabled
 +                             can be preempted anytime.
 +
        print-fatal-signals=
                        [KNL] debug: print fatal signals
  
                        value, meaning that RCU_SOFTIRQ is used by default.
                        Specify rcutree.use_softirq=0 to use rcuc kthreads.
  
 +                      But note that CONFIG_PREEMPT_RT=y kernels disable
 +                      this kernel boot parameter, forcibly setting it
 +                      to zero.
 +
        rcutree.rcu_fanout_exact= [KNL]
                        Disable autobalancing of the rcu_node combining
                        tree.  This is used by rcutorture, and might
                        Set wakeup interval for idle CPUs that have
                        RCU callbacks (RCU_FAST_NO_HZ=y).
  
 -      rcutree.rcu_idle_lazy_gp_delay= [KNL]
 -                      Set wakeup interval for idle CPUs that have
 -                      only "lazy" RCU callbacks (RCU_FAST_NO_HZ=y).
 -                      Lazy RCU callbacks are those which RCU can
 -                      prove do nothing more than free memory.
 -
        rcutree.rcu_kick_kthreads= [KNL]
                        Cause the grace-period kthread to get an extra
                        wake_up() if it sleeps three times longer than
                        stress RCU, they don't participate in the actual
                        test, hence the "fake".
  
 +      rcutorture.nocbs_nthreads= [KNL]
 +                      Set number of RCU callback-offload togglers.
 +                      Zero (the default) disables toggling.
 +
 +      rcutorture.nocbs_toggle= [KNL]
 +                      Set the delay in milliseconds between successive
 +                      callback-offload toggling attempts.
 +
        rcutorture.nreaders= [KNL]
                        Set number of RCU readers.  The value -1 selects
                        N-1, where N is the number of CPUs.  A value
                        only normal grace-period primitives.  No effect
                        on CONFIG_TINY_RCU kernels.
  
 +                      But note that CONFIG_PREEMPT_RT=y kernels enables
 +                      this kernel boot parameter, forcibly setting
 +                      it to the value one, that is, converting any
 +                      post-boot attempt at an expedited RCU grace
 +                      period to instead use normal non-expedited
 +                      grace-period processing.
 +
        rcupdate.rcu_task_ipi_delay= [KNL]
                        Set time in jiffies during which RCU tasks will
                        avoid sending IPIs, starting with the beginning
        refscale.verbose= [KNL]
                        Enable additional printk() statements.
  
 +      refscale.verbose_batched= [KNL]
 +                      Batch the additional printk() statements.  If zero
 +                      (the default) or negative, print everything.  Otherwise,
 +                      print every Nth verbose statement, where N is the value
 +                      specified.
 +
        relax_domain_level=
                        [KNL, SMP] Set scheduler's default relax_domain_level.
                        See Documentation/admin-guide/cgroup-v1/cpusets.rst.
                        are running concurrently, especially on systems
                        with rotating-rust storage.
  
 +      torture.verbose_sleep_frequency= [KNL]
 +                      Specifies how many verbose printk()s should be
 +                      emitted between each sleep.  The default of zero
 +                      disables verbose-printk() sleeping.
 +
 +      torture.verbose_sleep_duration= [KNL]
 +                      Duration of each verbose-printk() sleep in jiffies.
 +
        tp720=          [HW,PS2]
  
        tpm_suspend_pcr=[HW,TPM]
                        This option is obsoleted by the "nopv" option, which
                        has equivalent effect for XEN platform.
  
 +      xen_no_vector_callback
 +                      [KNL,X86,XEN] Disable the vector callback for Xen
 +                      event channel interrupts.
 +
        xen_scrub_pages=        [XEN]
                        Boolean option to control scrubbing pages before giving them back
                        to Xen, for use by other domains. Can be also changed at runtime
index 765a258a899ef00d2c9d37010a15a4001da0208e,29cae32d3fc5d517fc0bc8cd38fd97eb32056db8..6fe25300b89dc5b7aa40e55c0a525d691fe3f364
@@@ -229,7 -229,8 +229,8 @@@ void selinux_policy_cancel(struct selin
                        struct selinux_policy *policy);
  int security_read_policy(struct selinux_state *state,
                         void **data, size_t *len);
+ int security_read_state_kernel(struct selinux_state *state,
+                              void **data, size_t *len);
  int security_policycap_supported(struct selinux_state *state,
                                 unsigned int req_cap);
  
@@@ -436,6 -437,7 +437,6 @@@ extern void selinux_complete_init(void)
  extern int selinux_disable(struct selinux_state *state);
  extern void exit_sel_fs(void);
  extern struct path selinux_null;
 -extern struct vfsmount *selinuxfs_mount;
  extern void selnl_notify_setenforce(int val);
  extern void selnl_notify_policyload(u32 seqno);
  extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
index 5e08ce2c5994a43e7fd1901d3a4e16ea57009e5c,2106b5d383e730289008ef809cd35ce869fee7ef..3438d0130378610132edaf6a1c8e846076f6b8fb
@@@ -65,6 -65,7 +65,7 @@@
  #include "ebitmap.h"
  #include "audit.h"
  #include "policycap_names.h"
+ #include "ima.h"
  
  /* Forward declaration. */
  static int context_struct_to_string(struct policydb *policydb,
@@@ -2178,6 -2179,7 +2179,7 @@@ static void selinux_notify_policy_chang
        selinux_status_update_policyload(state, seqno);
        selinux_netlbl_cache_invalidate();
        selinux_xfrm_notify_policyload();
+       selinux_ima_measure_state(state);
  }
  
  void selinux_policy_commit(struct selinux_state *state,
        return match;
  }
  
 -static int (*aurule_callback)(void) = audit_update_lsm_rules;
 -
  static int aurule_avc_callback(u32 event)
  {
 -      int err = 0;
 -
 -      if (event == AVC_CALLBACK_RESET && aurule_callback)
 -              err = aurule_callback();
 -      return err;
 +      if (event == AVC_CALLBACK_RESET)
 +              return audit_update_lsm_rules();
 +      return 0;
  }
  
  static int __init aurule_init(void)
  }
  #endif /* CONFIG_NETLABEL */
  
+ /**
+  * __security_read_policy - read the policy.
+  * @policy: SELinux policy
+  * @data: binary policy data
+  * @len: length of data in bytes
+  *
+  */
+ static int __security_read_policy(struct selinux_policy *policy,
+                                 void *data, size_t *len)
+ {
+       int rc;
+       struct policy_file fp;
+       fp.data = data;
+       fp.len = *len;
+       rc = policydb_write(&policy->policydb, &fp);
+       if (rc)
+               return rc;
+       *len = (unsigned long)fp.data - (unsigned long)data;
+       return 0;
+ }
  /**
   * security_read_policy - read the policy.
+  * @state: selinux_state
   * @data: binary policy data
   * @len: length of data in bytes
   *
@@@ -3879,8 -3910,6 +3906,6 @@@ int security_read_policy(struct selinux
                         void **data, size_t *len)
  {
        struct selinux_policy *policy;
-       int rc;
-       struct policy_file fp;
  
        policy = rcu_dereference_protected(
                        state->policy, lockdep_is_held(&state->policy_mutex));
        if (!*data)
                return -ENOMEM;
  
-       fp.data = *data;
-       fp.len = *len;
+       return __security_read_policy(policy, *data, len);
+ }
  
-       rc = policydb_write(&policy->policydb, &fp);
-       if (rc)
-               return rc;
+ /**
+  * security_read_state_kernel - read the policy.
+  * @state: selinux_state
+  * @data: binary policy data
+  * @len: length of data in bytes
+  *
+  * Allocates kernel memory for reading SELinux policy.
+  * This function is for internal use only and should not
+  * be used for returning data to user space.
+  *
+  * This function must be called with policy_mutex held.
+  */
+ int security_read_state_kernel(struct selinux_state *state,
+                              void **data, size_t *len)
+ {
+       struct selinux_policy *policy;
  
-       *len = (unsigned long)fp.data - (unsigned long)*data;
-       return 0;
+       policy = rcu_dereference_protected(
+                       state->policy, lockdep_is_held(&state->policy_mutex));
+       if (!policy)
+               return -EINVAL;
+       *len = policy->policydb.len;
+       *data = vmalloc(*len);
+       if (!*data)
+               return -ENOMEM;
  
+       return __security_read_policy(policy, *data, len);
  }
This page took 0.14739 seconds and 4 git commands to generate.