<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/security/keys, branch v5.12</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.12</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.12'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-04-21T23:28:20Z</updated>
<entry>
<title>KEYS: trusted: Fix TPM reservation for seal/unseal</title>
<updated>2021-04-21T23:28:20Z</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2021-04-21T22:42:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d5171eab462a63e2fbebfccf6026e92be018f20'/>
<id>urn:sha1:9d5171eab462a63e2fbebfccf6026e92be018f20</id>
<content type='text'>
The original patch 8c657a0590de ("KEYS: trusted: Reserve TPM for seal
and unseal operations") was correct on the mailing list:

https://lore.kernel.org/linux-integrity/20210128235621.127925-4-jarkko@kernel.org/

But somehow got rebased so that the tpm_try_get_ops() in
tpm2_seal_trusted() got lost.  This causes an imbalanced put of the
TPM ops and causes oopses on TIS based hardware.

This fix puts back the lost tpm_try_get_ops()

Fixes: 8c657a0590de ("KEYS: trusted: Reserve TPM for seal and unseal operations")
Reported-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Acked-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Signed-off-by: James Bottomley &lt;James.Bottomley@HansenPartnership.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'keys-misc-20210126' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs</title>
<updated>2021-02-24T00:09:23Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-02-24T00:09:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c03c21ba6f4e95e406a1a7b4c34ef334b977c194'/>
<id>urn:sha1:c03c21ba6f4e95e406a1a7b4c34ef334b977c194</id>
<content type='text'>
Pull keyring updates from David Howells:
 "Here's a set of minor keyrings fixes/cleanups that I've collected from
  various people for the upcoming merge window.

  A couple of them might, in theory, be visible to userspace:

   - Make blacklist_vet_description() reject uppercase letters as they
     don't match the all-lowercase hex string generated for a blacklist
     search.

     This may want reconsideration in the future, but, currently, you
     can't add to the blacklist keyring from userspace and the only
     source of blacklist keys generates lowercase descriptions.

   - Fix blacklist_init() to use a new KEY_ALLOC_* flag to indicate that
     it wants KEY_FLAG_KEEP to be set rather than passing KEY_FLAG_KEEP
     into keyring_alloc() as KEY_FLAG_KEEP isn't a valid alloc flag.

     This isn't currently a problem as the blacklist keyring isn't
     currently writable by userspace.

  The rest of the patches are cleanups and I don't think they should
  have any visible effect"

* tag 'keys-misc-20210126' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  watch_queue: rectify kernel-doc for init_watch()
  certs: Replace K{U,G}IDT_INIT() with GLOBAL_ROOT_{U,G}ID
  certs: Fix blacklist flag type confusion
  PKCS#7: Fix missing include
  certs: Fix blacklisted hexadecimal hash string check
  certs/blacklist: fix kernel doc interface issue
  crypto: public_key: Remove redundant header file from public_key.h
  keys: remove trailing semicolon in macro definition
  crypto: pkcs7: Use match_string() helper to simplify the code
  PKCS#7: drop function from kernel-doc pkcs7_validate_trust_one
  encrypted-keys: Replace HTTP links with HTTPS ones
  crypto: asymmetric_keys: fix some comments in pkcs7_parser.h
  KEYS: remove redundant memset
  security: keys: delete repeated words in comments
  KEYS: asymmetric: Fix kerneldoc
  security/keys: use kvfree_sensitive()
  watch_queue: Drop references to /dev/watch_queue
  keys: Remove outdated __user annotations
  security: keys: Fix fall-through warnings for Clang
</content>
</entry>
<entry>
<title>KEYS: trusted: Reserve TPM for seal and unseal operations</title>
<updated>2021-02-16T08:40:28Z</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2021-01-28T23:56:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c657a0590de585b1115847c17b34a58025f2f4b'/>
<id>urn:sha1:8c657a0590de585b1115847c17b34a58025f2f4b</id>
<content type='text'>
When TPM 2.0 trusted keys code was moved to the trusted keys subsystem,
the operations were unwrapped from tpm_try_get_ops() and tpm_put_ops(),
which are used to take temporarily the ownership of the TPM chip. The
ownership is only taken inside tpm_send(), but this is not sufficient,
as in the key load TPM2_CC_LOAD, TPM2_CC_UNSEAL and TPM2_FLUSH_CONTEXT
need to be done as a one single atom.

Take the TPM chip ownership before sending anything with
tpm_try_get_ops() and tpm_put_ops(), and use tpm_transmit_cmd() to send
TPM commands instead of tpm_send(), reverting back to the old behaviour.

Fixes: 2e19e10131a0 ("KEYS: trusted: Move TPM2 trusted keys code")
Reported-by: "James E.J. Bottomley" &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: stable@vger.kernel.org
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Cc: Sumit Garg &lt;sumit.garg@linaro.org&gt;
Acked-by Sumit Garg &lt;sumit.garg@linaro.org&gt;
Tested-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>KEYS: trusted: Fix migratable=1 failing</title>
<updated>2021-02-16T08:40:28Z</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2021-01-28T23:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8da7520c80468c48f981f0b81fc1be6599e3b0ad'/>
<id>urn:sha1:8da7520c80468c48f981f0b81fc1be6599e3b0ad</id>
<content type='text'>
Consider the following transcript:

$ keyctl add trusted kmk "new 32 blobauth=helloworld keyhandle=80000000 migratable=1" @u
add_key: Invalid argument

The documentation has the following description:

  migratable=   0|1 indicating permission to reseal to new PCR values,
                default 1 (resealing allowed)

The consequence is that "migratable=1" should succeed. Fix this by
allowing this condition to pass instead of return -EINVAL.

[*] Documentation/security/keys/trusted-encrypted.rst

Cc: stable@vger.kernel.org
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Fixes: d00a1c72f7f4 ("keys: add new trusted key-type")
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>KEYS: trusted: Fix incorrect handling of tpm_get_random()</title>
<updated>2021-02-16T08:40:28Z</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2021-01-28T23:56:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5df16caada3fba3b21cb09b85cdedf99507f4ec1'/>
<id>urn:sha1:5df16caada3fba3b21cb09b85cdedf99507f4ec1</id>
<content type='text'>
When tpm_get_random() was introduced, it defined the following API for the
return value:

1. A positive value tells how many bytes of random data was generated.
2. A negative value on error.

However, in the call sites the API was used incorrectly, i.e. as it would
only return negative values and otherwise zero. Returning he positive read
counts to the user space does not make any possible sense.

Fix this by returning -EIO when tpm_get_random() returns a positive value.

Fixes: 41ab999c80f1 ("tpm: Move tpm_get_random api into the TPM device driver")
Cc: stable@vger.kernel.org
Cc: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Cc: "James E.J. Bottomley" &lt;James.Bottomley@HansenPartnership.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Kent Yoder &lt;key@linux.vnet.ibm.com&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Reviewed-by: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
</content>
</entry>
<entry>
<title>certs: Fix blacklist flag type confusion</title>
<updated>2021-01-21T16:16:10Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2020-11-20T18:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4993e1f9479a4161fd7d93e2b8b30b438f00cb0f'/>
<id>urn:sha1:4993e1f9479a4161fd7d93e2b8b30b438f00cb0f</id>
<content type='text'>
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 &lt;mic@linux.microsoft.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: Mickaël Salaün &lt;mic@linux.microsoft.com&gt;
cc: Mimi Zohar &lt;zohar@linux.vnet.ibm.com&gt;
Cc: David Woodhouse &lt;dwmw2@infradead.org&gt;
</content>
</entry>
<entry>
<title>KEYS: remove redundant memset</title>
<updated>2021-01-21T16:16:09Z</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2020-07-22T13:46:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c224926edfc2f774df6aefa865e31a0a00e24dde'/>
<id>urn:sha1:c224926edfc2f774df6aefa865e31a0a00e24dde</id>
<content type='text'>
Reviewing use of memset in keyctl_pkey.c

keyctl_pkey_params_get prologue code to set params up

	memset(params, 0, sizeof(*params));
	params-&gt;encoding = "raw";

keyctl_pkey_query has the same prologue
and calls keyctl_pkey_params_get.

So remove the prologue.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
</content>
</entry>
<entry>
<title>security: keys: delete repeated words in comments</title>
<updated>2021-01-21T16:16:09Z</updated>
<author>
<name>Randy Dunlap</name>
<email>rdunlap@infradead.org</email>
</author>
<published>2020-08-07T16:51:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=328c95db01df9d8875f77e49ee4322e60e1337cd'/>
<id>urn:sha1:328c95db01df9d8875f77e49ee4322e60e1337cd</id>
<content type='text'>
Drop repeated words in comments.
{to, will, the}

Signed-off-by: Randy Dunlap &lt;rdunlap@infradead.org&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Reviewed-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
Cc: keyrings@vger.kernel.org
Cc: James Morris &lt;jmorris@namei.org&gt;
Cc: "Serge E. Hallyn" &lt;serge@hallyn.com&gt;
Cc: linux-security-module@vger.kernel.org
</content>
</entry>
<entry>
<title>security/keys: use kvfree_sensitive()</title>
<updated>2021-01-21T16:16:09Z</updated>
<author>
<name>Denis Efremov</name>
<email>efremov@linux.com</email>
</author>
<published>2020-08-27T07:29:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=272a121940a286d7abaf7ac3ec5a37c5dbfa7b89'/>
<id>urn:sha1:272a121940a286d7abaf7ac3ec5a37c5dbfa7b89</id>
<content type='text'>
Use kvfree_sensitive() instead of open-coding it.

Signed-off-by: Denis Efremov &lt;efremov@linux.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Reviewed-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
</content>
</entry>
<entry>
<title>watch_queue: Drop references to /dev/watch_queue</title>
<updated>2021-01-21T16:16:08Z</updated>
<author>
<name>Gabriel Krisman Bertazi</name>
<email>krisman@collabora.com</email>
</author>
<published>2020-11-24T20:28:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8fe62e0c0e2efa5437f3ee81b65d69e70a45ecd2'/>
<id>urn:sha1:8fe62e0c0e2efa5437f3ee81b65d69e70a45ecd2</id>
<content type='text'>
The merged API doesn't use a watch_queue device, but instead relies on
pipes, so let the documentation reflect that.

Fixes: f7e47677e39a ("watch_queue: Add a key/keyring notification facility")
Signed-off-by: Gabriel Krisman Bertazi &lt;krisman@collabora.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Reviewed-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
</content>
</entry>
</feed>
