mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] ima: measure modules with multiple appended signatures
@ 2026-11-27  2:59 Bruno Meneguele
  2026-11-27  2:59 ` [RFC PATCH 1/8] pkcs7: don't cache a failed digest in pkcs7_digest() Bruno Meneguele
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Bruno Meneguele @ 2026-11-27  2:59 UTC (permalink / raw)
  To: linux-integrity
  Cc: linux-kernel, keyrings, zohar, roberto.sassu, dhowells, bauerman,
	Bruno Meneguele

Hi,

This RFC presents the support for modules with multiple signatures, *and mixed
algorithms*, appended. A scenario that requires it today is the PQC transition
period where modules are signed with both, eg., ML-DSA and ECDSA.

Appraisal already handles that: pkcs7_verify() accepts the file if a trusted
signer verifies and no other signer fails (unknown keys is not considered
failure). But measurement doesn't: 'd-modsig' and the binary blacklist check
take the content digest from pkcs7_get_digest(), which fails with more than one
signer, so the file loads unmeasured.

Patches #1 and #2 (for stable) fix two PKCS#7 bugs found on the way: a failed
digest left in sig->m, and pkcs7_get_digest() returning the signed attributes
instead of the content digest. Patch #3 adds support for multiple signers on
PKCS#7 code, but IMA 'd-modsig' can't describe it, so patches #4-#7 add a
template (patch #5 standardizes how ima-modsig records ML-DSA in the same way
proposed here for its v2):

  ima-modsigv2 = d-ngv2 | n-ng | sig | d-modsig-list | modsig

'd-modsig-list' is <u32 count> x (<u32 entry_len><entry>), one 'd-modsig' entry
per signer in 'modsig' order, or "<sig algo>:" for direct data (eg. ML-DSA)
signatures:

  d-ngv2:        ima:sha256:a4fa30a9...48d3a449
  n-ng:          /test/t10-ecdsa512-mldsa65-noattr.ko
  sig:           030304...feff
  d-modsig-list: sha512:0e750939...f8c18dcb,mldsa65:
  modsig:        30820e1706092a864886f70d010702a0...

Another example with ECDSA-SHA512+RSA-SHA256 and ML-DSA-65+ML-DSA-87:

  d-modsig-list: sha512:0e750939...f8c18dcb,sha256:0ae76371...e37306f2
  d-modsig-list: mldsa65:,mldsa87:

A signer with no usable digest gets an empty entry; with none, the measurement
list entry is dropped, as with 'd-modsig'. Patch #8 blocks a file if any
signer's digest is blacklisted.

Open questions: (1) should a dropped measurement be reported more explicitly
than by its audit record? (2) a pure ML-DSA signer has no content digest to
match a 'bin:' entry; how should that fit with the 'skid:' proposal [1]?

I tested module loading in a QEMU/KVM x86_64 and kernel image kexec in a PPC64LE
LPAR with RSA, ECDSA and ML-DSA-65/87, one or two signers, mixed hash algorithms
and rejected cases (bad messageDigest, two ML-DSA signers with one bad).

Claude Opus helped read the code, review the patches and write the tests (and
this cover-letter). I reviewed and reworked every diff and I'm responsible for
all of it.

Thanks,
Bruno

[1] https://lore.kernel.org/all/20261106173149.707244-1-zohar@linux.ibm.com/


Bruno Meneguele (8):
  pkcs7: don't cache a failed digest in pkcs7_digest()
  pkcs7: return the content digest from pkcs7_get_digest()
  pkcs7: support multiple signers in pkcs7_get_digest()
  ima: get the modsig content digest of each signer
  ima: record data-signing algorithms by name in 'd-modsig'
  ima: add the 'd-modsig-list' template field
  ima: define the ima-modsigv2 template
  ima: check the digest of every modsig signer against the blacklist

 Documentation/security/IMA-templates.rst  |   8 +-
 crypto/asymmetric_keys/pkcs7_verify.c     |  83 +++++++--
 include/crypto/pkcs7.h                    |   7 +-
 security/integrity/ima/ima.h              |  15 +-
 security/integrity/ima/ima_appraise.c     |  15 +-
 security/integrity/ima/ima_modsig.c       |  48 +++--
 security/integrity/ima/ima_policy.c       |   3 +-
 security/integrity/ima/ima_template.c     |   8 +-
 security/integrity/ima/ima_template_lib.c | 208 ++++++++++++++++++----
 security/integrity/ima/ima_template_lib.h |   4 +
 10 files changed, 314 insertions(+), 85 deletions(-)

--
2.55.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-27  3:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  2:59 [RFC PATCH 0/8] ima: measure modules with multiple appended signatures Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 1/8] pkcs7: don't cache a failed digest in pkcs7_digest() Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 2/8] pkcs7: return the content digest from pkcs7_get_digest() Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 3/8] pkcs7: support multiple signers in pkcs7_get_digest() Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 4/8] ima: get the modsig content digest of each signer Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 5/8] ima: record data-signing algorithms by name in 'd-modsig' Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 6/8] ima: add the 'd-modsig-list' template field Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 7/8] ima: define the ima-modsigv2 template Bruno Meneguele
2026-11-27  2:59 ` [RFC PATCH 8/8] ima: check the digest of every modsig signer against the blacklist Bruno Meneguele

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®