Skip to content

Commit

Permalink
certs: Explain the rationale to call panic()
Browse files Browse the repository at this point in the history
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/[email protected]
Link: https://lore.kernel.org/r/[email protected]
Suggested-by: Paul Moore <[email protected]>
Reviewed-by: Paul Moore <[email protected]>
Reviewed-by: Jarkko Sakkinen <[email protected]>
Signed-off-by: Mickaël Salaün <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
  • Loading branch information
l0kod authored and jarkkojs committed May 23, 2022
1 parent 6364d10 commit 4d99750
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions certs/blacklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 4d99750

Please sign in to comment.