1. 27 Jul, 2020 1 commit
  2. 20 Jul, 2020 10 commits
    • Bruno Meneguele's avatar
      ima: move APPRAISE_BOOTPARAM dependency on ARCH_POLICY to runtime · 311aa6aa
      Bruno Meneguele authored
      The IMA_APPRAISE_BOOTPARAM config allows enabling different "ima_appraise="
      modes - log, fix, enforce - at run time, but not when IMA architecture
      specific policies are enabled.  This prevents properly labeling the
      filesystem on systems where secure boot is supported, but not enabled on the
      platform.  Only when secure boot is actually enabled should these IMA
      appraise modes be disabled.
      
      This patch removes the compile time dependency and makes it a runtime
      decision, based on the secure boot state of that platform.
      
      Test results as follows:
      
      -> x86-64 with secure boot enabled
      
      [    0.015637] Kernel command line: <...> ima_policy=appraise_tcb ima_appraise=fix
      [    0.015668] ima: Secure boot enabled: ignoring ima_appraise=fix boot parameter option
      
      -> powerpc with secure boot disabled
      
      [    0.000000] Kernel command line: <...> ima_policy=appraise_tcb ima_appraise=fix
      [    0.000000] Secure boot mode disabled
      
      -> Running the system without secure boot and with both options set:
      
      CONFIG_IMA_APPRAISE_BOOTPARAM=y
      CONFIG_IMA_ARCH_POLICY=y
      
      Audit prompts "missing-hash" but still allow execution and, consequently,
      filesystem labeling:
      
      type=INTEGRITY_DATA msg=audit(07/09/2020 12:30:27.778:1691) : pid=4976
      uid=root auid=root ses=2
      subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 op=appraise_data
      cause=missing-hash comm=bash name=/usr/bin/evmctl dev="dm-0" ino=493150
      res=no
      
      Cc: stable@vger.kernel.org
      Fixes: d958083a ("x86/ima: define arch_get_ima_policy() for x86")
      Signed-off-by: default avatarBruno Meneguele <bmeneg@redhat.com>
      Cc: stable@vger.kernel.org # 5.0
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      311aa6aa
    • Tyler Hicks's avatar
      ima: AppArmor satisfies the audit rule requirements · 1768215a
      Tyler Hicks authored
      AppArmor meets all the requirements for IMA in terms of audit rules
      since commit e79c26d0 ("apparmor: Add support for audit rule
      filtering"). Update IMA's Kconfig section for CONFIG_IMA_LSM_RULES to
      reflect this.
      
      Fixes: e79c26d0 ("apparmor: Add support for audit rule filtering")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      1768215a
    • Tyler Hicks's avatar
      ima: Rename internal filter rule functions · b8867eed
      Tyler Hicks authored
      Rename IMA's internal filter rule functions from security_filter_rule_*()
      to ima_filter_rule_*(). This avoids polluting the security_* namespace,
      which is typically reserved for general security subsystem
      infrastructure.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Suggested-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      [zohar@linux.ibm.com: reword using the term "filter", not "audit"]
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      b8867eed
    • Mimi Zohar's avatar
      Merge branch 'validate-policy-rules' into next-integrity · a068d937
      Mimi Zohar authored
      From "ima: Fix rule parsing bugs and extend KEXEC_CMDLINE rule support"
      coverletter.
      
      This series ultimately extends the supported IMA rule conditionals for
      the KEXEC_CMDLINE hook function. As of today, there's an imbalance in
      IMA language conditional support for KEXEC_CMDLINE rules in comparison
      to KEXEC_KERNEL_CHECK and KEXEC_INITRAMFS_CHECK rules. The KEXEC_CMDLINE
      rules do not support *any* conditionals so you cannot have a sequence of
      rules like this:
      
       dont_measure func=KEXEC_KERNEL_CHECK obj_type=foo_t
       dont_measure func=KEXEC_INITRAMFS_CHECK obj_type=foo_t
       dont_measure func=KEXEC_CMDLINE obj_type=foo_t
       measure func=KEXEC_KERNEL_CHECK
       measure func=KEXEC_INITRAMFS_CHECK
       measure func=KEXEC_CMDLINE
      
      Instead, KEXEC_CMDLINE rules can only be measured or not measured and
      there's no additional flexibility in today's implementation of the
      KEXEC_CMDLINE hook function.
      
      With this series, the above sequence of rules becomes valid and any
      calls to kexec_file_load() with a kernel and initramfs inode type of
      foo_t will not be measured (that includes the kernel cmdline buffer)
      while all other objects given to a kexec_file_load() syscall will be
      measured. There's obviously not an inode directly associated with the
      kernel cmdline buffer but this patch series ties the inode based
      decision making for KEXEC_CMDLINE to the kernel's inode. I think this
      will be intuitive to policy authors.
      
      While reading IMA code and preparing to make this change, I realized
      that the buffer based hook functions (KEXEC_CMDLINE and KEY_CHECK) are
      quite special in comparison to longer standing hook functions. These
      buffer based hook functions can only support measure actions and there
      are some restrictions on the conditionals that they support. However,
      the rule parser isn't enforcing any of those restrictions and IMA policy
      authors wouldn't have any immediate way of knowing that the policy that
      they wrote is invalid. For example, the sequence of rules above parses
      successfully in today's kernel but the
      "dont_measure func=KEXEC_CMDLINE ..." rule is incorrectly handled in
      ima_match_rules(). The dont_measure rule is *always* considered to be a
      match so, surprisingly, no KEXEC_CMDLINE measurements are made.
      
      While making the rule parser more strict, I realized that the parser
      does not correctly free all of the allocated memory associated with an
      ima_rule_entry when going down some error paths. Invalid policy loaded
      by the policy administrator could result in small memory leaks.
      a068d937
    • Tyler Hicks's avatar
      ima: Support additional conditionals in the KEXEC_CMDLINE hook function · 4834177e
      Tyler Hicks authored
      Take the properties of the kexec kernel's inode and the current task
      ownership into consideration when matching a KEXEC_CMDLINE operation to
      the rules in the IMA policy. This allows for some uniformity when
      writing IMA policy rules for KEXEC_KERNEL_CHECK, KEXEC_INITRAMFS_CHECK,
      and KEXEC_CMDLINE operations.
      
      Prior to this patch, it was not possible to write a set of rules like
      this:
      
       dont_measure func=KEXEC_KERNEL_CHECK obj_type=foo_t
       dont_measure func=KEXEC_INITRAMFS_CHECK obj_type=foo_t
       dont_measure func=KEXEC_CMDLINE obj_type=foo_t
       measure func=KEXEC_KERNEL_CHECK
       measure func=KEXEC_INITRAMFS_CHECK
       measure func=KEXEC_CMDLINE
      
      The inode information associated with the kernel being loaded by a
      kexec_kernel_load(2) syscall can now be included in the decision to
      measure or not
      
      Additonally, the uid, euid, and subj_* conditionals can also now be
      used in KEXEC_CMDLINE rules. There was no technical reason as to why
      those conditionals weren't being considered previously other than
      ima_match_rules() didn't have a valid inode to use so it immediately
      bailed out for KEXEC_CMDLINE operations rather than going through the
      full list of conditional comparisons.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: kexec@lists.infradead.org
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      4834177e
    • Tyler Hicks's avatar
      ima: Use the common function to detect LSM conditionals in a rule · 592b24cb
      Tyler Hicks authored
      Make broader use of ima_rule_contains_lsm_cond() to check if a given
      rule contains an LSM conditional. This is a code cleanup and has no
      user-facing change.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      592b24cb
    • Tyler Hicks's avatar
      ima: Move comprehensive rule validation checks out of the token parser · 30031b0e
      Tyler Hicks authored
      Use ima_validate_rule(), at the end of the token parsing stage, to
      verify combinations of actions, hooks, and flags. This is useful to
      increase readability by consolidating such checks into a single function
      and also because rule conditionals can be specified in arbitrary order
      making it difficult to do comprehensive rule validation until the entire
      rule has been parsed.
      
      This allows for the check that ties together the "keyrings" conditional
      with the KEY_CHECK function hook to be moved into the final rule
      validation.
      
      The modsig check no longer needs to compiled conditionally because the
      token parser will ensure that modsig support is enabled before accepting
      "imasig|modsig" appraise type values. The final rule validation will
      ensure that appraise_type and appraise_flag options are only present in
      appraise rules.
      
      Finally, this allows for the check that ties together the "pcr"
      conditional with the measure action to be moved into the final rule
      validation.
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      30031b0e
    • Tyler Hicks's avatar
      ima: Use correct type for the args_p member of ima_rule_entry.lsm elements · aa0c0227
      Tyler Hicks authored
      Make args_p be of the char pointer type rather than have it be a void
      pointer that gets casted to char pointer when it is used. It is a simple
      NUL-terminated string as returned by match_strdup().
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      aa0c0227
    • Tyler Hicks's avatar
      ima: Shallow copy the args_p member of ima_rule_entry.lsm elements · 39e5993d
      Tyler Hicks authored
      The args_p member is a simple string that is allocated by
      ima_rule_init(). Shallow copy it like other non-LSM references in
      ima_rule_entry structs.
      
      There are no longer any necessary error path cleanups to do in
      ima_lsm_copy_rule().
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      39e5993d
    • Tyler Hicks's avatar
      ima: Fail rule parsing when appraise_flag=blacklist is unsupportable · 5f3e9265
      Tyler Hicks authored
      Verifying that a file hash is not blacklisted is currently only
      supported for files with appended signatures (modsig).  In the future,
      this might change.
      
      For now, the "appraise_flag" option is only appropriate for appraise
      actions and its "blacklist" value is only appropriate when
      CONFIG_IMA_APPRAISE_MODSIG is enabled and "appraise_flag=blacklist" is
      only appropriate when "appraise_type=imasig|modsig" is also present.
      Make this clear at policy load so that IMA policy authors don't assume
      that other uses of "appraise_flag=blacklist" are supported.
      
      Fixes: 273df864 ("ima: Check against blacklisted hashes for files with modsig")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Reivewed-by: default avatarNayna Jain <nayna@linux.ibm.com>
      Tested-by: default avatarNayna Jain <nayna@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      5f3e9265
  3. 17 Jul, 2020 8 commits
    • Tyler Hicks's avatar
      ima: Fail rule parsing when the KEY_CHECK hook is combined with an invalid cond · eb624fe2
      Tyler Hicks authored
      The KEY_CHECK function only supports the uid, pcr, and keyrings
      conditionals. Make this clear at policy load so that IMA policy authors
      don't assume that other conditionals are supported.
      
      Fixes: 5808611c ("IMA: Add KEY_CHECK func to measure keys")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      eb624fe2
    • Tyler Hicks's avatar
      ima: Fail rule parsing when the KEXEC_CMDLINE hook is combined with an invalid cond · db2045f5
      Tyler Hicks authored
      The KEXEC_CMDLINE hook function only supports the pcr conditional. Make
      this clear at policy load so that IMA policy authors don't assume that
      other conditionals are supported.
      
      Since KEXEC_CMDLINE's inception, ima_match_rules() has always returned
      true on any loaded KEXEC_CMDLINE rule without any consideration for
      other conditionals present in the rule. Make it clear that pcr is the
      only supported KEXEC_CMDLINE conditional by returning an error during
      policy load.
      
      An example of why this is a problem can be explained with the following
      rule:
      
       dont_measure func=KEXEC_CMDLINE obj_type=foo_t
      
      An IMA policy author would have assumed that rule is valid because the
      parser accepted it but the result was that measurements for all
      KEXEC_CMDLINE operations would be disabled.
      
      Fixes: b0935123 ("IMA: Define a new hook to measure the kexec boot command line arguments")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      db2045f5
    • Tyler Hicks's avatar
      ima: Fail rule parsing when buffer hook functions have an invalid action · 71218343
      Tyler Hicks authored
      Buffer based hook functions, such as KEXEC_CMDLINE and KEY_CHECK, can
      only measure. The process_buffer_measurement() function quietly ignores
      all actions except measure so make this behavior clear at the time of
      policy load.
      
      The parsing of the keyrings conditional had a check to ensure that it
      was only specified with measure actions but the check should be on the
      hook function and not the keyrings conditional since
      "appraise func=KEY_CHECK" is not a valid rule.
      
      Fixes: b0935123 ("IMA: Define a new hook to measure the kexec boot command line arguments")
      Fixes: 5808611c ("IMA: Add KEY_CHECK func to measure keys")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      71218343
    • Tyler Hicks's avatar
      ima: Free the entire rule if it fails to parse · 2bdd737c
      Tyler Hicks authored
      Use ima_free_rule() to fix memory leaks of allocated ima_rule_entry
      members, such as .fsname and .keyrings, when an error is encountered
      during rule parsing.
      
      Set the args_p pointer to NULL after freeing it in the error path of
      ima_lsm_rule_init() so that it isn't freed twice.
      
      This fixes a memory leak seen when loading an rule that contains an
      additional piece of allocated memory, such as an fsname, followed by an
      invalid conditional:
      
       # echo "measure fsname=tmpfs bad=cond" > /sys/kernel/security/ima/policy
       -bash: echo: write error: Invalid argument
       # echo scan > /sys/kernel/debug/kmemleak
       # cat /sys/kernel/debug/kmemleak
       unreferenced object 0xffff98e7e4ece6c0 (size 8):
         comm "bash", pid 672, jiffies 4294791843 (age 21.855s)
         hex dump (first 8 bytes):
           74 6d 70 66 73 00 6b a5                          tmpfs.k.
         backtrace:
           [<00000000abab7413>] kstrdup+0x2e/0x60
           [<00000000f11ede32>] ima_parse_add_rule+0x7d4/0x1020
           [<00000000f883dd7a>] ima_write_policy+0xab/0x1d0
           [<00000000b17cf753>] vfs_write+0xde/0x1d0
           [<00000000b8ddfdea>] ksys_write+0x68/0xe0
           [<00000000b8e21e87>] do_syscall_64+0x56/0xa0
           [<0000000089ea7b98>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: f1b08bbc ("ima: define a new policy condition based on the filesystem name")
      Fixes: 2b60c0ec ("IMA: Read keyrings= option from the IMA policy")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      2bdd737c
    • Tyler Hicks's avatar
      ima: Free the entire rule when deleting a list of rules · 465aee77
      Tyler Hicks authored
      Create a function, ima_free_rule(), to free all memory associated with
      an ima_rule_entry. Use the new function to fix memory leaks of allocated
      ima_rule_entry members, such as .fsname and .keyrings, when deleting a
      list of rules.
      
      Make the existing ima_lsm_free_rule() function specific to the LSM
      audit rule array of an ima_rule_entry and require that callers make an
      additional call to kfree to free the ima_rule_entry itself.
      
      This fixes a memory leak seen when loading by a valid rule that contains
      an additional piece of allocated memory, such as an fsname, followed by
      an invalid rule that triggers a policy load failure:
      
       # echo -e "dont_measure fsname=securityfs\nbad syntax" > \
          /sys/kernel/security/ima/policy
       -bash: echo: write error: Invalid argument
       # echo scan > /sys/kernel/debug/kmemleak
       # cat /sys/kernel/debug/kmemleak
       unreferenced object 0xffff9bab67ca12c0 (size 16):
         comm "bash", pid 684, jiffies 4295212803 (age 252.344s)
         hex dump (first 16 bytes):
           73 65 63 75 72 69 74 79 66 73 00 6b 6b 6b 6b a5  securityfs.kkkk.
         backtrace:
           [<00000000adc80b1b>] kstrdup+0x2e/0x60
           [<00000000d504cb0d>] ima_parse_add_rule+0x7d4/0x1020
           [<00000000444825ac>] ima_write_policy+0xab/0x1d0
           [<000000002b7f0d6c>] vfs_write+0xde/0x1d0
           [<0000000096feedcf>] ksys_write+0x68/0xe0
           [<0000000052b544a2>] do_syscall_64+0x56/0xa0
           [<000000007ead1ba7>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: f1b08bbc ("ima: define a new policy condition based on the filesystem name")
      Fixes: 2b60c0ec ("IMA: Read keyrings= option from the IMA policy")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      465aee77
    • Tyler Hicks's avatar
      ima: Have the LSM free its audit rule · 9ff8a616
      Tyler Hicks authored
      Ask the LSM to free its audit rule rather than directly calling kfree().
      Both AppArmor and SELinux do additional work in their audit_rule_free()
      hooks. Fix memory leaks by allowing the LSMs to perform necessary work.
      
      Fixes: b1694245 ("ima: use the lsm policy update notifier")
      Signed-off-by: default avatarTyler Hicks <tyhicks@linux.microsoft.com>
      Cc: Janne Karhunen <janne.karhunen@gmail.com>
      Cc: Casey Schaufler <casey@schaufler-ca.com>
      Reviewed-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      9ff8a616
    • Lakshmi Ramasubramanian's avatar
      IMA: Add audit log for failure conditions · 34e980bb
      Lakshmi Ramasubramanian authored
      process_buffer_measurement() and ima_alloc_key_entry() functions need to
      log an audit message for auditing integrity measurement failures.
      
      Add audit message in these two functions. Remove "pr_devel" log message
      in process_buffer_measurement().
      
      Sample audit messages:
      
      [    6.303048] audit: type=1804 audit(1592506281.627:2): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel op=measuring_key cause=ENOMEM comm="swapper/0" name=".builtin_trusted_keys" res=0 errno=-12
      
      [    8.019432] audit: type=1804 audit(1592506283.344:10): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 op=measuring_kexec_cmdline cause=hashing_error comm="systemd" name="kexec-cmdline" res=0 errno=-22
      Signed-off-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Suggested-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      34e980bb
    • Lakshmi Ramasubramanian's avatar
      integrity: Add errno field in audit message · 2f845882
      Lakshmi Ramasubramanian authored
      Error code is not included in the audit messages logged by
      the integrity subsystem.
      
      Define a new function integrity_audit_message() that takes error code
      in the "errno" parameter. Add "errno" field in the audit messages logged
      by the integrity subsystem and set the value passed in the "errno"
      parameter.
      
      [    6.303048] audit: type=1804 audit(1592506281.627:2): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel op=measuring_key cause=ENOMEM comm="swapper/0" name=".builtin_trusted_keys" res=0 errno=-12
      
      [    7.987647] audit: type=1802 audit(1592506283.312:9): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 op=policy_update cause=completed comm="systemd" res=1 errno=0
      
      [    8.019432] audit: type=1804 audit(1592506283.344:10): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 op=measuring_kexec_cmdline cause=hashing_error comm="systemd" name="kexec-cmdline" res=0 errno=-22
      Signed-off-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Suggested-by: default avatarSteve Grubb <sgrubb@redhat.com>
      Suggested-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      2f845882
  4. 25 Jun, 2020 1 commit
  5. 21 Jun, 2020 10 commits
    • Linus Torvalds's avatar
      Linux 5.8-rc2 · 48778464
      Linus Torvalds authored
      48778464
    • Linus Torvalds's avatar
      Merge tag 'selinux-pr-20200621' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux · 817d914d
      Linus Torvalds authored
      Pull SELinux fixes from Paul Moore:
       "Three small patches to fix problems in the SELinux code, all found via
        clang.
      
        Two patches fix potential double-free conditions and one fixes an
        undefined return value"
      
      * tag 'selinux-pr-20200621' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
        selinux: fix undefined return of cond_evaluate_expr
        selinux: fix a double free in cond_read_node()/cond_read_list()
        selinux: fix double free
      817d914d
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 16f4aa9b
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Some early fixes collected during the first week after the merge
        window, all pretty self-evident, with the details below. The revert is
        the crucial thing.
      
         - Fix a warning on the Qualcomm SPMI GPIO chip being instatiated
           twice without a unique irqchip struct
      
         - Use the noirq variants of the suspend and resume callbacks in the
           Tegra driver
      
         - Clean up the errorpath on the MCP23s08 driver
      
         - Revert the use of devm_of_iomap() in the Freescale driver as it was
           regressing the platform
      
         - Add some missing pins in the Qualcomm IPQ6018 driver
      
         - Fix a simple documentation bug in the pinctrl-single driver"
      
      * tag 'pinctrl-v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: single: fix function name in documentation
        pinctrl: qcom: ipq6018 Add missing pins in qpic pin group
        Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'"
        pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings
        pinctrl: tegra: Use noirq suspend/resume callbacks
        pinctrl: qcom: spmi-gpio: fix warning about irq chip reusage
      16f4aa9b
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.8' of... · be9160a9
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - fix -gz=zlib compiler option test for CONFIG_DEBUG_INFO_COMPRESSED
      
       - improve cc-option in scripts/Kbuild.include to clean up temp files
      
       - improve cc-option in scripts/Kconfig.include for more reliable
         compile option test
      
       - do not copy modules.builtin by 'make install' because it would break
         existing systems
      
       - use 'userprogs' syntax for watch_queue sample
      
      * tag 'kbuild-fixes-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        samples: watch_queue: build sample program for target architecture
        Revert "Makefile: install modules.builtin even if CONFIG_MODULES=n"
        scripts: Fix typo in headers_install.sh
        kconfig: unify cc-option and as-option
        kbuild: improve cc-option to clean up all temporary files
        Makefile: Improve compressed debug info support detection
      be9160a9
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 75613939
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - One fix for the interrupt rework we did last release which broke
         KVM-PR
      
       - Three commits fixing some fallout from the READ_ONCE() changes
         interacting badly with our 8xx 16K pages support, which uses a pte_t
         that is a structure of 4 actual PTEs
      
       - A cleanup of the 8xx pte_update() to use the newly added pmd_off()
      
       - A fix for a crash when handling an oops if CONFIG_DEBUG_VIRTUAL is
         enabled
      
       - A minor fix for the SPU syscall generation
      
      Thanks to Aneesh Kumar K.V, Christian Zigotzky, Christophe Leroy, Mike
      Rapoport, Nicholas Piggin.
      
      * tag 'powerpc-5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/8xx: Provide ptep_get() with 16k pages
        mm: Allow arches to provide ptep_get()
        mm/gup: Use huge_ptep_get() in gup_hugepte()
        powerpc/syscalls: Use the number when building SPU syscall table
        powerpc/8xx: use pmd_off() to access a PMD entry in pte_update()
        powerpc/64s: Fix KVM interrupt using wrong save area
        powerpc: Fix kernel crash in show_instructions() w/DEBUG_VIRTUAL
      75613939
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 93bbca27
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
      
       - NULL dereference in octeontx
      
       - PM reference imbalance in ks-sa
      
       - deadlock in crypto manager
      
       - memory leak in drbg
      
       - missing socket limit check on receive SG list size in algif_skcipher
      
       - typos in caam
      
       - warnings in ccp and hisilicon
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: drbg - always try to free Jitter RNG instance
        crypto: marvell/octeontx - Fix a potential NULL dereference
        crypto: algboss - don't wait during notifier callback
        crypto: caam - fix typos
        crypto: ccp - Fix sparse warnings in sev-dev
        crypto: hisilicon - Cap block size at 2^31
        crypto: algif_skcipher - Cap recv SG list at ctx->used
        hwrng: ks-sa - Fix runtime PM imbalance on error
      93bbca27
    • Masahiro Yamada's avatar
      samples: watch_queue: build sample program for target architecture · 214377e9
      Masahiro Yamada authored
      This userspace program includes UAPI headers exported to usr/include/.
      'make headers' always works for the target architecture (i.e. the same
      architecture as the kernel), so the sample program should be built for
      the target as well. Kbuild now supports 'userprogs' for that.
      
      I also guarded the CONFIG option by 'depends on CC_CAN_LINK' because
      $(CC) may not provide libc.
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      214377e9
    • Masahiro Yamada's avatar
      Revert "Makefile: install modules.builtin even if CONFIG_MODULES=n" · 2c6d9636
      Masahiro Yamada authored
      This reverts commit e0b250b5,
      which broke build systems that need to install files to a certain
      path, but do not set INSTALL_MOD_PATH when invoking 'make install'.
      
        $ make INSTALL_PATH=/tmp/destdir install
        mkdir: cannot create directory ‘/lib/modules/5.8.0-rc1+/’: Permission denied
        Makefile:1342: recipe for target '_builtin_inst_' failed
        make: *** [_builtin_inst_] Error 1
      
      While modules.builtin is useful also for CONFIG_MODULES=n, this change
      in the behavior is quite unexpected. Maybe "make modules_install"
      can install modules.builtin irrespective of CONFIG_MODULES as Jonas
      originally suggested.
      
      Anyway, that commit should be reverted ASAP.
      Reported-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Jonas Karlman <jonas@kwiboo.se>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      2c6d9636
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 64677779
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "One minor fix and two patches reworking the ata dma drain for the
        !CONFIG_LIBATA case. The latter is a 5.7 regression fix"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: Wire up ata_scsi_dma_need_drain for SAS HBA drivers
        scsi: libata: Provide an ata_scsi_dma_need_drain stub for !CONFIG_ATA
        scsi: ufs-bsg: Fix runtime PM imbalance on error
      64677779
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · a5c6a1f0
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
      
       - a small collection of remaining API conversion patches (all acked)
         which allow to finally remove the deprecated API
      
       - some documentation fixes and a MAINTAINERS addition
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        MAINTAINERS: Add robert and myself as qcom i2c cci maintainers
        i2c: smbus: Fix spelling mistake in the comments
        Documentation/i2c: SMBus start signal is S not A
        i2c: remove deprecated i2c_new_device API
        Documentation: media: convert to use i2c_new_client_device()
        video: backlight: tosa_lcd: convert to use i2c_new_client_device()
        x86/platform/intel-mid: convert to use i2c_new_client_device()
        drm: encoder_slave: use new I2C API
        drm: encoder_slave: fix refcouting error for modules
      a5c6a1f0
  6. 20 Jun, 2020 10 commits
    • Drew Fustini's avatar
      pinctrl: single: fix function name in documentation · 25fae752
      Drew Fustini authored
      Use the correct the function name in the documentation for
      "pcs_parse_one_pinctrl_entry()".
      
      "smux_parse_one_pinctrl_entry()" appears to be an artifact from the
      development of a prior patch series ("simple pinmux driver") which
      transformed into pinctrl-single.
      Signed-off-by: default avatarDrew Fustini <drew@beagleboard.org>
      Link: https://lore.kernel.org/r/20200612112758.GA3407886@x1Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      25fae752
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 8b6ddd10
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Have recordmcount work with > 64K sections (to support LTO)
      
       - kprobe RCU fixes
      
       - Correct a kprobe critical section with missing mutex
      
       - Remove redundant arch_disarm_kprobe() call
      
       - Fix lockup when kretprobe triggers within kprobe_flush_task()
      
       - Fix memory leak in fetch_op_data operations
      
       - Fix sleep in atomic in ftrace trace array sample code
      
       - Free up memory on failure in sample trace array code
      
       - Fix incorrect reporting of function_graph fields in format file
      
       - Fix quote within quote parsing in bootconfig
      
       - Fix return value of bootconfig tool
      
       - Add testcases for bootconfig tool
      
       - Fix maybe uninitialized warning in ftrace pid file code
      
       - Remove unused variable in tracing_iter_reset()
      
       - Fix some typos
      
      * tag 'trace-v5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        ftrace: Fix maybe-uninitialized compiler warning
        tools/bootconfig: Add testcase for show-command and quotes test
        tools/bootconfig: Fix to return 0 if succeeded to show the bootconfig
        tools/bootconfig: Fix to use correct quotes for value
        proc/bootconfig: Fix to use correct quotes for value
        tracing: Remove unused event variable in tracing_iter_reset
        tracing/probe: Fix memleak in fetch_op_data operations
        trace: Fix typo in allocate_ftrace_ops()'s comment
        tracing: Make ftrace packed events have align of 1
        sample-trace-array: Remove trace_array 'sample-instance'
        sample-trace-array: Fix sleeping function called from invalid context
        kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
        kprobes: Remove redundant arch_disarm_kprobe() call
        kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
        kprobes: Use non RCU traversal APIs on kprobe_tables if possible
        kprobes: Suppress the suspicious RCU warning on kprobes
        recordmcount: support >64k sections
      8b6ddd10
    • Linus Torvalds's avatar
      Merge tag 'libnvdimm-for-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm · eede2b9b
      Linus Torvalds authored
      Pull libnvdimm updates from Dan Williams:
       "A feature (papr_scm health retrieval) and a fix (sysfs attribute
        visibility) for v5.8.
      
        Vaibhav explains in the merge commit below why missing v5.8 would be
        painful and I agreed to try a -rc2 pull because only cosmetics kept
        this out of -rc1 and his initial versions were posted in more than
        enough time for v5.8 consideration:
      
         'These patches are tied to specific features that were committed to
          customers in upcoming distros releases (RHEL and SLES) whose
          time-lines are tied to 5.8 kernel release.
      
          Being able to track the health of an nvdimm is critical for our
          customers that are running workloads leveraging papr-scm nvdimms.
          Missing the 5.8 kernel would mean missing the distro timelines and
          shifting forward the availability of this feature in distro kernels
          by at least 6 months'
      
        Summary:
      
         - Fix the visibility of the region 'align' attribute.
      
           The new unit tests for region alignment handling caught a corner
           case where the alignment cannot be specified if the region is
           converted from static to dynamic provisioning at runtime.
      
         - Add support for device health retrieval for the persistent memory
           supported by the papr_scm driver.
      
           This includes both the standard sysfs "health flags" that the nfit
           persistent memory driver publishes and a mechanism for the ndctl
           tool to retrieve a health-command payload"
      
      * tag 'libnvdimm-for-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
        nvdimm/region: always show the 'align' attribute
        powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH
        ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods
        powerpc/papr_scm: Improve error logging and handling papr_scm_ndctl()
        powerpc/papr_scm: Fetch nvdimm health information from PHYP
        seq_buf: Export seq_buf_printf
        powerpc: Document details on H_SCM_HEALTH hcall
      eede2b9b
    • Sivaprakash Murugesan's avatar
      pinctrl: qcom: ipq6018 Add missing pins in qpic pin group · 7f5f4de8
      Sivaprakash Murugesan authored
      The patch adds missing qpic data pins to qpic pingroup. These pins are
      necessary for the qpic nand to work.
      
      Fixes: ef1ea54e ("pinctrl: qcom: Add ipq6018 pinctrl driver")
      Signed-off-by: default avatarSivaprakash Murugesan <sivaprak@codeaurora.org>
      Link: https://lore.kernel.org/r/1592541089-17700-1-git-send-email-sivaprak@codeaurora.orgSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      7f5f4de8
    • Haibo Chen's avatar
      Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource... · 13f2d25b
      Haibo Chen authored
      Revert "pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'"
      
      This reverts commit ba403242.
      
      After commit 26d8cde5 ("pinctrl: freescale: imx: add shared
      input select reg support"). i.MX7D has two iomux controllers
      iomuxc and iomuxc-lpsr which share select_input register for
      daisy chain settings.
      If use 'devm_of_iomap()', when probe the iomuxc-lpsr, will call
      devm_request_mem_region() for the region <0x30330000-0x3033ffff>
      for the first time. Then, next time when probe the iomuxc, API
      devm_platform_ioremap_resource() will also use the API
      devm_request_mem_region() for the share region <0x30330000-0x3033ffff>
      again, then cause issue, log like below:
      
      [    0.179561] imx7d-pinctrl 302c0000.iomuxc-lpsr: initialized IMX pinctrl driver
      [    0.191742] imx7d-pinctrl 30330000.pinctrl: can't request region for resource [mem 0x30330000-0x3033ffff]
      [    0.191842] imx7d-pinctrl: probe of 30330000.pinctrl failed with error -16
      
      Fixes: ba403242 ("pinctrl: freescale: imx: Use 'devm_of_iomap()' to avoid a resource leak in case of error in 'imx_pinctrl_probe()'")
      Signed-off-by: default avatarHaibo Chen <haibo.chen@nxp.com>
      Reviewed-by: default avatarDong Aisheng <aisheng.dong@nxp.com>
      Link: https://lore.kernel.org/r/1591673223-1680-1-git-send-email-haibo.chen@nxp.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      13f2d25b
    • Linus Torvalds's avatar
      Merge tag 's390-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 1566feea
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - a few ptrace fixes mostly for strace and seccomp_bpf kernel tests
         findings
      
       - cleanup unused pm callbacks in virtio ccw
      
       - replace kmalloc + memset with kzalloc in crypto
      
       - use $(LD) for vDSO linkage to make clang happy
      
       - fix vDSO clock_getres() to preserve the same behaviour as
         posix_get_hrtimer_res()
      
       - fix workqueue cpumask warning when NUMA=n and nr_node_ids=2
      
       - reduce SLSB writes during input processing, improve warnings and
         cleanup qdio_data usage in qdio
      
       - a few fixes to use scnprintf() instead of snprintf()
      
      * tag 's390-5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390: fix syscall_get_error for compat processes
        s390/qdio: warn about unexpected SLSB states
        s390/qdio: clean up usage of qdio_data
        s390/numa: let NODES_SHIFT depend on NEED_MULTIPLE_NODES
        s390/vdso: fix vDSO clock_getres()
        s390/vdso: Use $(LD) instead of $(CC) to link vDSO
        s390/protvirt: use scnprintf() instead of snprintf()
        s390: use scnprintf() in sys_##_prefix##_##_name##_show
        s390/crypto: use scnprintf() instead of snprintf()
        s390/zcrypt: use kzalloc
        s390/virtio: remove unused pm callbacks
        s390/qdio: reduce SLSB writes during Input Queue processing
        selftests/seccomp: s390 shares the syscall and return value register
        s390/ptrace: fix setting syscall number
        s390/ptrace: pass invalid syscall numbers to tracing
        s390/ptrace: return -ENOSYS when invalid syscall is supplied
        s390/seccomp: pass syscall arguments via seccomp_data
        s390/qdio: fine-tune SLSB update
      1566feea
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 7fdfbe08
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - a workaround for a compiler surprise related to the "r" inline
         assembly that allows LLVM to boot.
      
       - a fix to avoid WX-only mappings, which the ISA does not allow. While
         this probably manifests in many ways, the bug was found in stress-ng.
      
       - a missing lock in set_direct_map_*(), which due to a recent lockdep
         change started asserting.
      
      * tag 'riscv-for-linus-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Acquire mmap lock before invoking walk_page_range
        RISC-V: Don't allow write+exec only page mapping request in mmap
        riscv/atomic: Fix sign extension for RV64I
      7fdfbe08
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-5.8-rc2' of... · 27c27605
      Linus Torvalds authored
      Merge tag 'linux-kselftest-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull kselftest cleanups from Shuah Khan:
      
       - ftrace "requires:" list for simplifying and unifying requirement
         checks for each test case, adding "requires:" line instead of
         checking required ftrace interfaces in each test case.
      
       - a minor spelling correction patch
      
      * tag 'linux-kselftest-5.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/ftrace: Support ":README" suffix for requires
        selftests/ftrace: Support ":tracer" suffix for requires
        selftests/ftrace: Convert check_filter_file() with requires list
        selftests/ftrace: Convert required interface checks into requires list
        selftests/ftrace: Add "requires:" list support
        selftests/ftrace: Return unsupported for the unconfigured features
        selftests/ftrace: Allow ":" in description
        tools: testing: ftrace: trigger: fix spelling mistake
      27c27605
    • David Howells's avatar
      afs: Fix hang on rmmod due to outstanding timer · 5481fc6e
      David Howells authored
      The fileserver probe timer, net->fs_probe_timer, isn't cancelled when
      the kafs module is being removed and so the count it holds on
      net->servers_outstanding doesn't get dropped..
      
      This causes rmmod to wait forever.  The hung process shows a stack like:
      
      	afs_purge_servers+0x1b5/0x23c [kafs]
      	afs_net_exit+0x44/0x6e [kafs]
      	ops_exit_list+0x72/0x93
      	unregister_pernet_operations+0x14c/0x1ba
      	unregister_pernet_subsys+0x1d/0x2a
      	afs_exit+0x29/0x6f [kafs]
      	__do_sys_delete_module.isra.0+0x1a2/0x24b
      	do_syscall_64+0x51/0x95
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fix this by:
      
       (1) Attempting to cancel the probe timer and, if successful, drop the
           count that the timer was holding.
      
       (2) Make the timer function just drop the count and not schedule the
           prober if the afs portion of net namespace is being destroyed.
      
      Also, whilst we're at it, make the following changes:
      
       (3) Initialise net->servers_outstanding to 1 and decrement it before
           waiting on it so that it doesn't generate wake up events by being
           decremented to 0 until we're cleaning up.
      
       (4) Switch the atomic_dec() on ->servers_outstanding for ->fs_timer in
           afs_purge_servers() to use the helper function for that.
      
      Fixes: f6cbb368 ("afs: Actively poll fileservers to maintain NAT or firewall openings")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5481fc6e
    • David Howells's avatar
      afs: Fix afs_do_lookup() to call correct fetch-status op variant · f8ea5c7b
      David Howells authored
      Fix afs_do_lookup()'s fallback case for when FS.InlineBulkStatus isn't
      supported by the server.
      
      In the fallback, it calls FS.FetchStatus for the specific vnode it's
      meant to be looking up.  Commit b6489a49 broke this by renaming one
      of the two identically-named afs_fetch_status_operation descriptors to
      something else so that one of them could be made non-static.  The site
      that used the renamed one, however, wasn't renamed and didn't produce
      any warning because the other was declared in a header.
      
      Fix this by making afs_do_lookup() use the renamed variant.
      
      Note that there are two variants of the success method because one is
      called from ->lookup() where we may or may not have an inode, but can't
      call iget until after we've talked to the server - whereas the other is
      called from within iget where we have an inode, but it may or may not be
      initialised.
      
      The latter variant expects there to be an inode, but because it's being
      called from there former case, there might not be - resulting in an oops
      like the following:
      
        BUG: kernel NULL pointer dereference, address: 00000000000000b0
        ...
        RIP: 0010:afs_fetch_status_success+0x27/0x7e
        ...
        Call Trace:
          afs_wait_for_operation+0xda/0x234
          afs_do_lookup+0x2fe/0x3c1
          afs_lookup+0x3c5/0x4bd
          __lookup_slow+0xcd/0x10f
          walk_component+0xa2/0x10c
          path_lookupat.isra.0+0x80/0x110
          filename_lookup+0x81/0x104
          vfs_statx+0x76/0x109
          __do_sys_newlstat+0x39/0x6b
          do_syscall_64+0x4c/0x78
          entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: b6489a49 ("afs: Fix silly rename")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f8ea5c7b