[PATCH v5 24/25] integrity/powerpc: Improve error handling & reporting when loading certs

2023-01-30 Thread Andrew Donnellan
Signed-off-by: Andrew Donnellan --- v3: New patch --- .../integrity/platform_certs/load_powerpc.c | 26 ++- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/security/integrity/platform_certs/load_powerpc.c b/security/integrity/platform_certs/load_powerpc.c index

[PATCH v5 16/25] powerpc/pseries: Expose PLPKS config values, support additional fields

2023-01-30 Thread Andrew Donnellan
to support additional v3 API fields, minor fixes] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series Refresh config values in plpks_get_usedspace() (ajd) Validate the config

[PATCH v5 04/25] powerpc/secvar: Use u64 in secvar_operations

2023-01-30 Thread Andrew Donnellan
Ellerman Reviewed-by: Russell Currey Reviewed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Include new patch --- arch/powerpc/include/asm/secvar.h| 9 +++-- arch/powerpc/kernel/secvar-sysfs.c | 8 arch/powerpc/platforms/powernv/opal

[PATCH v5 10/25] powerpc/secvar: Extend sysfs to include config vars

2023-01-30 Thread Andrew Donnellan
implementation at present, and the config directory will not be created if no attributes are set. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Remove unnecessary "secvar:" prefix from error messages (ajd) Merge config

[PATCH v5 14/25] powerpc/pseries: Move plpks.h to include directory

2023-01-30 Thread Andrew Donnellan
From: Russell Currey Move plpks.h from platforms/pseries/ to include/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- .../powerpc/{platforms/pseries

[PATCH v5 09/25] powerpc/secvar: Clean up init error messages

2023-01-30 Thread Andrew Donnellan
Remove unnecessary prefixes from error messages in secvar_sysfs_init() (the file defines pr_fmt, so putting "secvar:" in every message is unnecessary). Make capitalisation and punctuation more consistent. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New

[PATCH v5 13/25] powerpc/secvar: Don't print error on ENOENT when reading variables

2023-01-30 Thread Andrew Donnellan
Kuppusamy Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/kernel/secvar-sysfs.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c index 9b6be63b7b36..ca3df3f7156c 100644 --- a/arch

[PATCH v5 06/25] powerpc/secvar: Use sysfs_emit() instead of sprintf()

2023-01-30 Thread Andrew Donnellan
From: Russell Currey The secvar format string and object size sysfs files are both ASCII text, and should use sysfs_emit(). No functional change. Suggested-by: Greg Kroah-Hartman Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v2: New patch (gregkh) --- arch/powerpc

[PATCH v5 01/25] powerpc/pseries: Fix handling of PLPKS object flushing timeout

2023-01-30 Thread Andrew Donnellan
to the user. Handle the timeout case separately and return ETIMEDOUT if triggered. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Reported-by: Benjamin Gray Signed-off-by: Andrew Donnellan Tested-by: Russell Currey Reviewed-by: Russell Currey

[PATCH v5 02/25] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2023-01-30 Thread Andrew Donnellan
that size). Reported-by: Benjamin Gray Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Andrew Donnellan Reviewed-by: Russell Currey Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series v4

[PATCH v5 00/25] pSeries dynamic secure boot secvar interface + platform keyring loading

2023-01-30 Thread Andrew Donnellan
dd them later and update the docs. Use sysfs_emit() instead of sprintf() for all sysfs strings Change the size of the sysfs binary attributes to include the 8-byte flags header, preventing truncation of large writes. Andrew Donnellan (8): powerpc/pseries: Fix handling of PLPKS object f

[PATCH v5 03/25] powerpc/secvar: Fix incorrect return in secvar_sysfs_load()

2023-01-30 Thread Andrew Donnellan
pace via sysfs"), but the return code of secvar_sysfs_load() was never checked so this issue never mattered. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v5: New patch --- arch/powerpc/kernel/secvar-sysfs.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-

Re: [PATCH v4 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-30 Thread Andrew Donnellan
On Tue, 2023-01-31 at 13:54 +1100, Andrew Donnellan wrote: > > > +{ > > > +   // The max object size reported by the hypervisor is > > > accurate for the > > > +   // object itself, but we use the first 8 bytes of data on > > > write as the >

Re: [PATCH v4 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-30 Thread Andrew Donnellan
strong objection, it could go either way. > > > +   goto err; > > +   } > > + > > +   // This string is made up by us - the hypervisor doesn't > > provide us > > +   // with a format string in the way that OPAL firmwa

Re: [PATCH v4 24/24] integrity/powerpc: Support loading keys from pseries secvar

2023-01-30 Thread Andrew Donnellan
clarify in the commit message of the next revision. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v4 16/24] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-29 Thread Andrew Donnellan
r secure boot). I think the comment confuses more than it clarifies, I'll remove it. As you say, read_var() should work fine with component == NULL, though write_var() checks it. The only rule I can find in the spec is that signed update calls *must* set the component to NULL. I'm seeking clarification on that. > > +EXPORT_SYMBOL(plpks_signed_update_var); > > Sorry I missed it before -- can this be a _GPL export? Indeed it should be - actually, I should check if I can get rid of the export completely... -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

[PATCH] powerpc/rtas: Replace one-element arrays with flexible arrays

2023-01-27 Thread Andrew Donnellan
/flexible_array.cocci. Cc: Nathan Lynch Cc: Leonardo Bras Cc: linux-harden...@vger.kernel.org Link: https://github.com/KSPP/linux/issues/21 Link: https://github.com/KSPP/linux/issues/79 Signed-off-by: Andrew Donnellan --- arch/powerpc/include/asm/rtas-types.h | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH v4 02/24] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2023-01-26 Thread Andrew Donnellan
a power of two, the alignment is also guaranteed to be at least the respective size. Is this wrong? Andrew -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v3 4/7] selftests/powerpc: Add read/write debugfs file, int

2023-01-24 Thread Andrew Donnellan
-by: Benjamin Gray This seems like a sensible idea. Nitpick below, otherwise it looks like you have changed over all 21 call sites and the new helpers look better. Reviewed-by: Andrew Donnellan > -int read_debugfs_file(char *debugfs_file, int *result) > +int read_debugfs_int(const char *d

Re: [PATCH v3 3/7] selftests/powerpc: Add generic read/write file util

2023-01-24 Thread Andrew Donnellan
 int read_sysfs_file(char *fpath, char *result, size_t result_size) >  { > char path[PATH_MAX] = "/sys/"; > -   int rc = -1, fd; >   > strncat(path, fpath, PATH_MAX - strlen(path) - 1); >   > -   if ((fd = open(path, O_RDONLY)) < 0) > -   return rc; > - > -   rc = read(fd, result, result_size); > - > -   close(fd); > - > -   if (rc < 0) > -   return rc; > - > -   return 0; > +   return read_file(path, result, result_size, NULL); >  } >   >  int read_debugfs_file(char *debugfs_file, int *result) >  { > -   int rc = -1, fd; > +   int err; > char path[PATH_MAX]; > -   char value[16]; > +   char value[16] = {0}; >   > strcpy(path, "/sys/kernel/debug/"); > strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1); >   > -   if ((fd = open(path, O_RDONLY)) < 0) > -   return rc; > - > -   if ((rc = read(fd, value, sizeof(value))) < 0) > -   return rc; > +   if ((err = read_file(path, value, sizeof(value) - 1, NULL))) > +   return err; >   > -   value[15] = 0; > *result = atoi(value); > -   close(fd); >   > return 0; >  } >   >  int write_debugfs_file(char *debugfs_file, int result) >  { > -   int rc = -1, fd; > char path[PATH_MAX]; > char value[16]; >   > strcpy(path, "/sys/kernel/debug/"); > strncat(path, debugfs_file, PATH_MAX - strlen(path) - 1); >   > -   if ((fd = open(path, O_WRONLY)) < 0) > -   return rc; > - > snprintf(value, 16, "%d", result); >   > -   if ((rc = write(fd, value, strlen(value))) < 0) > -   return rc; > - > -   close(fd); > - > -   return 0; > +   return write_file(path, value, strlen(value)); >  } >   >  static long perf_event_open(struct perf_event_attr *hw_event, pid_t > pid, -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v4 24/24] integrity/powerpc: Support loading keys from pseries secvar

2023-01-24 Thread Andrew Donnellan
ecvar_format() doesn't return "ibm,secvar-backend", it searches for the device tree node named "ibm,secvar-backend", then reads and returns the contents of the property "format" under that node. The expected content of the format property is "ibm,edk2-compat-v1". -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v4 21/24] powerpc/pseries: Pass PLPKS password on kexec

2023-01-23 Thread Andrew Donnellan
  return of_remove_property(of_chosen, prop); > > Why do you remove the property afterward? Because otherwise the password will be sitting around in /proc/device- tree for the world to go and read. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

[PATCH v4 07/24] powerpc/secvar: Handle max object size in the consumer

2023-01-20 Thread Andrew Donnellan
Signed-off-by: Andrew Donnellan --- v3: Change uint64_t type to u64 (mpe) v4: Return immediately if node is NULL (gjoyce) --- arch/powerpc/include/asm/secvar.h| 1 + arch/powerpc/kernel/secvar-sysfs.c | 17 +++ arch/powerpc/platforms/powernv/opal-secvar.c | 22

[PATCH v4 12/24] powerpc/secvar: Don't print error on ENOENT when reading variables

2023-01-20 Thread Andrew Donnellan
Kuppusamy Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/kernel/secvar-sysfs.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c index 6dd9b4f6f87c..33d1797851ba 100644 --- a/arch

[PATCH v4 18/24] powerpc/pseries: Make caller pass buffer to plpks_read_var()

2023-01-20 Thread Andrew Donnellan
o NULL and var->datalen will be populated. Update header file to document this. Suggested-by: Michael Ellerman Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch (mpe) --- arch/powerpc/include/asm/plpks.h | 12 arch/powerpc/platforms/pseries/plp

[PATCH v4 23/24] integrity/powerpc: Improve error handling & reporting when loading certs

2023-01-20 Thread Andrew Donnellan
From: Russell Currey A few improvements to load_powerpc.c: - include integrity.h for the pr_fmt() - move all error reporting out of get_cert_list() - use ERR_PTR() to better preserve error detail - don't use pr_err() for missing keys Signed-off-by: Russell Currey Signed-off-by: Andrew

[PATCH v4 19/24] powerpc/pseries: Turn PSERIES_PLPKS into a hidden option

2023-01-20 Thread Andrew Donnellan
. However, we can't get of the separate option completely, because it will also be used for SED Opal purposes. Change PSERIES_PLPKS into a hidden option, which is selected by PPC_SECURE_BOOT. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch --- arch/powerpc

[PATCH v4 21/24] powerpc/pseries: Pass PLPKS password on kexec

2023-01-20 Thread Andrew Donnellan
-off-by: Andrew Donnellan --- v3: New patch v4: Fix compile when CONFIG_PSERIES_PLPKS=n (snowpatch) Fix error handling on fdt_path_offset() call (ruscur) --- arch/powerpc/kexec/file_load_64.c | 18 ++ arch/powerpc/platforms/pseries/plpks.c | 18 +- 2

[PATCH v4 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-20 Thread Andrew Donnellan
of write buffer at a time, and the hypervisor does not expose an interface for partial writes.) Co-developed-by: Nayna Jain Signed-off-by: Nayna Jain Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v2: Remove unnecessary config vars from sysfs

[PATCH v4 16/24] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-19 Thread Andrew Donnellan
and misc cleanups] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series Fix error code handling in plpks_confirm_object_flushed() (ruscur) Pass plpks_var struct

[PATCH v4 15/24] powerpc/pseries: Expose PLPKS config values, support additional fields

2023-01-19 Thread Andrew Donnellan
to support additional v3 API fields, minor fixes] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series Refresh config values in plpks_get_usedspace() (ajd) Validate the config

[PATCH v4 17/24] powerpc/pseries: Log hcall return codes for PLPKS debug

2023-01-19 Thread Andrew Donnellan
-by: Russell Currey Signed-off-by: Andrew Donnellan --- arch/powerpc/platforms/pseries/plpks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c index 796ed5544ee5..96a026a37285 100644 --- a/arch/powerpc/platforms

[PATCH v4 24/24] integrity/powerpc: Support loading keys from pseries secvar

2023-01-19 Thread Andrew Donnellan
ect format is expected to be the same, so there shouldn't be any functional differences between objects retrieved from powernv and pseries. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch v4: Pass format buffer size (stefanb, npiggin) --- .../integrity/plat

[PATCH v4 13/24] powerpc/pseries: Move plpks.h to include directory

2023-01-19 Thread Andrew Donnellan
From: Russell Currey Move plpks.h from platforms/pseries/ to include/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- .../powerpc/{platforms/pseries

[PATCH v4 20/24] powerpc/pseries: Add helpers to get PLPKS password

2023-01-19 Thread Andrew Donnellan
From: Russell Currey Add helper functions to get the PLPKS password. This will be used in a later patch to support passing the password between kernels over kexec. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/include/asm/plpks.h

[PATCH v4 05/24] powerpc/secvar: Use sysfs_emit() instead of sprintf()

2023-01-19 Thread Andrew Donnellan
From: Russell Currey The secvar format string and object size sysfs files are both ASCII text, and should use sysfs_emit(). No functional change. Suggested-by: Greg Kroah-Hartman Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v2: New patch (gregkh) --- arch/powerpc

[PATCH v4 14/24] powerpc/pseries: Move PLPKS constants to header file

2023-01-19 Thread Andrew Donnellan
From: Russell Currey Move the constants defined in plpks.c to plpks.h, and standardise their naming, so that PLPKS consumers can make use of them later on. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc

[PATCH v4 11/24] powerpc/secvar: Warn when PAGE_SIZE is smaller than max object size

2023-01-19 Thread Andrew Donnellan
Due to sysfs constraints, when writing to a variable, we can only handle writes of up to PAGE_SIZE. It's possible that the maximum object size is larger than PAGE_SIZE, in which case, print a warning on boot so that the user is aware. Signed-off-by: Andrew Donnellan Signed-off-by: Russell

[PATCH v4 08/24] powerpc/secvar: Clean up init error messages

2023-01-19 Thread Andrew Donnellan
Remove unnecessary prefixes from error messages in secvar_sysfs_init() (the file defines pr_fmt, so putting "secvar:" in every message is unnecessary). Make capitalisation and punctuation more consistent. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New

[PATCH v4 06/24] powerpc/secvar: Handle format string in the consumer

2023-01-19 Thread Andrew Donnellan
From: Russell Currey The code that handles the format string in secvar-sysfs.c is entirely OPAL specific, so create a new "format" op in secvar_operations to make the secvar code more generic. No functional change. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --

[PATCH v4 10/24] powerpc/secvar: Allow backend to populate static list of variable names

2023-01-19 Thread Andrew Donnellan
ead, let the backend put a NULL-terminated array of variable names into secvar_ops->var_names, which will be used if get_next() is undefined. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch (ajd/mpe) --- arch/powerpc/include/asm/secvar.h | 4 ++ arch/powerpc/

[PATCH v4 09/24] powerpc/secvar: Extend sysfs to include config vars

2023-01-19 Thread Andrew Donnellan
implementation at present, and the config directory will not be created if no attributes are set. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Remove unnecessary "secvar:" prefix from error messages (ajd) Merge config

[PATCH v4 01/24] powerpc/pseries: Fix handling of PLPKS object flushing timeout

2023-01-19 Thread Andrew Donnellan
to the user. Handle the timeout case separately and return ETIMEDOUT if triggered. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Reported-by: Benjamin Gray Signed-off-by: Andrew Donnellan Tested-by: Russell Currey Reviewed-by: Russell Currey

[PATCH v4 00/24] pSeries dynamic secure boot secvar interface + platform keyring loading

2023-01-19 Thread Andrew Donnellan
it() instead of sprintf() for all sysfs strings Change the size of the sysfs binary attributes to include the 8-byte flags header, preventing truncation of large writes. Andrew Donnellan (8): powerpc/pseries: Fix handling of PLPKS object flushing timeout powerpc/pseries: Fix alignmen

[PATCH v4 03/24] powerpc/secvar: Use u64 in secvar_operations

2023-01-19 Thread Andrew Donnellan
Ellerman Reviewed-by: Russell Currey Reviewed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Include new patch --- arch/powerpc/include/asm/secvar.h| 9 +++-- arch/powerpc/kernel/secvar-sysfs.c | 8 arch/powerpc/platforms/powernv/opal

[PATCH v4 02/24] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2023-01-19 Thread Andrew Donnellan
not cross page boundaries Round up the allocations of these structures/buffers to the next power of 2 to make sure this happens. Reported-by: Benjamin Gray Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Andrew Donnellan Reviewed-by: Russ

[PATCH v4 04/24] powerpc/secvar: Warn and error if multiple secvar ops are set

2023-01-19 Thread Andrew Donnellan
From: Russell Currey The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan

Re: [PATCH v3 08/24] powerpc/secvar: Allow backend to populate static list of variable names

2023-01-19 Thread Andrew Donnellan
riable names > > +   // Only used if get_next() isn't provided > > +   const char * const *var_names; > > The other way you could go is provide a sysfs_init() ops call here, > and export the add_var as a library function that backends can use. True, I think I'll keep it as

Re: [PATCH v3 21/24] powerpc/pseries: Pass PLPKS password on kexec

2023-01-18 Thread Andrew Donnellan
On Wed, 2023-01-18 at 17:10 +1100, Andrew Donnellan wrote: > >  struct umem_info { > u64 *buf;   /* data buffer for usable-memory > property */ > @@ -1155,7 +1156,7 @@ int setup_new_fdt_ppc64(const struct kimage > *image, void *fdt, >

[PATCH v3 21/24] powerpc/pseries: Pass PLPKS password on kexec

2023-01-17 Thread Andrew Donnellan
-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/kexec/file_load_64.c | 17 - arch/powerpc/platforms/pseries/plpks.c | 18 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec

[PATCH v3 07/24] powerpc/secvar: Extend sysfs to include config vars

2023-01-17 Thread Andrew Donnellan
implementation at present, and the config directory will not be created if no attributes are set. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Remove unnecessary "secvar:" prefix from error messages (ajd) Merge config

[PATCH v3 23/24] integrity/powerpc: Improve error handling & reporting when loading certs

2023-01-17 Thread Andrew Donnellan
From: Russell Currey A few improvements to load_powerpc.c: - include integrity.h for the pr_fmt() - move all error reporting out of get_cert_list() - use ERR_PTR() to better preserve error detail - don't use pr_err() for missing keys Signed-off-by: Russell Currey Signed-off-by: Andrew

[PATCH v3 16/24] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-17 Thread Andrew Donnellan
and misc cleanups] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series Fix error code handling in plpks_confirm_object_flushed() (ruscur) Pass plpks_var struct

[PATCH v3 22/24] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-17 Thread Andrew Donnellan
to the underlying implementation of sysfs binary attributes, as is the case for the OPAL secvar implementation - partial writes are unsupported and writes cannot be larger than PAGE_SIZE. Co-developed-by: Nayna Jain Signed-off-by: Nayna Jain Co-developed-by: Andrew Donnellan Signed-off-by: Andrew

[PATCH v3 20/24] powerpc/pseries: Add helpers to get PLPKS password

2023-01-17 Thread Andrew Donnellan
From: Russell Currey Add helper functions to get the PLPKS password. This will be used in a later patch to support passing the password between kernels over kexec. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/include/asm/plpks.h

[PATCH v3 24/24] integrity/powerpc: Support loading keys from pseries secvar

2023-01-17 Thread Andrew Donnellan
ect format is expected to be the same, so there shouldn't be any functional differences between objects retrieved from powernv and pseries. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- .../integrity/platform_certs/load_powerpc.c | 17 ++-

[PATCH v3 15/24] powerpc/pseries: Expose PLPKS config values, support additional fields

2023-01-17 Thread Andrew Donnellan
to support additional v3 API fields, minor fixes] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: Merge plpks fixes and signed update series with secvar series Refresh config values in plpks_get_usedspace() (ajd) Validate the config

[PATCH v3 18/24] powerpc/pseries: Make caller pass buffer to plpks_read_var()

2023-01-17 Thread Andrew Donnellan
o NULL and var->datalen will be populated. Update header file to document this. Suggested-by: Michael Ellerman Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch (mpe) --- arch/powerpc/include/asm/plpks.h | 12 arch/powerpc/platforms/pseries/plp

[PATCH v3 14/24] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2023-01-17 Thread Andrew Donnellan
not cross page boundaries Round up the allocations of these structures/buffers to the next power of 2 to make sure this happens. Reported-by: Benjamin Gray Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Andrew Donnellan Reviewed-by: Russ

[PATCH v3 19/24] powerpc/pseries: Turn PSERIES_PLPKS into a hidden option

2023-01-17 Thread Andrew Donnellan
. However, we can't get of the separate option completely, because it will also be used for SED Opal purposes. Change PSERIES_PLPKS into a hidden option, which is selected by PPC_SECURE_BOOT. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch --- arch/powerpc

[PATCH v3 17/24] powerpc/pseries: Log hcall return codes for PLPKS debug

2023-01-17 Thread Andrew Donnellan
-by: Russell Currey Signed-off-by: Andrew Donnellan --- arch/powerpc/platforms/pseries/plpks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c index 796ed5544ee5..96a026a37285 100644 --- a/arch/powerpc/platforms

[PATCH v3 12/24] powerpc/pseries: Move PLPKS constants to header file

2023-01-17 Thread Andrew Donnellan
From: Russell Currey Move the constants defined in plpks.c to plpks.h, and standardise their naming, so that PLPKS consumers can make use of them later on. Signed-off-by: Russell Currey Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc

[PATCH v3 05/24] powerpc/secvar: Handle max object size in the consumer

2023-01-17 Thread Andrew Donnellan
Signed-off-by: Andrew Donnellan --- v3: Change uint64_t type to u64 (mpe) --- arch/powerpc/include/asm/secvar.h| 1 + arch/powerpc/kernel/secvar-sysfs.c | 17 +++-- arch/powerpc/platforms/powernv/opal-secvar.c | 19 +++ 3 files changed, 23

[PATCH v3 10/24] powerpc/secvar: Don't print error on ENOENT when reading variables

2023-01-17 Thread Andrew Donnellan
Kuppusamy Signed-off-by: Andrew Donnellan --- v3: New patch --- arch/powerpc/kernel/secvar-sysfs.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/secvar-sysfs.c b/arch/powerpc/kernel/secvar-sysfs.c index 68fb0b857442..2499bfd04fad 100644 --- a/arch

[PATCH v3 09/24] powerpc/secvar: Warn when PAGE_SIZE is smaller than max object size

2023-01-17 Thread Andrew Donnellan
Due to sysfs constraints, when writing to a variable, we can only handle writes of up to PAGE_SIZE. It's possible that the maximum object size is larger than PAGE_SIZE, in which case, print a warning on boot so that the user is aware. Signed-off-by: Andrew Donnellan Signed-off-by: Russell

[PATCH v3 08/24] powerpc/secvar: Allow backend to populate static list of variable names

2023-01-17 Thread Andrew Donnellan
ead, let the backend put a NULL-terminated array of variable names into secvar_ops->var_names, which will be used if get_next() is undefined. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New patch (ajd/mpe) --- arch/powerpc/include/asm/secvar.h | 4 ++ arch/powerpc/

[PATCH v3 11/24] powerpc/pseries: Move plpks.h to include directory

2023-01-17 Thread Andrew Donnellan
From: Russell Currey Move plpks.h from platforms/pseries/ to include/asm/. This is necessary for later patches to make use of the PLPKS from code in other subsystems. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v3: New patch --- .../powerpc/{platforms/pseries

[PATCH v3 13/24] powerpc/pseries: Fix handling of PLPKS object flushing timeout

2023-01-17 Thread Andrew Donnellan
to the user. Handle the timeout case separately and return ETIMEDOUT if triggered. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Reported-by: Benjamin Gray Signed-off-by: Andrew Donnellan Tested-by: Russell Currey Reviewed-by: Russell Currey

[PATCH v3 06/24] powerpc/secvar: Clean up init error messages

2023-01-17 Thread Andrew Donnellan
Remove unnecessary prefixes from error messages in secvar_sysfs_init() (the file defines pr_fmt, so putting "secvar:" in every message is unnecessary). Make capitalisation and punctuation more consistent. Signed-off-by: Andrew Donnellan Signed-off-by: Russell Currey --- v3: New

[PATCH v3 04/24] powerpc/secvar: Handle format string in the consumer

2023-01-17 Thread Andrew Donnellan
From: Russell Currey The code that handles the format string in secvar-sysfs.c is entirely OPAL specific, so create a new "format" op in secvar_operations to make the secvar code more generic. No functional change. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --

[PATCH v3 00/24] pSeries dynamic secure boot secvar interface + platform keyring loading

2023-01-17 Thread Andrew Donnellan
Use sysfs_emit() instead of sprintf() for all sysfs strings Change the size of the sysfs binary attributes to include the 8-byte flags header, preventing truncation of large writes. Andrew Donnellan (8): powerpc/secvar: Clean up init error messages powerpc/secvar: Allow b

[PATCH v3 02/24] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set

2023-01-17 Thread Andrew Donnellan
From: Russell Currey The secvar code only supports one consumer at a time. Multiple consumers aren't possible at this point in time, but we'd want it to be obvious if it ever could happen. Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- arch/powerpc/kernel/secvar-ops.c | 4

[PATCH v3 01/24] powerpc/secvar: Use u64 in secvar_operations

2023-01-17 Thread Andrew Donnellan
Ellerman Reviewed-by: Russell Currey Reviewed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- v3: Include new patch --- arch/powerpc/include/asm/secvar.h| 9 +++-- arch/powerpc/kernel/secvar-sysfs.c | 8 arch/powerpc/platforms/powernv/opal

[PATCH v3 03/24] powerpc/secvar: Use sysfs_emit() instead of sprintf()

2023-01-17 Thread Andrew Donnellan
From: Russell Currey The secvar format string and object size sysfs files are both ASCII text, and should use sysfs_emit(). No functional change. Suggested-by: Greg Kroah-Hartman Signed-off-by: Russell Currey Signed-off-by: Andrew Donnellan --- v2: New patch (gregkh) --- arch/powerpc

Re: [PATCH] powerpc/secvar: Use u64 in secvar_operations

2023-01-16 Thread Andrew Donnellan
Change all the secvar related routines to use u64. > > Signed-off-by: Michael Ellerman We're going to include this patch in the next revision of our dynamic key management series. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH] powerpc/secvar: Use u64 in secvar_operations

2023-01-11 Thread Andrew Donnellan
Change all the secvar related routines to use u64. > > Signed-off-by: Michael Ellerman Reviewed-by: Andrew Donnellan -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-10 Thread Andrew Donnellan
think we need that config option at all, or if we do it > should > not be user selectable and just enabled automatically by > PSERIES_PLPKS. I actually think we should get rid of both PSERIES_PLPKS_SECVAR and PSERIES_PLPKS, and just use PPC_SECURE_BOOT / PPC_SECVAR_SYSFS. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-09 Thread Andrew Donnellan
writing into "buf" > directly > in case the hcall fails or something, but the other 3 copies seem > unnecessary. In the general case, I don't like passing buffer pointers straight from parameters into hcalls, since the address has to be in the linear map, and that's a detail I'd rather hide from callers. But otherwise, yes I think we can probably shift to having the caller allocate the buffers. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-08 Thread Andrew Donnellan
rnv support, in which case plpks_secvar_init() will be called unconditionally even when booting on a powernv machine. I can confirm that as it is, booting this on powernv qemu causes a panic. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH 4/4] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-08 Thread Andrew Donnellan
On Fri, 2023-01-06 at 21:54 +1100, Michael Ellerman wrote: > > +int plpks_signed_update_var(struct plpks_var var, u64 flags) > > +{ > > I don't see a reason why var is passed by value here? A pointer would > be > more typical. Will change. -- Andrew Donnellan

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-08 Thread Andrew Donnellan
e > other multi-line comments similarly old-fashioned for consistency. Sigh, I was trying to encourage you to move into the future... -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-08 Thread Andrew Donnellan
s up with the integrity subsystem to load keys into kernel keyrings. > > > diff --git a/arch/powerpc/platforms/pseries/plpks-secvar.c > > b/arch/powerpc/platforms/pseries/plpks-secvar.c > > new file mode 100644 > > index ..8298f039bef4 > > --- /dev/n

Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot

2023-01-05 Thread Andrew Donnellan
ill give you anyway). In a previous internal version, we printed a message when PAGE_SIZE < plpks_get_maxobjectsize(), might be worth still doing that? > > Co-developed-by: Nayna Jain > Signed-off-by: Nayna Jain > Co-developed-by: Andrew Donnellan > Signed-off-by: Andrew Donnell

Re: [PATCH v2 6/7] powerpc/secvar: Extend sysfs to include config vars

2023-01-04 Thread Andrew Donnellan
> they need to. > > This is not being used by the OPAL secvar implementation at present, > and > the config directory will not be created if no attributes are set. > > Signed-off-by: Russell Currey Minor comments below, but regardless: Reviewed-by: Andrew Donnellan > --- >

Re: [PATCH v2 5/7] powerpc/secvar: Handle max object size in the consumer

2023-01-03 Thread Andrew Donnellan
atform.  Should > be > no functional change. > > Signed-off-by: Russell Currey LGTM Reviewed-by: Andrew Donnellan > --- >  arch/powerpc/include/asm/secvar.h    |  1 + >  arch/powerpc/kernel/secvar-sysfs.c   | 17 +++-- >  arch/powerpc/platforms/powernv/opal-s

Re: [PATCH 3/4] powerpc/pseries: Expose PLPKS config values, support additional fields

2023-01-03 Thread Andrew Donnellan
tation also says this value must be at least 255, if we sanity > check that we don't have to worry about underflow. Agreed, and it makes more sense for the value that we return to the user to be the same as the number we actually get from the hypervisor. I'll fix it in the next spin. -- Andrew D

Re: [PATCH 4/4] powerpc/pseries: Implement signed update for PLPKS objects

2023-01-03 Thread Andrew Donnellan
> friendly > error code?  If I'm reading this right, we'd be replacing any non- > zero > return code with -EINVAL. Good catch, will fix. -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v2 4/7] powerpc/secvar: Handle format string in the consumer

2023-01-03 Thread Andrew Donnellan
igned-off-by: Russell Currey LGTM Reviewed-by: Andrew Donnellan > --- >  arch/powerpc/include/asm/secvar.h    |  1 + >  arch/powerpc/kernel/secvar-sysfs.c   | 21 +--- >  arch/powerpc/platforms/powernv/opal-secvar.c | 25 > >  3

Re: [PATCH v2 3/7] powerpc/secvar: Use sysfs_emit() instead of sprintf()

2023-01-03 Thread Andrew Donnellan
On Fri, 2022-12-30 at 15:20 +1100, Russell Currey wrote: > The secvar format string and object size sysfs files are both ASCII > text, and should use sysfs_emit().  No functional change. > > Suggested-by: Greg Kroah-Hartman > Signed-off-by: Russell Currey LGTM Reviewed-by: A

Re: [PATCH v2 2/7] powerpc/secvar: WARN_ON_ONCE() if multiple secvar ops are set

2023-01-03 Thread Andrew Donnellan
st struct secvar_operations *secvar_ops __ro_after_init = NULL; I think this is implicitly NULL, but it's fine to make it explicit. Reviewed-by: Andrew Donnellan >   >  void set_secvar_ops(const struct secvar_operations *ops) >  { > +   WARN_ON_ONCE(secvar_ops); > secvar

Re: [PATCH] drivers/misc/ocxl/context.c : eliminate unnecessary type conversions

2023-01-03 Thread Andrew Donnellan
On Mon, 2022-12-26 at 10:51 +0800, Dong Chuanjian wrote: > remove unnecessary void* type casting. > > Signed-off-by: Dong Chuanjian [+linuxppc-dev, which was misspelled in the original email] Acked-by: Andrew Donnellan > > diff --git a/drivers/misc/ocxl/context.c > b

Re: [PATCH v2 1/7] powerpc/pseries: Log hcall return codes for PLPKS debug

2023-01-03 Thread Andrew Donnellan
e don't lose information from the conversion. > > Signed-off-by: Russell Currey This is indeed useful to have. Reviewed-by: Andrew Donnellan Tested-by: Andrew Donnellan > --- >  arch/powerpc/platforms/pseries/plpks.c | 2 ++ >  1 file changed, 2 insertions(+) > > diff --git

[PATCH 2/4] powerpc/pseries: Fix alignment of PLPKS structures and buffers

2022-12-19 Thread Andrew Donnellan
not cross page boundaries Round up the allocations of these structures/buffers to the next power of 2 to make sure this happens. Reported-by: Benjamin Gray Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Signed-off-by: Andrew Donnellan --- arch/powerpc

[PATCH 3/4] powerpc/pseries: Expose PLPKS config values, support additional fields

2022-12-19 Thread Andrew Donnellan
-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- arch/powerpc/platforms/pseries/plpks.c | 118 ++--- arch/powerpc/platforms/pseries/plpks.h | 58 2 files changed, 164 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch

[PATCH 4/4] powerpc/pseries: Implement signed update for PLPKS objects

2022-12-19 Thread Andrew Donnellan
message, add timeout handling] Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan --- arch/powerpc/include/asm/hvcall.h | 3 +- arch/powerpc/platforms/pseries/plpks.c | 81 +++--- arch/powerpc/platforms/pseries/plpks.h | 5 ++ 3 files changed, 79 insertions

[PATCH 1/4] powerpc/pseries: Fix handling of PLPKS object flushing timeout

2022-12-19 Thread Andrew Donnellan
to the user. Handle the timeout case separately and return ETIMEDOUT if triggered. Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") Reported-by: Benjamin Gray Signed-off-by: Andrew Donnellan --- arch/powerpc/platforms/pseries/plpks.c | 11 +-- 1 fi

[PATCH 0/4] PLPKS bugfixes and enhancements

2022-12-19 Thread Andrew Donnellan
...@linux.ibm.com/ Many thanks to Russell Currey and Ben Gray for their help on this series. Andrew Donnellan (2): powerpc/pseries: Fix handling of PLPKS object flushing timeout powerpc/pseries: Fix alignment of PLPKS structures and buffers Nayna Jain (2): powerpc/pseries: Expose PLPKS config

Re: [PATCH 2/4] fs: define a firmware security filesystem named fwsecurityfs

2022-12-11 Thread Andrew Donnellan
ful > before we develop the next patch. Ping - it would be helpful for us to know your thoughts on this. Andrew -- Andrew DonnellanOzLabs, ADL Canberra a...@linux.ibm.com IBM Australia Limited

Re: [PATCH v3 2/7] selftests/powerpc: Add ptrace setup_core_pattern() null-terminator

2022-12-01 Thread Andrew Donnellan
ions on the buffer is risky. Explicitly add a > null > character to the end to make it safer. > > Signed-off-by: Benjamin Gray Reviewed-by: Andrew Donnellan > --- >  tools/testing/selftests/powerpc/ptrace/core-pkey.c | 4 +++- >  1 file changed, 3 insertions(+), 1 dele

Re: [PATCH 3/6] powerpc/pseries: Return -EIO instead of -EINTR for H_ABORTED error

2022-11-29 Thread Andrew Donnellan
2a ("powerpc/pseries: define driver for Platform > KeyStore") > Signed-off-by: Nayna Jain The interface spec states that, for PKS-related hcalls, H_Aborted means "error occurred processing request" rather than something that would specifically map to EINTR, so I think E

<    1   2   3   4   5   6   7   8   9   10   >