All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] Explain panic() calls for keyring initialization
@ 2022-03-22 11:13 Mickaël Salaün
  2022-03-22 11:13 ` [PATCH v2 1/1] certs: Explain the rationale to call panic() Mickaël Salaün
  2022-03-30 12:53 ` David Howells
  0 siblings, 2 replies; 5+ messages in thread
From: Mickaël Salaün @ 2022-03-22 11:13 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Mickaël Salaün, David Howells, David S . Miller,
	David Woodhouse, Eric Snowberg, Paul Moore, Tyler Hicks,
	keyrings, linux-crypto, linux-kernel

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.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git/commit/?id=50c486fe310890c134b5cb36cf9a4135475a6074

Previous version:
https://lore.kernel.org/r/20220321174548.510516-1-mic@digikod.net

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
-- 
2.35.1


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

* [PATCH v2 1/1] certs: Explain the rationale to call panic()
  2022-03-22 11:13 [PATCH v2 0/1] Explain panic() calls for keyring initialization Mickaël Salaün
@ 2022-03-22 11:13 ` Mickaël Salaün
  2022-03-22 17:39   ` Tyler Hicks
  2022-03-22 20:31   ` Jarkko Sakkinen
  2022-03-30 12:53 ` David Howells
  1 sibling, 2 replies; 5+ messages in thread
From: Mickaël Salaün @ 2022-03-22 11:13 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Mickaël Salaün, David Howells, David S . Miller,
	David Woodhouse, Eric Snowberg, Paul Moore, Tyler Hicks,
	keyrings, linux-crypto, linux-kernel, Mickaël Salaün

From: Mickaël Salaün <mic@linux.microsoft.com>

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

Suggested-by: Paul Moore <paul@paul-moore.com> [1]
Requested-by: Jarkko Sakkinen <jarkko@kernel.org> [1]
Link: https://lore.kernel.org/r/YjeW2r6Wv55Du0bJ@iki.fi [1]
Reviewed-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
Link: https://lore.kernel.org/r/20220322111323.542184-2-mic@digikod.net
---

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(+)

diff --git a/certs/blacklist.c b/certs/blacklist.c
index 486ce0dd8e9c..25094ea73600 100644
--- a/certs/blacklist.c
+++ b/certs/blacklist.c
@@ -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)
 {
-- 
2.35.1


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

* Re: [PATCH v2 1/1] certs: Explain the rationale to call panic()
  2022-03-22 11:13 ` [PATCH v2 1/1] certs: Explain the rationale to call panic() Mickaël Salaün
@ 2022-03-22 17:39   ` Tyler Hicks
  2022-03-22 20:31   ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Tyler Hicks @ 2022-03-22 17:39 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: Jarkko Sakkinen, David Howells, David S . Miller,
	David Woodhouse, Eric Snowberg, Paul Moore, keyrings,
	linux-crypto, linux-kernel, Mickaël Salaün

On 2022-03-22 12:13:23, Mickaël Salaün wrote:
> From: Mickaël Salaün <mic@linux.microsoft.com>
> 
> The blacklist_init() function calls panic() for memory allocation
> errors.  This change documents the reason why we don't return -ENODEV.
> 
> Suggested-by: Paul Moore <paul@paul-moore.com> [1]
> Requested-by: Jarkko Sakkinen <jarkko@kernel.org> [1]
> Link: https://lore.kernel.org/r/YjeW2r6Wv55Du0bJ@iki.fi [1]
> Reviewed-by: Paul Moore <paul@paul-moore.com>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
> Link: https://lore.kernel.org/r/20220322111323.542184-2-mic@digikod.net

Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>

Tyler

> ---
> 
> 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(+)
> 
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index 486ce0dd8e9c..25094ea73600 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -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)
>  {
> -- 
> 2.35.1
> 

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

* Re: [PATCH v2 1/1] certs: Explain the rationale to call panic()
  2022-03-22 11:13 ` [PATCH v2 1/1] certs: Explain the rationale to call panic() Mickaël Salaün
  2022-03-22 17:39   ` Tyler Hicks
@ 2022-03-22 20:31   ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2022-03-22 20:31 UTC (permalink / raw)
  To: Mickaël Salaün
  Cc: David Howells, David S . Miller, David Woodhouse, Eric Snowberg,
	Paul Moore, Tyler Hicks, keyrings, linux-crypto, linux-kernel,
	Mickaël Salaün

On Tue, Mar 22, 2022 at 12:13:23PM +0100, Mickaël Salaün wrote:
> From: Mickaël Salaün <mic@linux.microsoft.com>
> 
> The blacklist_init() function calls panic() for memory allocation
> errors.  This change documents the reason why we don't return -ENODEV.
> 
> Suggested-by: Paul Moore <paul@paul-moore.com> [1]
> Requested-by: Jarkko Sakkinen <jarkko@kernel.org> [1]
> Link: https://lore.kernel.org/r/YjeW2r6Wv55Du0bJ@iki.fi [1]
> Reviewed-by: Paul Moore <paul@paul-moore.com>
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> Signed-off-by: Mickaël Salaün <mic@linux.microsoft.com>
> Link: https://lore.kernel.org/r/20220322111323.542184-2-mic@digikod.net
> ---
> 
> 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(+)
> 
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index 486ce0dd8e9c..25094ea73600 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -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)
>  {
> -- 
> 2.35.1
> 

Thank you, I'll put this into my "queue" folder and apply as soon I have
bandwidth.

BR, Jarkko

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

* Re: [PATCH v2 1/1] certs: Explain the rationale to call panic()
  2022-03-22 11:13 [PATCH v2 0/1] Explain panic() calls for keyring initialization Mickaël Salaün
  2022-03-22 11:13 ` [PATCH v2 1/1] certs: Explain the rationale to call panic() Mickaël Salaün
@ 2022-03-30 12:53 ` David Howells
  1 sibling, 0 replies; 5+ messages in thread
From: David Howells @ 2022-03-30 12:53 UTC (permalink / raw)
  To: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?=
  Cc: dhowells, Jarkko Sakkinen, David S . Miller, David Woodhouse,
	Eric Snowberg, Paul Moore, Tyler Hicks, keyrings, linux-crypto,
	linux-kernel, =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?=

Mickaël Salaün <mic@digikod.net> wrote:

> The blacklist_init() function calls panic() 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


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

end of thread, other threads:[~2022-03-30 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 11:13 [PATCH v2 0/1] Explain panic() calls for keyring initialization Mickaël Salaün
2022-03-22 11:13 ` [PATCH v2 1/1] certs: Explain the rationale to call panic() Mickaël Salaün
2022-03-22 17:39   ` Tyler Hicks
2022-03-22 20:31   ` Jarkko Sakkinen
2022-03-30 12:53 ` David Howells

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.