From: "Michal Suchánek" <msuchanek@suse.de>
To: Srish Srinivasan <ssrish@linux.ibm.com>
Cc: linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, naveen@kernel.org,
ajd@linux.ibm.com, zohar@linux.ibm.com, nayna@linux.ibm.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] powerpc/secvar: Expose secvars relevant to the key management mode
Date: Fri, 23 May 2025 08:19:22 +0200 [thread overview]
Message-ID: <aDATahmPIsOmiFAK@kitsune.suse.cz> (raw)
In-Reply-To: <20250521105759.8408-3-ssrish@linux.ibm.com>
Hello,
On Wed, May 21, 2025 at 04:27:58PM +0530, Srish Srinivasan wrote:
> The PLPKS enabled PowerVM LPAR sysfs exposes all of the secure boot
> secvars irrespective of the key management mode.
>
> The PowerVM LPAR supports static and dynamic key management for secure
> boot. The key management option can be updated in the management
> console. Only in the dynamic key mode can the user modify the secure
> boot secvars db, dbx, grubdb, grubdbx, and sbat, which are exposed via
> the sysfs interface. But the sysfs interface exposes these secvars even
> in the static key mode. This could lead to errors when reading them or
> writing to them in the static key mode.
would it cause an error when reading these variables or only when
writing them?
Thanks
Michal
>
> Expose only PK, trustedcadb, and moduledb in the static key mode to
> enable loading of signed third-party kernel modules.
>
> Co-developed-by: Souradeep <soura@imap.linux.ibm.com>
> Signed-off-by: Souradeep <soura@imap.linux.ibm.com>
> Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
> Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> Reviewed-by: Nayna Jain <nayna@linux.ibm.com>
> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> Documentation/ABI/testing/sysfs-secvar | 6 ++++
> arch/powerpc/platforms/pseries/plpks-secvar.c | 28 ++++++++++++++++---
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-secvar b/Documentation/ABI/testing/sysfs-secvar
> index 45281888e520..948df3446a03 100644
> --- a/Documentation/ABI/testing/sysfs-secvar
> +++ b/Documentation/ABI/testing/sysfs-secvar
> @@ -37,6 +37,12 @@ Description: Each secure variable is represented as a directory named as
> representation. The data and size can be determined by reading
> their respective attribute files.
>
> + Only secvars relevant to the key management mode are exposed.
> + Only in the dynamic key mode can the user modify the secure boot
> + secvars db, dbx, grubdb, grubdbx, and sbat. PK, trustedcadb and
> + moduledb are the secvars common to both static and dynamic key
> + management modes.
> +
> What: /sys/firmware/secvar/vars/<variable_name>/size
> Date: August 2019
> Contact: Nayna Jain <nayna@linux.ibm.com>
> diff --git a/arch/powerpc/platforms/pseries/plpks-secvar.c b/arch/powerpc/platforms/pseries/plpks-secvar.c
> index 767e5e8c6990..f9e9cc40c9d0 100644
> --- a/arch/powerpc/platforms/pseries/plpks-secvar.c
> +++ b/arch/powerpc/platforms/pseries/plpks-secvar.c
> @@ -59,7 +59,14 @@ static u32 get_policy(const char *name)
> return PLPKS_SIGNEDUPDATE;
> }
>
> -static const char * const plpks_var_names[] = {
> +static const char * const plpks_var_names_static[] = {
> + "PK",
> + "moduledb",
> + "trustedcadb",
> + NULL,
> +};
> +
> +static const char * const plpks_var_names_dynamic[] = {
> "PK",
> "KEK",
> "db",
> @@ -213,21 +220,34 @@ static int plpks_max_size(u64 *max_size)
> return 0;
> }
>
> +static const struct secvar_operations plpks_secvar_ops_static = {
> + .get = plpks_get_variable,
> + .set = plpks_set_variable,
> + .format = plpks_secvar_format,
> + .max_size = plpks_max_size,
> + .config_attrs = config_attrs,
> + .var_names = plpks_var_names_static,
> +};
>
> -static const struct secvar_operations plpks_secvar_ops = {
> +static const struct secvar_operations plpks_secvar_ops_dynamic = {
> .get = plpks_get_variable,
> .set = plpks_set_variable,
> .format = plpks_secvar_format,
> .max_size = plpks_max_size,
> .config_attrs = config_attrs,
> - .var_names = plpks_var_names,
> + .var_names = plpks_var_names_dynamic,
> };
>
> static int plpks_secvar_init(void)
> {
> + u8 mode;
> +
> if (!plpks_is_available())
> return -ENODEV;
>
> - return set_secvar_ops(&plpks_secvar_ops);
> + mode = plpks_get_sb_keymgmt_mode();
> + if (mode)
> + return set_secvar_ops(&plpks_secvar_ops_dynamic);
> + return set_secvar_ops(&plpks_secvar_ops_static);
> }
> machine_device_initcall(pseries, plpks_secvar_init);
> --
> 2.47.1
>
>
next prev parent reply other threads:[~2025-05-23 6:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 10:57 [PATCH v2 0/3] Enhancements to the secvar interface in static key management mode Srish Srinivasan
2025-05-21 10:57 ` [PATCH v2 1/3] powerpc/pseries: Correct secvar format representation for static key management Srish Srinivasan
2025-05-23 5:57 ` Andrew Donnellan
2025-05-29 17:57 ` Srish Srinivasan
2025-05-21 10:57 ` [PATCH v2 2/3] powerpc/secvar: Expose secvars relevant to the key management mode Srish Srinivasan
2025-05-23 6:19 ` Michal Suchánek [this message]
2025-05-29 17:09 ` Srish Srinivasan
2025-06-04 16:41 ` Michal Suchánek
2025-06-05 20:49 ` Srish Srinivasan
2025-05-21 10:57 ` [PATCH v2 3/3] integrity/platform_certs: Allow loading of keys in the static " Srish Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aDATahmPIsOmiFAK@kitsune.suse.cz \
--to=msuchanek@suse.de \
--cc=ajd@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=nayna@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=ssrish@linux.ibm.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).