Commit 4d997501 authored by Mickaël Salaün's avatar Mickaël Salaün Committed by Jarkko Sakkinen
Browse files

certs: Explain the rationale to call panic()

The blacklist_init() function calls panic() for memory allocation
errors.  This change documents the reason why we don't return -ENODEV.

Link: https://lore.kernel.org/r/20220322111323.542184-2-mic@digikod.net
Link: https://lore.kernel.org/r/YjeW2r6Wv55Du0bJ@iki.fi


Suggested-by: default avatarPaul Moore <paul@paul-moore.com>
Reviewed-by: default avatarPaul Moore <paul@paul-moore.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: default avatarMickaël Salaün <mic@linux.microsoft.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
parent 6364d106
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -307,6 +307,15 @@ static int restrict_link_for_blacklist(struct key *dest_keyring,

/*
 * Initialise the blacklist
 *
 * The blacklist_init() function is registered as an initcall via
 * device_initcall().  As a result if the blacklist_init() function fails for
 * any reason the kernel continues to execute.  While cleanly returning -ENODEV
 * could be acceptable for some non-critical kernel parts, if the blacklist
 * keyring fails to load it defeats the certificate/key based deny list for
 * signed modules.  If a critical piece of security functionality that users
 * expect to be present fails to initialize, panic()ing is likely the right
 * thing to do.
 */
static int __init blacklist_init(void)
{