linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: David Howells <dhowells@redhat.com>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: Eric Snowberg <eric.snowberg@oracle.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Nayna Jain <nayna@linux.ibm.com>
Subject: linux-next: manual merge of the keys tree with the integrity tree
Date: Wed, 7 Apr 2021 14:15:53 +1000	[thread overview]
Message-ID: <20210407141553.266b704e@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3403 bytes --]

Hi all,

Today's linux-next merge of the keys tree got a conflict in:

  certs/system_keyring.c

between commit:

  df73a4001959 ("ima: enable loading of build time generated key on .ima keyring")

from the integrity tree and commit:

  9536390dcc8c ("certs: Move load_system_certificate_list to a common function")

from the keys tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging.  You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc certs/system_keyring.c
index bb122bf4cc17,0c9a4795e847..000000000000
--- a/certs/system_keyring.c
+++ b/certs/system_keyring.c
@@@ -133,85 -133,15 +134,34 @@@ static __init int system_trusted_keyrin
   */
  device_initcall(system_trusted_keyring_init);
  
- static __init int load_cert(const u8 *p, const u8 *end, struct key *keyring)
- {
- 	key_ref_t key;
- 	size_t plen;
- 
- 	while (p < end) {
- 		/* Each cert begins with an ASN.1 SEQUENCE tag and must be more
- 		 * than 256 bytes in size.
- 		 */
- 		if (end - p < 4)
- 			goto dodgy_cert;
- 		if (p[0] != 0x30 &&
- 		    p[1] != 0x82)
- 			goto dodgy_cert;
- 		plen = (p[2] << 8) | p[3];
- 		plen += 4;
- 		if (plen > end - p)
- 			goto dodgy_cert;
- 
- 		key = key_create_or_update(make_key_ref(keyring, 1),
- 					   "asymmetric",
- 					   NULL,
- 					   p,
- 					   plen,
- 					   ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
- 					   KEY_USR_VIEW | KEY_USR_READ),
- 					   KEY_ALLOC_NOT_IN_QUOTA |
- 					   KEY_ALLOC_BUILT_IN |
- 					   KEY_ALLOC_BYPASS_RESTRICTION);
- 		if (IS_ERR(key)) {
- 			pr_err("Problem loading in-kernel X.509 certificate (%ld)\n",
- 			       PTR_ERR(key));
- 		} else {
- 			pr_notice("Loaded X.509 cert '%s'\n",
- 				  key_ref_to_ptr(key)->description);
- 			key_ref_put(key);
- 		}
- 		p += plen;
- 	}
- 
- 	return 0;
- 
- dodgy_cert:
- 	pr_err("Problem parsing in-kernel X.509 certificate list\n");
- 	return 0;
- }
- 
 +__init int load_module_cert(struct key *keyring)
 +{
- 	const u8 *p, *end;
- 
 +	if (!IS_ENABLED(CONFIG_IMA_APPRAISE_MODSIG))
 +		return 0;
 +
 +	pr_notice("Loading compiled-in module X.509 certificates\n");
 +
- 	p = system_certificate_list;
- 	end = p + module_cert_size;
- 
- 	return load_cert(p, end, keyring);
++	return load_certificate_list(system_certificate_list, module_cert_size,
++				     keyring);
 +}
 +
  /*
   * Load the compiled-in list of X.509 certificates.
   */
  static __init int load_system_certificate_list(void)
  {
- 	const u8 *p, *end;
++	const u8 *p;
 +
  	pr_notice("Loading compiled-in X.509 certificates\n");
  
 -	return load_certificate_list(system_certificate_list, system_certificate_list_size,
 +#ifdef CONFIG_MODULE_SIG
 +	p = system_certificate_list;
 +#else
 +	p = system_certificate_list + module_cert_size;
 +#endif
 +
- 	end = p + system_certificate_list_size;
- 	return load_cert(p, end, builtin_trusted_keys);
++	return load_certificate_list(p, system_certificate_list_size,
+ 				     builtin_trusted_keys);
  }
  late_initcall(load_system_certificate_list);
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-04-07  4:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  4:15 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-12  7:08 linux-next: manual merge of the keys tree with the integrity tree Stephen Rothwell
2019-06-26  4:33 Stephen Rothwell
2019-07-09  0:11 ` Stephen Rothwell
2019-07-09  0:31   ` Mimi Zohar
2019-07-09  0:42     ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210407141553.266b704e@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=dhowells@redhat.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=nayna@linux.ibm.com \
    --cc=zohar@linux.ibm.com \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).