Explain panic() calls for keyring initialization
Subsystems (3)
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.
Regards,
Mickaël Salaün (1):
certs: Explain the rational to call panic()
certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
base-commit: 50c486fe310890c134b5cb36cf9a4135475a6074
Signature · 1 line
2.35.1
PATCH 1/1 certs: Explain the rational 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.
--- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
certs/blacklist.c +8 -0
@@ -307,6 +307,14 @@ 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 the functionality doesn't load and the +* kernel continues on executing. 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 v1 1/1] certs: Explain the rational to call panic()
Quoted 6 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 8 lines
Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Signed-off-by Mickaël Salaün <[email protected]>--- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
I would suggest changing the second sentence as shown below, but otherwise it looks good to me.
certs/blacklist.c static int restrict_link_for_blacklist(struct key *dest_keyring, · line 312
Quoted 11 lines
certs/blacklist.c +3
-0@@ -307,6 +307,14 @@ 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 the functionality doesn't load and the
"As a result if the blacklist_init() function fails for any reason the kernel continues to execute."
certs/blacklist.c static int restrict_link_for_blacklist(struct key *dest_keyring, · line 320
Quoted 8 lines
certs/blacklist.c +5
-0+* kernel continues on executing. 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 ) {
--
paul-moore.com
David Woodhouse
maintainerQuoted 3 lines · Mickaël Salaün
Mickaël Salaün (1):
certs: Explain the rational to callpanic()
Nit: "rationale". Even in Simplified English, I believe "rational" is a completely different word.
Quoted 2 lines
certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Also, isn't it about time we changed this to call it a denylist?
Re: [PATCH v1 1/1] certs: Explain the rational to call panic()
In reply to Paul MooreQuoted 16 lines · Paul Moore
Quoted 6 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 8 lines
Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Signed-off-by Mickaël Salaün <[email protected]>--- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 4 lines
I would suggest changing the second sentence as shown below, but otherwise it looks good to me.
Reviewed-by Paul Moore <[email protected]>
Mickaël, I think since your patch set was not huge in the first place, I'm considering making it part of rc2 pull request while I normally try to avoid any features after rc1. It's anyway throughly tested, and generally has been around for a *long time*. I've even tested it myself a few times.
Just trying to be responsible as a maintainer and if something does not feel right, I don't try to pretend that "I get it", if you know what I mean. This fully clarifies "not getting it" part :-)
Thanks!
BR, Jarkko
Re: [PATCH v1 1/1] certs: Explain the rational to call panic()
In reply to Paul MooreQuoted 27 lines · Paul Moore
Quoted 6 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 8 lines
Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Signed-off-by Mickaël Salaün <[email protected]>--- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)I would suggest changing the second sentence as shown below, but otherwise it looks good to me.
Reviewed-by Paul Moore <[email protected]>Quoted 6 lines
certs/blacklist.c +0
-0@@ -307,6 +307,14 @@ static int restrict_link_for_blacklist(struct key *dest_keyring,
Quoted 8 lines
certs/blacklist.c static int restrict_link_for_blacklist(struct key *dest_keyring, · line 312
Quoted 5 lines
certs/blacklist.c +3
-0/* * Initialise the blacklist +* +* The blacklist_init() function is registered as an initcall via +* device_initcall(). As a result the functionality doesn't load and the "As a result if the
blacklist_init()function fails for any reason the kernel continues to execute."
Thanks, I'll fix that.
Quoted 12 lines
certs/blacklist.c static int restrict_link_for_blacklist(struct key *dest_keyring, · line 320
Quoted 9 lines
certs/blacklist.c +5
-0+* kernel continues on executing. 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 ) {--
paul-moore.com
Re: [PATCH v1 1/1] certs: Explain the rational to call panic()
In reply to Jarkko SakkinenQuoted 29 lines · Jarkko Sakkinen
Quoted 16 lines · Paul Moore
Quoted 6 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 8 lines
Suggested-by Paul Moore <[email protected]> [1]Requested-by Jarkko Sakkinen <[email protected]> [1]Signed-off-by Mickaël Salaün <[email protected]>--- certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 4 lines
I would suggest changing the second sentence as shown below, but otherwise it looks good to me.
Reviewed-by Paul Moore <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Mickaël, I think since your patch set was not huge in the first place, I'm considering making it part of rc2 pull request while I normally try to avoid any features after rc1. It's anyway throughly tested, and generally has been around for a *long time*. I've even tested it myself a few times.
Quoted 5 lines
Just trying to be responsible as a maintainer and if something does not feel right, I don't try to pretend that "I get it", if you know what I mean. This fully clarifies "not getting it" part :-)
Thanks!
Thanks Jarkko, I get it. ;)
Quoted 7 lines · David Woodhouse
Quoted 3 lines · Mickaël Salaün
Mickaël Salaün (1):
certs: Explain the rational to callpanic()Nit: "rationale". Even in Simplified English, I believe "rational" is a completely different word.
Right, "rational" is an adjective.
Quoted 6 lines
Quoted 3 lines
certs/blacklist.c | 8 ++++++++ 1 file changed, 8 insertions(+)Also, isn't it about time we changed this to call it a denylist?
It is important to note that this word is part of the kernel ABI because of the keyring name.