22 Jun, 2022

1 commit

  • [ Upstream commit 6a1c3767d82ed8233de1263aa7da81595e176087 ]

    This file fails to compile as follows:

    CC certs/blacklist_hashes.o
    certs/blacklist_hashes.c:4:1: error: ignoring attribute ‘section (".init.data")’ because it conflicts with previous ‘section (".init.rodata")’ [-Werror=attributes]
    4 | const char __initdata *const blacklist_hashes[] = {
    | ^~~~~
    In file included from certs/blacklist_hashes.c:2:
    certs/blacklist.h:5:38: note: previous declaration here
    5 | extern const char __initconst *const blacklist_hashes[];
    | ^~~~~~~~~~~~~~~~

    Apply the same fix as commit 2be04df5668d ("certs/blacklist_nohashes.c:
    fix const confusion in certs blacklist").

    Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring")
    Signed-off-by: Masahiro Yamada
    Reviewed-by: Jarkko Sakkinen
    Reviewed-by: Mickaël Salaün
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

24 Aug, 2021

2 commits

  • Add support for using elliptic curve keys for signing modules. It uses
    a NIST P384 (secp384r1) key if the user chooses an elliptic curve key
    and will have ECDSA support built into the kernel.

    Note: A developer choosing an ECDSA key for signing modules should still
    delete the signing key (rm certs/signing_key.*) when building an older
    version of a kernel that only supports RSA keys. Unless kbuild automati-
    cally detects and generates a new kernel module key, ECDSA-signed kernel
    modules will fail signature verification.

    Cc: David Howells
    Cc: David Woodhouse
    Signed-off-by: Stefan Berger
    Reviewed-by: Jarkko Sakkinen
    Tested-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    Stefan Berger
     
  • Address a kbuild issue where a developer created an ECDSA key for signing
    kernel modules and then builds an older version of the kernel, when bi-
    secting the kernel for example, that does not support ECDSA keys.

    If openssl is installed, trigger the creation of an RSA module signing
    key if it is not an RSA key.

    Fixes: cfc411e7fff3 ("Move certificate handling to its own directory")
    Cc: David Howells
    Cc: David Woodhouse
    Signed-off-by: Stefan Berger
    Reviewed-by: Jarkko Sakkinen
    Tested-by: Jarkko Sakkinen
    Signed-off-by: Jarkko Sakkinen

    Stefan Berger
     

09 May, 2021

1 commit

  • Pull more Kbuild updates from Masahiro Yamada:

    - Convert sh and sparc to use generic shell scripts to generate the
    syscall headers

    - refactor .gitignore files

    - Update kernel/config_data.gz only when the content of the .config
    is really changed, which avoids the unneeded re-link of vmlinux

    - move "remove stale files" workarounds to scripts/remove-stale-files

    - suppress unused-but-set-variable warnings by default for Clang
    as well

    - fix locale setting LANG=C to LC_ALL=C

    - improve 'make distclean'

    - always keep intermediate objects from scripts/link-vmlinux.sh

    - move IF_ENABLED out of to make it self-contained

    - misc cleanups

    * tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits)
    linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in
    kbuild: Don't remove link-vmlinux temporary files on exit/signal
    kbuild: remove the unneeded comments for external module builds
    kbuild: make distclean remove tag files in sub-directories
    kbuild: make distclean work against $(objtree) instead of $(srctree)
    kbuild: refactor modname-multi by using suffix-search
    kbuild: refactor fdtoverlay rule
    kbuild: parameterize the .o part of suffix-search
    arch: use cross_compiling to check whether it is a cross build or not
    kbuild: remove ARCH=sh64 support from top Makefile
    .gitignore: prefix local generated files with a slash
    kbuild: replace LANG=C with LC_ALL=C
    Makefile: Move -Wno-unused-but-set-variable out of GCC only block
    kbuild: add a script to remove stale generated files
    kbuild: update config_data.gz only when the content of .config is changed
    .gitignore: ignore only top-level modules.builtin
    .gitignore: move tags and TAGS close to other tag files
    kernel/.gitgnore: remove stale timeconst.h and hz.bc
    usr/include: refactor .gitignore
    genksyms: fix stale comment
    ...

    Linus Torvalds
     

02 May, 2021

1 commit

  • Pull IMA updates from Mimi Zohar:
    "In addition to loading the kernel module signing key onto the builtin
    keyring, load it onto the IMA keyring as well.

    Also six trivial changes and bug fixes"

    * tag 'integrity-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity:
    ima: ensure IMA_APPRAISE_MODSIG has necessary dependencies
    ima: Fix fall-through warnings for Clang
    integrity: Add declarations to init_once void arguments.
    ima: Fix function name error in comment.
    ima: enable loading of build time generated key on .ima keyring
    ima: enable signing of modules with build time generated key
    keys: cleanup build time module signing keys
    ima: Fix the error code for restoring the PCR value
    ima: without an IMA policy loaded, return quickly

    Linus Torvalds
     

01 May, 2021

1 commit


27 Apr, 2021

2 commits

  • IMA_APPRAISE_MODSIG is used for verifying the integrity of both kernel
    and modules. Enabling IMA_APPRAISE_MODSIG without MODULES causes a build
    break.

    Ensure the build time kernel signing key is only generated if both
    IMA_APPRAISE_MODSIG and MODULES are enabled.

    Fixes: 0165f4ca223b ("ima: enable signing of modules with build time generated key")
    Reported-by: Randy Dunlap
    Reported-by: Stephen Rothwell
    Acked-by: Randy Dunlap # build-tested
    Signed-off-by: Nayna Jain
    Signed-off-by: Mimi Zohar

    Nayna Jain
     
  • Commit d1f044103dad ("certs: Add ability to preload revocation certs")
    created a new generated file for revocation certs, but didn't tell git
    to ignore it. Thus causing unnecessary "git status" noise after a
    kernel build with CONFIG_SYSTEM_REVOCATION_LIST enabled.

    Add the proper gitignore magic.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

09 Apr, 2021

2 commits


12 Mar, 2021

3 commits

  • Add a new Kconfig option called SYSTEM_REVOCATION_KEYS. If set,
    this option should be the filename of a PEM-formated file containing
    X.509 certificates to be included in the default blacklist keyring.

    DH Changes:
    - Make the new Kconfig option depend on SYSTEM_REVOCATION_LIST.
    - Fix SYSTEM_REVOCATION_KEYS=n, but CONFIG_SYSTEM_REVOCATION_LIST=y[1][2].
    - Use CONFIG_SYSTEM_REVOCATION_LIST for extract-cert[3].
    - Use CONFIG_SYSTEM_REVOCATION_LIST for revocation_certificates.o[3].

    Signed-off-by: Eric Snowberg
    Acked-by: Jarkko Sakkinen
    Signed-off-by: David Howells
    cc: Randy Dunlap
    cc: keyrings@vger.kernel.org
    Link: https://lore.kernel.org/r/e1c15c74-82ce-3a69-44de-a33af9b320ea@infradead.org/ [1]
    Link: https://lore.kernel.org/r/20210303034418.106762-1-eric.snowberg@oracle.com/ [2]
    Link: https://lore.kernel.org/r/20210304175030.184131-1-eric.snowberg@oracle.com/ [3]
    Link: https://lore.kernel.org/r/20200930201508.35113-3-eric.snowberg@oracle.com/
    Link: https://lore.kernel.org/r/20210122181054.32635-4-eric.snowberg@oracle.com/ # v5
    Link: https://lore.kernel.org/r/161428673564.677100.4112098280028451629.stgit@warthog.procyon.org.uk/
    Link: https://lore.kernel.org/r/161433312452.902181.4146169951896577982.stgit@warthog.procyon.org.uk/ # v2
    Link: https://lore.kernel.org/r/161529606657.163428.3340689182456495390.stgit@warthog.procyon.org.uk/ # v3

    Eric Snowberg
     
  • Move functionality within load_system_certificate_list to a common
    function, so it can be reused in the future.

    DH Changes:
    - Added inclusion of common.h to common.c (Eric [1]).

    Signed-off-by: Eric Snowberg
    Acked-by: Jarkko Sakkinen
    Signed-off-by: David Howells
    cc: keyrings@vger.kernel.org
    Link: https://lore.kernel.org/r/EDA280F9-F72D-4181-93C7-CDBE95976FF7@oracle.com/ [1]
    Link: https://lore.kernel.org/r/20200930201508.35113-2-eric.snowberg@oracle.com/
    Link: https://lore.kernel.org/r/20210122181054.32635-3-eric.snowberg@oracle.com/ # v5
    Link: https://lore.kernel.org/r/161428672825.677100.7545516389752262918.stgit@warthog.procyon.org.uk/
    Link: https://lore.kernel.org/r/161433311696.902181.3599366124784670368.stgit@warthog.procyon.org.uk/ # v2
    Link: https://lore.kernel.org/r/161529605850.163428.7786675680201528556.stgit@warthog.procyon.org.uk/ # v3

    Eric Snowberg
     
  • This fixes CVE-2020-26541.

    The Secure Boot Forbidden Signature Database, dbx, contains a list of now
    revoked signatures and keys previously approved to boot with UEFI Secure
    Boot enabled. The dbx is capable of containing any number of
    EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID
    entries.

    Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are
    skipped.

    Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID
    is found, it is added as an asymmetrical key to the .blacklist keyring.
    Anytime the .platform keyring is used, the keys in the .blacklist keyring
    are referenced, if a matching key is found, the key will be rejected.

    [DH: Made the following changes:
    - Added to have a config option to enable the facility. This allows a
    Kconfig solution to make sure that pkcs7_validate_trust() is
    enabled.[1][2]
    - Moved the functions out from the middle of the blacklist functions.
    - Added kerneldoc comments.]

    Signed-off-by: Eric Snowberg
    Signed-off-by: David Howells
    Reviewed-by: Jarkko Sakkinen
    cc: Randy Dunlap
    cc: Mickaël Salaün
    cc: Arnd Bergmann
    cc: keyrings@vger.kernel.org
    Link: https://lore.kernel.org/r/20200901165143.10295-1-eric.snowberg@oracle.com/ # rfc
    Link: https://lore.kernel.org/r/20200909172736.73003-1-eric.snowberg@oracle.com/ # v2
    Link: https://lore.kernel.org/r/20200911182230.62266-1-eric.snowberg@oracle.com/ # v3
    Link: https://lore.kernel.org/r/20200916004927.64276-1-eric.snowberg@oracle.com/ # v4
    Link: https://lore.kernel.org/r/20210122181054.32635-2-eric.snowberg@oracle.com/ # v5
    Link: https://lore.kernel.org/r/161428672051.677100.11064981943343605138.stgit@warthog.procyon.org.uk/
    Link: https://lore.kernel.org/r/161433310942.902181.4901864302675874242.stgit@warthog.procyon.org.uk/ # v2
    Link: https://lore.kernel.org/r/161529605075.163428.14625520893961300757.stgit@warthog.procyon.org.uk/ # v3
    Link: https://lore.kernel.org/r/bc2c24e3-ed68-2521-0bf4-a1f6be4a895d@infradead.org/ [1]
    Link: https://lore.kernel.org/r/20210225125638.1841436-1-arnd@kernel.org/ [2]

    Eric Snowberg
     

22 Jan, 2021

4 commits

  • Align with the new macros and add appropriate include files.

    Signed-off-by: Mickaël Salaün
    Signed-off-by: David Howells
    Cc: David Woodhouse

    Mickaël Salaün
     
  • KEY_FLAG_KEEP is not meant to be passed to keyring_alloc() or key_alloc(),
    as these only take KEY_ALLOC_* flags. KEY_FLAG_KEEP has the same value as
    KEY_ALLOC_BYPASS_RESTRICTION, but fortunately only key_create_or_update()
    uses it. LSMs using the key_alloc hook don't check that flag.

    KEY_FLAG_KEEP is then ignored but fortunately (again) the root user cannot
    write to the blacklist keyring, so it is not possible to remove a key/hash
    from it.

    Fix this by adding a KEY_ALLOC_SET_KEEP flag that tells key_alloc() to set
    KEY_FLAG_KEEP on the new key. blacklist_init() can then, correctly, pass
    this to keyring_alloc().

    We can also use this in ima_mok_init() rather than setting the flag
    manually.

    Note that this doesn't fix an observable bug with the current
    implementation but it is required to allow addition of new hashes to the
    blacklist in the future without making it possible for them to be removed.

    Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring")
    Reported-by: Mickaël Salaün
    Signed-off-by: David Howells
    cc: Mickaël Salaün
    cc: Mimi Zohar
    Cc: David Woodhouse

    David Howells
     
  • When looking for a blacklisted hash, bin2hex() is used to transform a
    binary hash to an ascii (lowercase) hexadecimal string. This string is
    then search for in the description of the keys from the blacklist
    keyring. When adding a key to the blacklist keyring,
    blacklist_vet_description() checks the hash prefix and the hexadecimal
    string, but not that this string is lowercase. It is then valid to set
    hashes with uppercase hexadecimal, which will be silently ignored by the
    kernel.

    Add an additional check to blacklist_vet_description() to check that
    hexadecimal strings are in lowercase.

    Signed-off-by: Mickaël Salaün
    Signed-off-by: David Howells
    Reviewed-by: Ben Boeckel
    Cc: David Woodhouse

    Mickaël Salaün
     
  • certs/blacklist.c:84: warning: Function parameter or member 'hash' not
    described in 'mark_hash_blacklisted'

    Signed-off-by: Alex Shi
    Signed-off-by: David Howells
    Reviewed-by: Ben Boeckel
    Cc: David Woodhouse
    Cc: keyrings@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org

    Alex Shi
     

25 Mar, 2020

2 commits


12 Nov, 2019

1 commit

  • The -EKEYREJECTED error returned by existing is_hash_blacklisted() is
    misleading when called for checking against blacklisted hash of a
    binary.

    This patch adds a wrapper function is_binary_blacklisted() to return
    -EPERM error if binary is blacklisted.

    Signed-off-by: Nayna Jain
    Reviewed-by: Mimi Zohar
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/1572492694-6520-7-git-send-email-zohar@linux.ibm.com

    Nayna Jain
     

06 Aug, 2019

1 commit

  • IMA will need to verify a PKCS#7 signature which has already been parsed.
    For this reason, factor out the code which does that from
    verify_pkcs7_signature() into a new function which takes a struct
    pkcs7_message instead of a data buffer.

    Signed-off-by: Thiago Jung Bauermann
    Reviewed-by: Mimi Zohar
    Cc: David Howells
    Cc: David Woodhouse
    Cc: Herbert Xu
    Cc: "David S. Miller"
    Signed-off-by: Mimi Zohar

    Thiago Jung Bauermann
     

11 Jul, 2019

1 commit

  • …el/git/dhowells/linux-fs"

    This reverts merge 0f75ef6a9cff49ff612f7ce0578bced9d0b38325 (and thus
    effectively commits

    7a1ade847596 ("keys: Provide KEYCTL_GRANT_PERMISSION")
    2e12256b9a76 ("keys: Replace uid/gid/perm permissions checking with an ACL")

    that the merge brought in).

    It turns out that it breaks booting with an encrypted volume, and Eric
    biggers reports that it also breaks the fscrypt tests [1] and loading of
    in-kernel X.509 certificates [2].

    The root cause of all the breakage is likely the same, but David Howells
    is off email so rather than try to work it out it's getting reverted in
    order to not impact the rest of the merge window.

    [1] https://lore.kernel.org/lkml/20190710011559.GA7973@sol.localdomain/
    [2] https://lore.kernel.org/lkml/20190710013225.GB7973@sol.localdomain/

    Link: https://lore.kernel.org/lkml/CAHk-=wjxoeMJfeBahnWH=9zShKp2bsVy527vo3_y8HfOdhwAAw@mail.gmail.com/
    Reported-by: Eric Biggers <ebiggers@kernel.org>
    Cc: David Howells <dhowells@redhat.com>
    Cc: James Morris <jmorris@namei.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

    Linus Torvalds
     

09 Jul, 2019

2 commits

  • Pull keyring ACL support from David Howells:
    "This changes the permissions model used by keys and keyrings to be
    based on an internal ACL by the following means:

    - Replace the permissions mask internally with an ACL that contains a
    list of ACEs, each with a specific subject with a permissions mask.
    Potted default ACLs are available for new keys and keyrings.

    ACE subjects can be macroised to indicate the UID and GID specified
    on the key (which remain). Future commits will be able to add
    additional subject types, such as specific UIDs or domain
    tags/namespaces.

    Also split a number of permissions to give finer control. Examples
    include splitting the revocation permit from the change-attributes
    permit, thereby allowing someone to be granted permission to revoke
    a key without allowing them to change the owner; also the ability
    to join a keyring is split from the ability to link to it, thereby
    stopping a process accessing a keyring by joining it and thus
    acquiring use of possessor permits.

    - Provide a keyctl to allow the granting or denial of one or more
    permits to a specific subject. Direct access to the ACL is not
    granted, and the ACL cannot be viewed"

    * tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
    keys: Provide KEYCTL_GRANT_PERMISSION
    keys: Replace uid/gid/perm permissions checking with an ACL

    Linus Torvalds
     
  • …/git/dhowells/linux-fs

    Pull keyring namespacing from David Howells:
    "These patches help make keys and keyrings more namespace aware.

    Firstly some miscellaneous patches to make the process easier:

    - Simplify key index_key handling so that the word-sized chunks
    assoc_array requires don't have to be shifted about, making it
    easier to add more bits into the key.

    - Cache the hash value in the key so that we don't have to calculate
    on every key we examine during a search (it involves a bunch of
    multiplications).

    - Allow keying_search() to search non-recursively.

    Then the main patches:

    - Make it so that keyring names are per-user_namespace from the point
    of view of KEYCTL_JOIN_SESSION_KEYRING so that they're not
    accessible cross-user_namespace.

    keyctl_capabilities() shows KEYCTL_CAPS1_NS_KEYRING_NAME for this.

    - Move the user and user-session keyrings to the user_namespace
    rather than the user_struct. This prevents them propagating
    directly across user_namespaces boundaries (ie. the KEY_SPEC_*
    flags will only pick from the current user_namespace).

    - Make it possible to include the target namespace in which the key
    shall operate in the index_key. This will allow the possibility of
    multiple keys with the same description, but different target
    domains to be held in the same keyring.

    keyctl_capabilities() shows KEYCTL_CAPS1_NS_KEY_TAG for this.

    - Make it so that keys are implicitly invalidated by removal of a
    domain tag, causing them to be garbage collected.

    - Institute a network namespace domain tag that allows keys to be
    differentiated by the network namespace in which they operate. New
    keys that are of a type marked 'KEY_TYPE_NET_DOMAIN' are assigned
    the network domain in force when they are created.

    - Make it so that the desired network namespace can be handed down
    into the request_key() mechanism. This allows AFS, NFS, etc. to
    request keys specific to the network namespace of the superblock.

    This also means that the keys in the DNS record cache are
    thenceforth namespaced, provided network filesystems pass the
    appropriate network namespace down into dns_query().

    For DNS, AFS and NFS are good, whilst CIFS and Ceph are not. Other
    cache keyrings, such as idmapper keyrings, also need to set the
    domain tag - for which they need access to the network namespace of
    the superblock"

    * tag 'keys-namespace-20190627' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
    keys: Pass the network namespace into request_key mechanism
    keys: Network namespace domain tag
    keys: Garbage collect keys for which the domain has been removed
    keys: Include target namespace in match criteria
    keys: Move the user and user-session keyrings to the user_namespace
    keys: Namespace keyring names
    keys: Add a 'recurse' flag for keyring searches
    keys: Cache the hash value to avoid lots of recalculation
    keys: Simplify key description management

    Linus Torvalds
     

28 Jun, 2019

1 commit

  • Replace the uid/gid/perm permissions checking on a key with an ACL to allow
    the SETATTR and SEARCH permissions to be split. This will also allow a
    greater range of subjects to represented.

    ============
    WHY DO THIS?
    ============

    The problem is that SETATTR and SEARCH cover a slew of actions, not all of
    which should be grouped together.

    For SETATTR, this includes actions that are about controlling access to a
    key:

    (1) Changing a key's ownership.

    (2) Changing a key's security information.

    (3) Setting a keyring's restriction.

    And actions that are about managing a key's lifetime:

    (4) Setting an expiry time.

    (5) Revoking a key.

    and (proposed) managing a key as part of a cache:

    (6) Invalidating a key.

    Managing a key's lifetime doesn't really have anything to do with
    controlling access to that key.

    Expiry time is awkward since it's more about the lifetime of the content
    and so, in some ways goes better with WRITE permission. It can, however,
    be set unconditionally by a process with an appropriate authorisation token
    for instantiating a key, and can also be set by the key type driver when a
    key is instantiated, so lumping it with the access-controlling actions is
    probably okay.

    As for SEARCH permission, that currently covers:

    (1) Finding keys in a keyring tree during a search.

    (2) Permitting keyrings to be joined.

    (3) Invalidation.

    But these don't really belong together either, since these actions really
    need to be controlled separately.

    Finally, there are number of special cases to do with granting the
    administrator special rights to invalidate or clear keys that I would like
    to handle with the ACL rather than key flags and special checks.

    ===============
    WHAT IS CHANGED
    ===============

    The SETATTR permission is split to create two new permissions:

    (1) SET_SECURITY - which allows the key's owner, group and ACL to be
    changed and a restriction to be placed on a keyring.

    (2) REVOKE - which allows a key to be revoked.

    The SEARCH permission is split to create:

    (1) SEARCH - which allows a keyring to be search and a key to be found.

    (2) JOIN - which allows a keyring to be joined as a session keyring.

    (3) INVAL - which allows a key to be invalidated.

    The WRITE permission is also split to create:

    (1) WRITE - which allows a key's content to be altered and links to be
    added, removed and replaced in a keyring.

    (2) CLEAR - which allows a keyring to be cleared completely. This is
    split out to make it possible to give just this to an administrator.

    (3) REVOKE - see above.

    Keys acquire ACLs which consist of a series of ACEs, and all that apply are
    unioned together. An ACE specifies a subject, such as:

    (*) Possessor - permitted to anyone who 'possesses' a key
    (*) Owner - permitted to the key owner
    (*) Group - permitted to the key group
    (*) Everyone - permitted to everyone

    Note that 'Other' has been replaced with 'Everyone' on the assumption that
    you wouldn't grant a permit to 'Other' that you wouldn't also grant to
    everyone else.

    Further subjects may be made available by later patches.

    The ACE also specifies a permissions mask. The set of permissions is now:

    VIEW Can view the key metadata
    READ Can read the key content
    WRITE Can update/modify the key content
    SEARCH Can find the key by searching/requesting
    LINK Can make a link to the key
    SET_SECURITY Can change owner, ACL, expiry
    INVAL Can invalidate
    REVOKE Can revoke
    JOIN Can join this keyring
    CLEAR Can clear this keyring

    The KEYCTL_SETPERM function is then deprecated.

    The KEYCTL_SET_TIMEOUT function then is permitted if SET_SECURITY is set,
    or if the caller has a valid instantiation auth token.

    The KEYCTL_INVALIDATE function then requires INVAL.

    The KEYCTL_REVOKE function then requires REVOKE.

    The KEYCTL_JOIN_SESSION_KEYRING function then requires JOIN to join an
    existing keyring.

    The JOIN permission is enabled by default for session keyrings and manually
    created keyrings only.

    ======================
    BACKWARD COMPATIBILITY
    ======================

    To maintain backward compatibility, KEYCTL_SETPERM will translate the
    permissions mask it is given into a new ACL for a key - unless
    KEYCTL_SET_ACL has been called on that key, in which case an error will be
    returned.

    It will convert possessor, owner, group and other permissions into separate
    ACEs, if each portion of the mask is non-zero.

    SETATTR permission turns on all of INVAL, REVOKE and SET_SECURITY. WRITE
    permission turns on WRITE, REVOKE and, if a keyring, CLEAR. JOIN is turned
    on if a keyring is being altered.

    The KEYCTL_DESCRIBE function translates the ACL back into a permissions
    mask to return depending on possessor, owner, group and everyone ACEs.

    It will make the following mappings:

    (1) INVAL, JOIN -> SEARCH

    (2) SET_SECURITY -> SETATTR

    (3) REVOKE -> WRITE if SETATTR isn't already set

    (4) CLEAR -> WRITE

    Note that the value subsequently returned by KEYCTL_DESCRIBE may not match
    the value set with KEYCTL_SETATTR.

    =======
    TESTING
    =======

    This passes the keyutils testsuite for all but a couple of tests:

    (1) tests/keyctl/dh_compute/badargs: The first wrong-key-type test now
    returns EOPNOTSUPP rather than ENOKEY as READ permission isn't removed
    if the type doesn't have ->read(). You still can't actually read the
    key.

    (2) tests/keyctl/permitting/valid: The view-other-permissions test doesn't
    work as Other has been replaced with Everyone in the ACL.

    Signed-off-by: David Howells

    David Howells
     

27 Jun, 2019

1 commit


24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public licence as published by
    the free software foundation either version 2 of the licence or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 114 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520170857.552531963@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

05 Feb, 2019

2 commits

  • This patch allows the kexec_file_load syscall to verify the PE signed
    kernel image signature based on the preboot keys stored in the .platform
    keyring, as fall back, if the signature verification failed due to not
    finding the public key in the secondary or builtin keyrings.

    This commit adds a VERIFY_USE_PLATFORM_KEYRING similar to previous
    VERIFY_USE_SECONDARY_KEYRING indicating that verify_pkcs7_signature
    should verify the signature using platform keyring. Also, decrease
    the error message log level when verification failed with -ENOKEY,
    so that if called tried multiple time with different keyring it
    won't generate extra noises.

    Signed-off-by: Kairui Song
    Cc: David Howells
    Acked-by: Dave Young (for kexec_file_load part)
    [zohar@linux.ibm.com: tweaked the first paragraph of the patch description,
    and fixed checkpatch warning.]
    Signed-off-by: Mimi Zohar

    Kairui Song
     
  • commit 9dc92c45177a ("integrity: Define a trusted platform keyring")
    introduced a .platform keyring for storing preboot keys, used for
    verifying kernel image signatures. Currently only IMA-appraisal is able
    to use the keyring to verify kernel images that have their signature
    stored in xattr.

    This patch exposes the .platform keyring, making it accessible for
    verifying PE signed kernel images as well.

    Suggested-by: Mimi Zohar
    Signed-off-by: Kairui Song
    Cc: David Howells
    [zohar@linux.ibm.com: fixed checkpatch errors, squashed with patch fix]
    Signed-off-by: Mimi Zohar

    Kairui Song
     

06 Jan, 2019

1 commit


22 Aug, 2018

1 commit


17 Aug, 2018

1 commit


27 Jun, 2018

1 commit


16 Jun, 2018

1 commit

  • As we move stuff around, some doc references are broken. Fix some of
    them via this script:
    ./scripts/documentation-file-ref-check --fix

    Manually checked if the produced result is valid, removing a few
    false-positives.

    Acked-by: Takashi Iwai
    Acked-by: Masami Hiramatsu
    Acked-by: Stephen Boyd
    Acked-by: Charles Keepax
    Acked-by: Mathieu Poirier
    Reviewed-by: Coly Li
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

22 Feb, 2018

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

14 Jul, 2017

1 commit


09 May, 2017

1 commit

  • Fix typos and add the following to the scripts/spelling.txt:

    intialisation||initialisation
    intialised||initialised
    intialise||initialise

    This commit does not intend to change the British spelling itself.

    Link: http://lkml.kernel.org/r/1481573103-11329-18-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     

05 Apr, 2017

1 commit

  • Replace struct key's restrict_link function pointer with a pointer to
    the new struct key_restriction. The structure contains pointers to the
    restriction function as well as relevant data for evaluating the
    restriction.

    The garbage collector checks restrict_link->keytype when key types are
    unregistered. Restrictions involving a removed key type are converted
    to use restrict_link_reject so that restrictions cannot be removed by
    unregistering key types.

    Signed-off-by: Mat Martineau

    Mat Martineau
     

04 Apr, 2017

1 commit

  • The first argument to the restrict_link_func_t functions was a keyring
    pointer. These functions are called by the key subsystem with this
    argument set to the destination keyring, but restrict_link_by_signature
    expects a pointer to the relevant trusted keyring.

    Restrict functions may need something other than a single struct key
    pointer to allow or reject key linkage, so the data used to make that
    decision (such as the trust keyring) is moved to a new, fourth
    argument. The first argument is now always the destination keyring.

    Signed-off-by: Mat Martineau

    Mat Martineau