Explain panic() calls for keyring initialization
Subsystems (3)
v2 cover Explain panic() calls for keyring initialization
As suggested by Jarkko and explained by Paul, let's document the panic() calls from the blacklist keyring initialization. This series applies on top of commit 50c486fe3108 ("certs: Allow root user to append signed hashes to the blacklist keyring"). This can smoothly be rebased on top of Jarkko's next branch.
This second version fixes some minor spelling issues.
Previous version:
https://lore.kernel.org/r/[email protected]
Regards,
Mickaël Salaün (1):
certs: Explain the rationale to call panic()
certs/blacklist.c | 9 +++++++++ 1 file changed, 9 insertions(+)
base-commit: 50c486fe310890c134b5cb36cf9a4135475a6074
Signature · 1 line
2.35.1
PATCH v2 1/1 certs: Explain the rationale to call panic()
From: Mickaël Salaün <[email protected]>
The blacklist_init() function calls panic() for memory allocation errors. This change documents the reason why we don't return -ENODEV.
---
Changes since v1:
* Fix commit subject spelling spotted by David Woodhouse.
* Reword one sentence as suggested by Paul Moore.
* Add Reviewed-by Paul Moore.
* Add Reviewed-by Jarkko Sakkinen.
--- certs/blacklist.c | 9 +++++++++ 1 file changed, 9 insertions(+)
certs/blacklist.c +9 -0
@@ -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 ) {
Signature · 1 line
2.35.1
Re: [PATCH v2 1/1] certs: Explain the rationale to call panic()
Quoted 5 lines · Mickaël Salaün
From: Mickaël Salaün <[email protected]>
The
blacklist_init()function callspanic()for memory allocation errors. This change documents the reason why we don't return-ENODEV.
Quoted 7 lines
Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Reviewed-by Paul Moore <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Signed-off-by Mickaël Salaün <[email protected]>
Tyler
Quoted 34 lines
---
Changes since v1:
* Fix commit subject spelling spotted by David Woodhouse.
* Reword one sentence as suggested by Paul Moore.
* Add Reviewed-by Paul Moore.
* Add Reviewed-by Jarkko Sakkinen.--- certs/blacklist.c | 9 +++++++++ 1 file changed, 9 insertions(+)certs/blacklist.c +9
-0@@ -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 ) {Signature · 1 line
2.35.1
Jarkko Sakkinen
maintainerRe: [PATCH v2 1/1] certs: Explain the rationale to call panic()
In reply to Mickaël SalaünQuoted 46 lines · Mickaël Salaün
From: Mickaël Salaün <[email protected]>
The
blacklist_init()function callspanic()for memory allocation errors. This change documents the reason why we don't return-ENODEV.Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Reviewed-by Paul Moore <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Signed-off-by Mickaël Salaün <[email protected]>---
Changes since v1:
* Fix commit subject spelling spotted by David Woodhouse.
* Reword one sentence as suggested by Paul Moore.
* Add Reviewed-by Paul Moore.
* Add Reviewed-by Jarkko Sakkinen.--- certs/blacklist.c | 9 +++++++++ 1 file changed, 9 insertions(+)certs/blacklist.c +9
-0@@ -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 ) {Signature · 1 line
2.35.1
Thank you, I'll put this into my "queue" folder and apply as soon I have bandwidth.
BR, Jarkko
David Howells
maintainerRe: [PATCH v2 1/1] certs: Explain the rationale to call panic()
In reply to Mickaël SalaünQuoted 2 lines · Mickaël Salaün
The
blacklist_init()function callspanic()for memory allocation errors. This change documents the reason why we don't return-ENODEV.
Why, though?
This is only called whilst the kernel is booting. If you hit ENOMEM, you aren't likely to get much further with the boot process.
David