Skip to content
Snippets Groups Projects
  1. Oct 31, 2023
    • Mimi Zohar's avatar
      certs: Only allow certs signed by keys on the builtin keyring · b4650306
      Mimi Zohar authored
      
      Originally the secondary trusted keyring provided a keyring to which extra
      keys may be added, provided those keys were not blacklisted and were
      vouched for by a key built into the kernel or already in the secondary
      trusted keyring.
      
      On systems with the machine keyring configured, additional keys may also
      be vouched for by a key on the machine keyring.
      
      Prevent loading additional certificates directly onto the secondary
      keyring, vouched for by keys on the machine keyring, yet allow these
      certificates to be loaded onto other trusted keyrings.
      
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      b4650306
  2. Oct 27, 2023
  3. Oct 20, 2023
  4. Aug 17, 2023
  5. Apr 24, 2023
  6. Feb 13, 2023
  7. Jan 31, 2023
  8. Jan 22, 2023
  9. Sep 23, 2022
    • Masahiro Yamada's avatar
      certs: make system keyring depend on built-in x509 parser · 2154aca2
      Masahiro Yamada authored
      
      Commit e9088629 ("certs: make system keyring depend on x509 parser")
      is not the right fix because x509_load_certificate_list() can be modular.
      
      The combination of CONFIG_SYSTEM_TRUSTED_KEYRING=y and
      CONFIG_X509_CERTIFICATE_PARSER=m still results in the following error:
      
          LD      .tmp_vmlinux.kallsyms1
        ld: certs/system_keyring.o: in function `load_system_certificate_list':
        system_keyring.c:(.init.text+0x8c): undefined reference to `x509_load_certificate_list'
        make: *** [Makefile:1169: vmlinux] Error 1
      
      Fixes: e9088629 ("certs: make system keyring depend on x509 parser")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarAdam Borowski <kilobyte@angband.pl>
      2154aca2
  10. Jul 27, 2022
  11. Jul 24, 2022
  12. Jun 21, 2022
  13. Jun 15, 2022
  14. Jun 10, 2022
  15. Jun 08, 2022
  16. May 23, 2022
  17. Apr 05, 2022
  18. Mar 08, 2022
  19. Mar 02, 2022
  20. Jan 22, 2022
  21. Jan 08, 2022
    • Masahiro Yamada's avatar
      certs: move scripts/extract-cert to certs/ · 340a0253
      Masahiro Yamada authored
      
      extract-cert is only used in certs/Makefile.
      
      Move it there and build extract-cert on demand.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      340a0253
    • Masahiro Yamada's avatar
      kbuild: do not quote string values in include/config/auto.conf · 129ab0d2
      Masahiro Yamada authored
      
      The previous commit fixed up all shell scripts to not include
      include/config/auto.conf.
      
      Now that include/config/auto.conf is only included by Makefiles,
      we can change it into a more Make-friendly form.
      
      Previously, Kconfig output string values enclosed with double-quotes
      (both in the .config and include/config/auto.conf):
      
          CONFIG_X="foo bar"
      
      Unlike shell, Make handles double-quotes (and single-quotes as well)
      verbatim. We must rip them off when used.
      
      There are some patterns:
      
        [1] $(patsubst "%",%,$(CONFIG_X))
        [2] $(CONFIG_X:"%"=%)
        [3] $(subst ",,$(CONFIG_X))
        [4] $(shell echo $(CONFIG_X))
      
      These are not only ugly, but also fragile.
      
      [1] and [2] do not work if the value contains spaces, like
         CONFIG_X=" foo bar "
      
      [3] does not work correctly if the value contains double-quotes like
         CONFIG_X="foo\"bar"
      
      [4] seems to work better, but has a cost of forking a process.
      
      Anyway, quoted strings were always PITA for our Makefiles.
      
      This commit changes Kconfig to stop quoting in include/config/auto.conf.
      
      These are the string type symbols referenced in Makefiles or scripts:
      
          ACPI_CUSTOM_DSDT_FILE
          ARC_BUILTIN_DTB_NAME
          ARC_TUNE_MCPU
          BUILTIN_DTB_SOURCE
          CC_IMPLICIT_FALLTHROUGH
          CC_VERSION_TEXT
          CFG80211_EXTRA_REGDB_KEYDIR
          EXTRA_FIRMWARE
          EXTRA_FIRMWARE_DIR
          EXTRA_TARGETS
          H8300_BUILTIN_DTB
          INITRAMFS_SOURCE
          LOCALVERSION
          MODULE_SIG_HASH
          MODULE_SIG_KEY
          NDS32_BUILTIN_DTB
          NIOS2_DTB_SOURCE
          OPENRISC_BUILTIN_DTB
          SOC_CANAAN_K210_DTB_SOURCE
          SYSTEM_BLACKLIST_HASH_LIST
          SYSTEM_REVOCATION_KEYS
          SYSTEM_TRUSTED_KEYS
          TARGET_CPU
          UNUSED_KSYMS_WHITELIST
          XILINX_MICROBLAZE0_FAMILY
          XILINX_MICROBLAZE0_HW_VER
          XTENSA_VARIANT_NAME
      
      I checked them one by one, and fixed up the code where necessary.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      129ab0d2
    • Masahiro Yamada's avatar
      certs: simplify $(srctree)/ handling and remove config_filename macro · b8c96a6b
      Masahiro Yamada authored
      
      The complex macro, config_filename, was introduced to do:
      
       [1] drop double-quotes from the string value
       [2] add $(srctree)/ prefix in case the file is not found in $(objtree)
       [3] escape spaces and more
      
      [1] will be more generally handled by Kconfig later.
      
      As for [2], Kbuild uses VPATH to search for files in $(objtree),
      $(srctree) in this order. GNU Make can natively handle it.
      
      As for [3], converting $(space) to $(space_escape) back and forth looks
      questionable to me. It is well-known that GNU Make cannot handle file
      paths with spaces in the first place.
      
      Instead of using the complex macro, use $< so it will be expanded to
      the file path of the key.
      
      Remove config_filename, finally.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b8c96a6b
    • Masahiro Yamada's avatar
      certs: remove misleading comments about GCC PR · 5410f3e8
      Masahiro Yamada authored
      
      This dependency is necessary irrespective of the mentioned GCC PR
      because the embedded certificates are build artifacts and must be
      generated by extract_certs before *.S files are compiled.
      
      The comment sounds like we are hoping to remove these dependencies
      someday. No, we cannot remove them.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5410f3e8
    • Masahiro Yamada's avatar
      certs: refactor file cleaning · 5cca3606
      Masahiro Yamada authored
      
      'make clean' removes files listed in 'targets'. It is redundant to
      specify both 'targets' and 'clean-files'.
      
      Move 'targets' assignments out of the ifeq-conditionals so
      scripts/Makefile.clean can see them.
      
      One effective change is that certs/certs/signing_key.x509 is now
      deleted by 'make clean' instead of 'make mrproper. This certificate
      is embedded in the kernel. It is not used in any way by external
      module builds.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      5cca3606
    • Masahiro Yamada's avatar
      certs: remove unneeded -I$(srctree) option for system_certificates.o · 3958f215
      Masahiro Yamada authored
      
      The .incbin directive in certs/system_certificates.S includes
      certs/signing_key.x509 and certs/x509_certificate_list, both of which
      are generated by extract_certs, i.e. exist in $(objtree).
      
      This option -I$(srctree) is unneeded.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      3958f215
    • Masahiro Yamada's avatar
      certs: unify duplicated cmd_extract_certs and improve the log · 1c4bd9f7
      Masahiro Yamada authored
      
      cmd_extract_certs is defined twice. Unify them.
      
      The current log shows the input file $(2), which might be empty.
      You cannot know what is being created from the log, "EXTRACT_CERTS".
      
      Change the log to show the output file with better alignment.
      
      [Before]
      
        EXTRACT_CERTS   certs/signing_key.pem
        CC      certs/system_keyring.o
        EXTRACT_CERTS
        AS      certs/system_certificates.o
        CC      certs/common.o
        CC      certs/blacklist.o
        EXTRACT_CERTS
        AS      certs/revocation_certificates.o
      
      [After]
      
        CERT    certs/signing_key.x509
        CC      certs/system_keyring.o
        CERT    certs/x509_certificate_list
        AS      certs/system_certificates.o
        CC      certs/common.o
        CC      certs/blacklist.o
        CERT    certs/x509_revocation_list
        AS      certs/revocation_certificates.o
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      1c4bd9f7
    • Masahiro Yamada's avatar
      certs: use $< and $@ to simplify the key generation rule · c537e4d0
      Masahiro Yamada authored
      
      Do not repeat $(obj)/x509.genkey or $(obj)/signing_key.pem
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      c537e4d0
Loading