Skip to content

Commit 192c015

Browse files
committed
Merge tag 'powerpc-7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates for 7.0 - Implement masked user access - Add bpf support for internal only per-CPU instructions and inline the bpf_get_smp_processor_id() and bpf_get_current_task() functions - Fix pSeries MSI-X allocation failure when quota is exceeded - Fix recursive pci_lock_rescan_remove locking in EEH event handling - Support tailcalls with subprogs & BPF exceptions on 64bit - Extend "trusted" keys to support the PowerVM Key Wrapping Module (PKWM) Thanks to Abhishek Dubey, Christophe Leroy, Gaurav Batra, Guangshuo Li, Jarkko Sakkinen, Mahesh Salgaonkar, Mimi Zohar, Miquel Sabaté Solà, Nam Cao, Narayana Murty N, Nayna Jain, Nilay Shroff, Puranjay Mohan, Saket Kumar Bhaskar, Sourabh Jain, Srish Srinivasan, and Venkat Rao Bagalkote. * tag 'powerpc-7.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (27 commits) powerpc/pseries: plpks: export plpks_wrapping_is_supported docs: trusted-encryped: add PKWM as a new trust source keys/trusted_keys: establish PKWM as a trusted source pseries/plpks: add HCALLs for PowerVM Key Wrapping Module pseries/plpks: expose PowerVM wrapping features via the sysfs powerpc/pseries: move the PLPKS config inside its own sysfs directory pseries/plpks: fix kernel-doc comment inconsistencies powerpc/smp: Add check for kcalloc() failure in parse_thread_groups() powerpc: kgdb: Remove OUTBUFMAX constant powerpc64/bpf: Additional NVR handling for bpf_throw powerpc64/bpf: Support exceptions powerpc64/bpf: Add arch_bpf_stack_walk() for BPF JIT powerpc64/bpf: Avoid tailcall restore from trampoline powerpc64/bpf: Support tailcalls with subprogs powerpc64/bpf: Moving tail_call_cnt to bottom of frame powerpc/eeh: fix recursive pci_lock_rescan_remove locking in EEH event handling powerpc/pseries: Fix MSI-X allocation failure when quota is exceeded powerpc/iommu: bypass DMA APIs for coherent allocations for pre-mapped memory powerpc64/bpf: Inline bpf_get_smp_processor_id() and bpf_get_current_task/_btf() powerpc64/bpf: Support internal-only MOV instruction to resolve per-CPU addrs ...
2 parents 8ad8d24 + e2071f9 commit 192c015

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1850
-414
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
What: /sys/firmware/plpks/config
2+
Date: February 2023
3+
Contact: Nayna Jain <nayna@linux.ibm.com>
4+
Description: This optional directory contains read-only config attributes as
5+
defined by the PLPKS implementation. All data is in ASCII
6+
format.
7+
8+
What: /sys/firmware/plpks/config/version
9+
Date: February 2023
10+
Contact: Nayna Jain <nayna@linux.ibm.com>
11+
Description: Config version as reported by the hypervisor in ASCII decimal
12+
format.
13+
14+
What: /sys/firmware/plpks/config/max_object_size
15+
Date: February 2023
16+
Contact: Nayna Jain <nayna@linux.ibm.com>
17+
Description: Maximum allowed size of objects in the keystore in bytes,
18+
represented in ASCII decimal format.
19+
20+
This is not necessarily the same as the max size that can be
21+
written to an update file as writes can contain more than
22+
object data, you should use the size of the update file for
23+
that purpose.
24+
25+
What: /sys/firmware/plpks/config/total_size
26+
Date: February 2023
27+
Contact: Nayna Jain <nayna@linux.ibm.com>
28+
Description: Total size of the PLPKS in bytes, represented in ASCII decimal
29+
format.
30+
31+
What: /sys/firmware/plpks/config/used_space
32+
Date: February 2023
33+
Contact: Nayna Jain <nayna@linux.ibm.com>
34+
Description: Current space consumed by the key store, in bytes, represented
35+
in ASCII decimal format.
36+
37+
What: /sys/firmware/plpks/config/supported_policies
38+
Date: February 2023
39+
Contact: Nayna Jain <nayna@linux.ibm.com>
40+
Description: Bitmask of supported policy flags by the hypervisor, represented
41+
as an 8 byte hexadecimal ASCII string. Consult the hypervisor
42+
documentation for what these flags are.
43+
44+
What: /sys/firmware/plpks/config/signed_update_algorithms
45+
Date: February 2023
46+
Contact: Nayna Jain <nayna@linux.ibm.com>
47+
Description: Bitmask of flags indicating which algorithms the hypervisor
48+
supports for signed update of objects, represented as a 16 byte
49+
hexadecimal ASCII string. Consult the hypervisor documentation
50+
for what these flags mean.
51+
52+
What: /sys/firmware/plpks/config/wrapping_features
53+
Date: November 2025
54+
Contact: Srish Srinivasan <ssrish@linux.ibm.com>
55+
Description: Bitmask of the wrapping features indicating the wrapping
56+
algorithms that are supported for the H_PKS_WRAP_OBJECT requests
57+
, represented as a 8 byte hexadecimal ASCII string. Consult the
58+
hypervisor documentation for what these flags mean.

Documentation/ABI/testing/sysfs-secvar

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -63,68 +63,3 @@ Contact: Nayna Jain <nayna@linux.ibm.com>
6363
Description: A write-only file that is used to submit the new value for the
6464
variable. The size of the file represents the maximum size of
6565
the variable data that can be written.
66-
67-
What: /sys/firmware/secvar/config
68-
Date: February 2023
69-
Contact: Nayna Jain <nayna@linux.ibm.com>
70-
Description: This optional directory contains read-only config attributes as
71-
defined by the secure variable implementation. All data is in
72-
ASCII format. The directory is only created if the backing
73-
implementation provides variables to populate it, which at
74-
present is only PLPKS on the pseries platform.
75-
76-
What: /sys/firmware/secvar/config/version
77-
Date: February 2023
78-
Contact: Nayna Jain <nayna@linux.ibm.com>
79-
Description: Config version as reported by the hypervisor in ASCII decimal
80-
format.
81-
82-
Currently only provided by PLPKS on the pseries platform.
83-
84-
What: /sys/firmware/secvar/config/max_object_size
85-
Date: February 2023
86-
Contact: Nayna Jain <nayna@linux.ibm.com>
87-
Description: Maximum allowed size of objects in the keystore in bytes,
88-
represented in ASCII decimal format.
89-
90-
This is not necessarily the same as the max size that can be
91-
written to an update file as writes can contain more than
92-
object data, you should use the size of the update file for
93-
that purpose.
94-
95-
Currently only provided by PLPKS on the pseries platform.
96-
97-
What: /sys/firmware/secvar/config/total_size
98-
Date: February 2023
99-
Contact: Nayna Jain <nayna@linux.ibm.com>
100-
Description: Total size of the PLPKS in bytes, represented in ASCII decimal
101-
format.
102-
103-
Currently only provided by PLPKS on the pseries platform.
104-
105-
What: /sys/firmware/secvar/config/used_space
106-
Date: February 2023
107-
Contact: Nayna Jain <nayna@linux.ibm.com>
108-
Description: Current space consumed by the key store, in bytes, represented
109-
in ASCII decimal format.
110-
111-
Currently only provided by PLPKS on the pseries platform.
112-
113-
What: /sys/firmware/secvar/config/supported_policies
114-
Date: February 2023
115-
Contact: Nayna Jain <nayna@linux.ibm.com>
116-
Description: Bitmask of supported policy flags by the hypervisor,
117-
represented as an 8 byte hexadecimal ASCII string. Consult the
118-
hypervisor documentation for what these flags are.
119-
120-
Currently only provided by PLPKS on the pseries platform.
121-
122-
What: /sys/firmware/secvar/config/signed_update_algorithms
123-
Date: February 2023
124-
Contact: Nayna Jain <nayna@linux.ibm.com>
125-
Description: Bitmask of flags indicating which algorithms the hypervisor
126-
supports for signed update of objects, represented as a 16 byte
127-
hexadecimal ASCII string. Consult the hypervisor documentation
128-
for what these flags mean.
129-
130-
Currently only provided by PLPKS on the pseries platform.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7794,6 +7794,7 @@ Kernel parameters
77947794
- "tee"
77957795
- "caam"
77967796
- "dcp"
7797+
- "pkwm"
77977798
If not specified then it defaults to iterating through
77987799
the trust source list starting with TPM and assigns the
77997800
first trust source as a backend which is initialized

Documentation/arch/powerpc/papr_hcalls.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,49 @@ H_HTM supports setup, configuration, control and dumping of Hardware Trace
300300
Macro (HTM) function and its data. HTM buffer stores tracing data for functions
301301
like core instruction, core LLAT and nest.
302302

303+
**H_PKS_GEN_KEY**
304+
305+
| Input: authorization, objectlabel, objectlabellen, policy, out, outlen
306+
| Out: *Hypervisor Generated Key, or None when the wrapping key policy is set*
307+
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
308+
H_P3, H_P4, H_P5, H_P6, H_Authority, H_Nomem, H_Busy, H_Resource,
309+
H_Aborted*
310+
311+
H_PKS_GEN_KEY is used to have the hypervisor generate a new random key.
312+
This key is stored as an object in the Power LPAR Platform KeyStore with
313+
the provided object label. With the wrapping key policy set the key is only
314+
visible to the hypervisor, while the key's label would still be visible to
315+
the user. Generation of wrapping keys is supported only for a key size of
316+
32 bytes.
317+
318+
**H_PKS_WRAP_OBJECT**
319+
320+
| Input: authorization, wrapkeylabel, wrapkeylabellen, objectwrapflags, in,
321+
| inlen, out, outlen, continue-token
322+
| Out: *continue-token, byte size of wrapped object, wrapped object*
323+
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
324+
H_P3, H_P4, H_P5, H_P6, H_P7, H_P8, H_P9, H_Authority, H_Invalid_Key,
325+
H_NOT_FOUND, H_Busy, H_LongBusy, H_Aborted*
326+
327+
H_PKS_WRAP_OBJECT is used to wrap an object using a wrapping key stored in the
328+
Power LPAR Platform KeyStore and return the wrapped object to the caller. The
329+
caller provides a label to a wrapping key with the 'wrapping key' policy set,
330+
which must have been previously created with H_PKS_GEN_KEY. The provided object
331+
is then encrypted with the wrapping key and additional metadata and the result
332+
is returned to the caller.
333+
334+
335+
**H_PKS_UNWRAP_OBJECT**
336+
337+
| Input: authorization, objectwrapflags, in, inlen, out, outlen, continue-token
338+
| Out: *continue-token, byte size of unwrapped object, unwrapped object*
339+
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
340+
H_P3, H_P4, H_P5, H_P6, H_P7, H_Authority, H_Unsupported, H_Bad_Data,
341+
H_NOT_FOUND, H_Invalid_Key, H_Busy, H_LongBusy, H_Aborted*
342+
343+
H_PKS_UNWRAP_OBJECT is used to unwrap an object that was previously warapped with
344+
H_PKS_WRAP_OBJECT.
345+
303346
References
304347
==========
305348
.. [1] "Power Architecture Platform Reference"

Documentation/security/keys/trusted-encrypted.rst

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ safe.
8181
and the UNIQUE key. Default is to use the UNIQUE key, but selecting
8282
the OTP key can be done via a module parameter (dcp_use_otp_key).
8383

84+
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
85+
86+
Rooted to a unique, per-LPAR key, which is derived from a system-wide,
87+
randomly generated LPAR root key. Both the per-LPAR keys and the LPAR
88+
root key are stored in hypervisor-owned secure memory at runtime,
89+
and the LPAR root key is additionally persisted in secure locations
90+
such as the processor SEEPROMs and encrypted NVRAM.
91+
8492
* Execution isolation
8593

8694
(1) TPM
@@ -102,6 +110,14 @@ safe.
102110
environment. Only basic blob key encryption is executed there.
103111
The actual key sealing/unsealing is done on main processor/kernel space.
104112

113+
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
114+
115+
Fixed set of cryptographic operations done on on-chip hardware
116+
cryptographic acceleration unit NX. Keys for wrapping and unwrapping
117+
are managed by PowerVM Platform KeyStore, which stores keys in an
118+
isolated in-memory copy in secure hypervisor memory, as well as in a
119+
persistent copy in hypervisor-encrypted NVRAM.
120+
105121
* Optional binding to platform integrity state
106122

107123
(1) TPM
@@ -129,6 +145,11 @@ safe.
129145
Relies on Secure/Trusted boot process (called HAB by vendor) for
130146
platform integrity.
131147

148+
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
149+
150+
Relies on secure and trusted boot process of IBM Power systems for
151+
platform integrity.
152+
132153
* Interfaces and APIs
133154

134155
(1) TPM
@@ -149,6 +170,11 @@ safe.
149170
Vendor-specific API that is implemented as part of the DCP crypto driver in
150171
``drivers/crypto/mxs-dcp.c``.
151172

173+
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
174+
175+
Platform Keystore has well documented interfaces in PAPR document.
176+
Refer to ``Documentation/arch/powerpc/papr_hcalls.rst``
177+
152178
* Threat model
153179

154180
The strength and appropriateness of a particular trust source for a given
@@ -191,6 +217,10 @@ selected trust source:
191217
a dedicated hardware RNG that is independent from DCP which can be enabled
192218
to back the kernel RNG.
193219

220+
* PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
221+
222+
The normal kernel random number generator is used to generate keys.
223+
194224
Users may override this by specifying ``trusted.rng=kernel`` on the kernel
195225
command-line to override the used RNG with the kernel's random number pool.
196226

@@ -321,6 +351,26 @@ Usage::
321351
specific to this DCP key-blob implementation. The key length for new keys is
322352
always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
323353

354+
Trusted Keys usage: PKWM
355+
------------------------
356+
357+
Usage::
358+
359+
keyctl add trusted name "new keylen [options]" ring
360+
keyctl add trusted name "load hex_blob" ring
361+
keyctl print keyid
362+
363+
options:
364+
wrap_flags= ascii hex value of security policy requirement
365+
0x00: no secure boot requirement (default)
366+
0x01: require secure boot to be in either audit or
367+
enforced mode
368+
0x02: require secure boot to be in enforced mode
369+
370+
"keyctl print" returns an ASCII hex copy of the sealed key, which is in format
371+
specific to PKWM key-blob implementation. The key length for new keys is
372+
always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
373+
324374
Encrypted Keys usage
325375
--------------------
326376

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14034,6 +14034,15 @@ S: Supported
1403414034
F: include/keys/trusted_dcp.h
1403514035
F: security/keys/trusted-keys/trusted_dcp.c
1403614036

14037+
KEYS-TRUSTED-PLPKS
14038+
M: Srish Srinivasan <ssrish@linux.ibm.com>
14039+
M: Nayna Jain <nayna@linux.ibm.com>
14040+
L: linux-integrity@vger.kernel.org
14041+
L: keyrings@vger.kernel.org
14042+
S: Supported
14043+
F: include/keys/trusted_pkwm.h
14044+
F: security/keys/trusted-keys/trusted_pkwm.c
14045+
1403714046
KEYS-TRUSTED-TEE
1403814047
M: Sumit Garg <sumit.garg@kernel.org>
1403914048
L: linux-integrity@vger.kernel.org

arch/powerpc/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,9 +1293,8 @@ config TASK_SIZE_BOOL
12931293
Say N here unless you know what you are doing.
12941294

12951295
config TASK_SIZE
1296-
hex "Size of user task space" if TASK_SIZE_BOOL
1296+
hex "Size of maximum user task space" if TASK_SIZE_BOOL
12971297
default "0x80000000" if PPC_8xx
1298-
default "0xb0000000" if PPC_BOOK3S_32 && EXECMEM
12991298
default "0xc0000000"
13001299

13011300
config MODULES_SIZE_BOOL

arch/powerpc/include/asm/barrier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ do { \
102102

103103
#else /* !CONFIG_PPC_BARRIER_NOSPEC */
104104
#define barrier_nospec_asm
105-
#define barrier_nospec()
105+
#define barrier_nospec() do {} while (0)
106106
#endif /* CONFIG_PPC_BARRIER_NOSPEC */
107107

108108
/*

arch/powerpc/include/asm/book3s/32/kup.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ static __always_inline unsigned long __kuap_get_and_assert_locked(void)
9797
}
9898
#define __kuap_get_and_assert_locked __kuap_get_and_assert_locked
9999

100-
static __always_inline void allow_user_access(void __user *to, const void __user *from,
101-
u32 size, unsigned long dir)
100+
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
102101
{
103102
BUILD_BUG_ON(!__builtin_constant_p(dir));
104103

arch/powerpc/include/asm/book3s/32/mmu-hash.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,15 @@ extern s32 patch__hash_page_B, patch__hash_page_C;
192192
extern s32 patch__flush_hash_A0, patch__flush_hash_A1, patch__flush_hash_A2;
193193
extern s32 patch__flush_hash_B;
194194

195+
#include <linux/sizes.h>
196+
#include <linux/align.h>
197+
195198
#include <asm/reg.h>
196199
#include <asm/task_size_32.h>
197200

198201
static __always_inline void update_user_segment(u32 n, u32 val)
199202
{
200-
if (n << 28 < TASK_SIZE)
203+
if (n << 28 < ALIGN(TASK_SIZE, SZ_256M))
201204
mtsr(val + n * 0x111, n << 28);
202205
}
203206

0 commit comments

Comments
 (0)