diff mbox

[IMA,RFC] blacklist keyring

Message ID 20160628153514.GA4515@localhost (mailing list archive)
State New, archived
Headers show

Commit Message

Petko Manolov June 28, 2016, 3:35 p.m. UTC
On 16-06-28 10:42:04, David Howells wrote:
> Petko Manolov <petkan@mip-labs.com> wrote:
> 
> > If you like i can try to bisect it for you in the afternoon.
> 
> That would be useful if you could, thanks.

The commit to blame is 268909d61732f5cd34ea701bf978f199e62e0d58.

Kernel explodes at software_key_determine_akcipher() as it does not check if 
'encoding' is NULL, which is exactly what happens.

The caller (in my test case) is public_key_verify_signature() which passes 
'sig->encoding' == NULL.

The following is fixing the crash, but it is almost certainly the wrong 
approach. ;)



		Petko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 8be2586..db53267 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -68,6 +68,9 @@  int software_key_determine_akcipher(const char *encoding,
 {
 	int n;
 
+	if (!encoding)
+		return -ENOPKG;
+
 	if (strcmp(encoding, "pkcs1") == 0) {
 		/* The data wangled by the RSA algorithm is typically padded
 		 * and encoded in some manner, such as EMSA-PKCS1-1_5 [RFC3447