mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
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 ...
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
What: /sys/firmware/plpks/config
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: This optional directory contains read-only config attributes as
|
||||
defined by the PLPKS implementation. All data is in ASCII
|
||||
format.
|
||||
|
||||
What: /sys/firmware/plpks/config/version
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Config version as reported by the hypervisor in ASCII decimal
|
||||
format.
|
||||
|
||||
What: /sys/firmware/plpks/config/max_object_size
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Maximum allowed size of objects in the keystore in bytes,
|
||||
represented in ASCII decimal format.
|
||||
|
||||
This is not necessarily the same as the max size that can be
|
||||
written to an update file as writes can contain more than
|
||||
object data, you should use the size of the update file for
|
||||
that purpose.
|
||||
|
||||
What: /sys/firmware/plpks/config/total_size
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Total size of the PLPKS in bytes, represented in ASCII decimal
|
||||
format.
|
||||
|
||||
What: /sys/firmware/plpks/config/used_space
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Current space consumed by the key store, in bytes, represented
|
||||
in ASCII decimal format.
|
||||
|
||||
What: /sys/firmware/plpks/config/supported_policies
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Bitmask of supported policy flags by the hypervisor, represented
|
||||
as an 8 byte hexadecimal ASCII string. Consult the hypervisor
|
||||
documentation for what these flags are.
|
||||
|
||||
What: /sys/firmware/plpks/config/signed_update_algorithms
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Bitmask of flags indicating which algorithms the hypervisor
|
||||
supports for signed update of objects, represented as a 16 byte
|
||||
hexadecimal ASCII string. Consult the hypervisor documentation
|
||||
for what these flags mean.
|
||||
|
||||
What: /sys/firmware/plpks/config/wrapping_features
|
||||
Date: November 2025
|
||||
Contact: Srish Srinivasan <ssrish@linux.ibm.com>
|
||||
Description: Bitmask of the wrapping features indicating the wrapping
|
||||
algorithms that are supported for the H_PKS_WRAP_OBJECT requests
|
||||
, represented as a 8 byte hexadecimal ASCII string. Consult the
|
||||
hypervisor documentation for what these flags mean.
|
||||
@@ -63,68 +63,3 @@ Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: A write-only file that is used to submit the new value for the
|
||||
variable. The size of the file represents the maximum size of
|
||||
the variable data that can be written.
|
||||
|
||||
What: /sys/firmware/secvar/config
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: This optional directory contains read-only config attributes as
|
||||
defined by the secure variable implementation. All data is in
|
||||
ASCII format. The directory is only created if the backing
|
||||
implementation provides variables to populate it, which at
|
||||
present is only PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/version
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Config version as reported by the hypervisor in ASCII decimal
|
||||
format.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/max_object_size
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Maximum allowed size of objects in the keystore in bytes,
|
||||
represented in ASCII decimal format.
|
||||
|
||||
This is not necessarily the same as the max size that can be
|
||||
written to an update file as writes can contain more than
|
||||
object data, you should use the size of the update file for
|
||||
that purpose.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/total_size
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Total size of the PLPKS in bytes, represented in ASCII decimal
|
||||
format.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/used_space
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Current space consumed by the key store, in bytes, represented
|
||||
in ASCII decimal format.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/supported_policies
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Bitmask of supported policy flags by the hypervisor,
|
||||
represented as an 8 byte hexadecimal ASCII string. Consult the
|
||||
hypervisor documentation for what these flags are.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
What: /sys/firmware/secvar/config/signed_update_algorithms
|
||||
Date: February 2023
|
||||
Contact: Nayna Jain <nayna@linux.ibm.com>
|
||||
Description: Bitmask of flags indicating which algorithms the hypervisor
|
||||
supports for signed update of objects, represented as a 16 byte
|
||||
hexadecimal ASCII string. Consult the hypervisor documentation
|
||||
for what these flags mean.
|
||||
|
||||
Currently only provided by PLPKS on the pseries platform.
|
||||
|
||||
@@ -7794,6 +7794,7 @@ Kernel parameters
|
||||
- "tee"
|
||||
- "caam"
|
||||
- "dcp"
|
||||
- "pkwm"
|
||||
If not specified then it defaults to iterating through
|
||||
the trust source list starting with TPM and assigns the
|
||||
first trust source as a backend which is initialized
|
||||
|
||||
@@ -300,6 +300,49 @@ H_HTM supports setup, configuration, control and dumping of Hardware Trace
|
||||
Macro (HTM) function and its data. HTM buffer stores tracing data for functions
|
||||
like core instruction, core LLAT and nest.
|
||||
|
||||
**H_PKS_GEN_KEY**
|
||||
|
||||
| Input: authorization, objectlabel, objectlabellen, policy, out, outlen
|
||||
| Out: *Hypervisor Generated Key, or None when the wrapping key policy is set*
|
||||
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
|
||||
H_P3, H_P4, H_P5, H_P6, H_Authority, H_Nomem, H_Busy, H_Resource,
|
||||
H_Aborted*
|
||||
|
||||
H_PKS_GEN_KEY is used to have the hypervisor generate a new random key.
|
||||
This key is stored as an object in the Power LPAR Platform KeyStore with
|
||||
the provided object label. With the wrapping key policy set the key is only
|
||||
visible to the hypervisor, while the key's label would still be visible to
|
||||
the user. Generation of wrapping keys is supported only for a key size of
|
||||
32 bytes.
|
||||
|
||||
**H_PKS_WRAP_OBJECT**
|
||||
|
||||
| Input: authorization, wrapkeylabel, wrapkeylabellen, objectwrapflags, in,
|
||||
| inlen, out, outlen, continue-token
|
||||
| Out: *continue-token, byte size of wrapped object, wrapped object*
|
||||
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
|
||||
H_P3, H_P4, H_P5, H_P6, H_P7, H_P8, H_P9, H_Authority, H_Invalid_Key,
|
||||
H_NOT_FOUND, H_Busy, H_LongBusy, H_Aborted*
|
||||
|
||||
H_PKS_WRAP_OBJECT is used to wrap an object using a wrapping key stored in the
|
||||
Power LPAR Platform KeyStore and return the wrapped object to the caller. The
|
||||
caller provides a label to a wrapping key with the 'wrapping key' policy set,
|
||||
which must have been previously created with H_PKS_GEN_KEY. The provided object
|
||||
is then encrypted with the wrapping key and additional metadata and the result
|
||||
is returned to the caller.
|
||||
|
||||
|
||||
**H_PKS_UNWRAP_OBJECT**
|
||||
|
||||
| Input: authorization, objectwrapflags, in, inlen, out, outlen, continue-token
|
||||
| Out: *continue-token, byte size of unwrapped object, unwrapped object*
|
||||
| Return Value: *H_SUCCESS, H_Function, H_State, H_R_State, H_Parameter, H_P2,
|
||||
H_P3, H_P4, H_P5, H_P6, H_P7, H_Authority, H_Unsupported, H_Bad_Data,
|
||||
H_NOT_FOUND, H_Invalid_Key, H_Busy, H_LongBusy, H_Aborted*
|
||||
|
||||
H_PKS_UNWRAP_OBJECT is used to unwrap an object that was previously warapped with
|
||||
H_PKS_WRAP_OBJECT.
|
||||
|
||||
References
|
||||
==========
|
||||
.. [1] "Power Architecture Platform Reference"
|
||||
|
||||
@@ -81,6 +81,14 @@ safe.
|
||||
and the UNIQUE key. Default is to use the UNIQUE key, but selecting
|
||||
the OTP key can be done via a module parameter (dcp_use_otp_key).
|
||||
|
||||
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
|
||||
|
||||
Rooted to a unique, per-LPAR key, which is derived from a system-wide,
|
||||
randomly generated LPAR root key. Both the per-LPAR keys and the LPAR
|
||||
root key are stored in hypervisor-owned secure memory at runtime,
|
||||
and the LPAR root key is additionally persisted in secure locations
|
||||
such as the processor SEEPROMs and encrypted NVRAM.
|
||||
|
||||
* Execution isolation
|
||||
|
||||
(1) TPM
|
||||
@@ -102,6 +110,14 @@ safe.
|
||||
environment. Only basic blob key encryption is executed there.
|
||||
The actual key sealing/unsealing is done on main processor/kernel space.
|
||||
|
||||
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
|
||||
|
||||
Fixed set of cryptographic operations done on on-chip hardware
|
||||
cryptographic acceleration unit NX. Keys for wrapping and unwrapping
|
||||
are managed by PowerVM Platform KeyStore, which stores keys in an
|
||||
isolated in-memory copy in secure hypervisor memory, as well as in a
|
||||
persistent copy in hypervisor-encrypted NVRAM.
|
||||
|
||||
* Optional binding to platform integrity state
|
||||
|
||||
(1) TPM
|
||||
@@ -129,6 +145,11 @@ safe.
|
||||
Relies on Secure/Trusted boot process (called HAB by vendor) for
|
||||
platform integrity.
|
||||
|
||||
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
|
||||
|
||||
Relies on secure and trusted boot process of IBM Power systems for
|
||||
platform integrity.
|
||||
|
||||
* Interfaces and APIs
|
||||
|
||||
(1) TPM
|
||||
@@ -149,6 +170,11 @@ safe.
|
||||
Vendor-specific API that is implemented as part of the DCP crypto driver in
|
||||
``drivers/crypto/mxs-dcp.c``.
|
||||
|
||||
(5) PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
|
||||
|
||||
Platform Keystore has well documented interfaces in PAPR document.
|
||||
Refer to ``Documentation/arch/powerpc/papr_hcalls.rst``
|
||||
|
||||
* Threat model
|
||||
|
||||
The strength and appropriateness of a particular trust source for a given
|
||||
@@ -191,6 +217,10 @@ selected trust source:
|
||||
a dedicated hardware RNG that is independent from DCP which can be enabled
|
||||
to back the kernel RNG.
|
||||
|
||||
* PKWM (PowerVM Key Wrapping Module: IBM PowerVM + Platform KeyStore)
|
||||
|
||||
The normal kernel random number generator is used to generate keys.
|
||||
|
||||
Users may override this by specifying ``trusted.rng=kernel`` on the kernel
|
||||
command-line to override the used RNG with the kernel's random number pool.
|
||||
|
||||
@@ -321,6 +351,26 @@ Usage::
|
||||
specific to this DCP key-blob implementation. The key length for new keys is
|
||||
always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
|
||||
|
||||
Trusted Keys usage: PKWM
|
||||
------------------------
|
||||
|
||||
Usage::
|
||||
|
||||
keyctl add trusted name "new keylen [options]" ring
|
||||
keyctl add trusted name "load hex_blob" ring
|
||||
keyctl print keyid
|
||||
|
||||
options:
|
||||
wrap_flags= ascii hex value of security policy requirement
|
||||
0x00: no secure boot requirement (default)
|
||||
0x01: require secure boot to be in either audit or
|
||||
enforced mode
|
||||
0x02: require secure boot to be in enforced mode
|
||||
|
||||
"keyctl print" returns an ASCII hex copy of the sealed key, which is in format
|
||||
specific to PKWM key-blob implementation. The key length for new keys is
|
||||
always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
|
||||
|
||||
Encrypted Keys usage
|
||||
--------------------
|
||||
|
||||
|
||||
@@ -14034,6 +14034,15 @@ S: Supported
|
||||
F: include/keys/trusted_dcp.h
|
||||
F: security/keys/trusted-keys/trusted_dcp.c
|
||||
|
||||
KEYS-TRUSTED-PLPKS
|
||||
M: Srish Srinivasan <ssrish@linux.ibm.com>
|
||||
M: Nayna Jain <nayna@linux.ibm.com>
|
||||
L: linux-integrity@vger.kernel.org
|
||||
L: keyrings@vger.kernel.org
|
||||
S: Supported
|
||||
F: include/keys/trusted_pkwm.h
|
||||
F: security/keys/trusted-keys/trusted_pkwm.c
|
||||
|
||||
KEYS-TRUSTED-TEE
|
||||
M: Sumit Garg <sumit.garg@kernel.org>
|
||||
L: linux-integrity@vger.kernel.org
|
||||
|
||||
@@ -1293,9 +1293,8 @@ config TASK_SIZE_BOOL
|
||||
Say N here unless you know what you are doing.
|
||||
|
||||
config TASK_SIZE
|
||||
hex "Size of user task space" if TASK_SIZE_BOOL
|
||||
hex "Size of maximum user task space" if TASK_SIZE_BOOL
|
||||
default "0x80000000" if PPC_8xx
|
||||
default "0xb0000000" if PPC_BOOK3S_32 && EXECMEM
|
||||
default "0xc0000000"
|
||||
|
||||
config MODULES_SIZE_BOOL
|
||||
|
||||
@@ -102,7 +102,7 @@ do { \
|
||||
|
||||
#else /* !CONFIG_PPC_BARRIER_NOSPEC */
|
||||
#define barrier_nospec_asm
|
||||
#define barrier_nospec()
|
||||
#define barrier_nospec() do {} while (0)
|
||||
#endif /* CONFIG_PPC_BARRIER_NOSPEC */
|
||||
|
||||
/*
|
||||
|
||||
@@ -97,8 +97,7 @@ static __always_inline unsigned long __kuap_get_and_assert_locked(void)
|
||||
}
|
||||
#define __kuap_get_and_assert_locked __kuap_get_and_assert_locked
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
u32 size, unsigned long dir)
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
|
||||
{
|
||||
BUILD_BUG_ON(!__builtin_constant_p(dir));
|
||||
|
||||
|
||||
@@ -192,12 +192,15 @@ extern s32 patch__hash_page_B, patch__hash_page_C;
|
||||
extern s32 patch__flush_hash_A0, patch__flush_hash_A1, patch__flush_hash_A2;
|
||||
extern s32 patch__flush_hash_B;
|
||||
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/align.h>
|
||||
|
||||
#include <asm/reg.h>
|
||||
#include <asm/task_size_32.h>
|
||||
|
||||
static __always_inline void update_user_segment(u32 n, u32 val)
|
||||
{
|
||||
if (n << 28 < TASK_SIZE)
|
||||
if (n << 28 < ALIGN(TASK_SIZE, SZ_256M))
|
||||
mtsr(val + n * 0x111, n << 28);
|
||||
}
|
||||
|
||||
|
||||
@@ -195,10 +195,6 @@ void unmap_kernel_page(unsigned long va);
|
||||
#define VMALLOC_END ioremap_bot
|
||||
#endif
|
||||
|
||||
#define MODULES_END ALIGN_DOWN(PAGE_OFFSET, SZ_256M)
|
||||
#define MODULES_SIZE (CONFIG_MODULES_SIZE * SZ_1M)
|
||||
#define MODULES_VADDR (MODULES_END - MODULES_SIZE)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <linux/sched.h>
|
||||
#include <linux/threads.h>
|
||||
|
||||
@@ -353,8 +353,7 @@ __bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
|
||||
return (regs->amr & AMR_KUAP_BLOCK_READ) == AMR_KUAP_BLOCK_READ;
|
||||
}
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
unsigned long size, unsigned long dir)
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
|
||||
{
|
||||
unsigned long thread_amr = 0;
|
||||
|
||||
@@ -383,8 +382,7 @@ static __always_inline unsigned long get_kuap(void)
|
||||
|
||||
static __always_inline void set_kuap(unsigned long value) { }
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
unsigned long size, unsigned long dir)
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
|
||||
{ }
|
||||
|
||||
#endif /* !CONFIG_PPC_KUAP */
|
||||
|
||||
@@ -289,6 +289,8 @@ void eeh_pe_dev_traverse(struct eeh_pe *root,
|
||||
void eeh_pe_restore_bars(struct eeh_pe *pe);
|
||||
const char *eeh_pe_loc_get(struct eeh_pe *pe);
|
||||
struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
|
||||
const char *eeh_pe_loc_get_bus(struct pci_bus *bus);
|
||||
struct pci_bus *eeh_pe_bus_get_nolock(struct eeh_pe *pe);
|
||||
|
||||
void eeh_show_enabled(void);
|
||||
int __init eeh_init(struct eeh_ops *ops);
|
||||
|
||||
@@ -360,7 +360,9 @@
|
||||
#define H_GUEST_RUN_VCPU 0x480
|
||||
#define H_GUEST_COPY_MEMORY 0x484
|
||||
#define H_GUEST_DELETE 0x488
|
||||
#define MAX_HCALL_OPCODE H_GUEST_DELETE
|
||||
#define H_PKS_WRAP_OBJECT 0x490
|
||||
#define H_PKS_UNWRAP_OBJECT 0x494
|
||||
#define MAX_HCALL_OPCODE H_PKS_UNWRAP_OBJECT
|
||||
|
||||
/* Scope args for H_SCM_UNBIND_ALL */
|
||||
#define H_UNBIND_SCOPE_ALL (0x1)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#define BREAK_INSTR_SIZE 4
|
||||
#define BUFMAX ((NUMREGBYTES * 2) + 512)
|
||||
#define OUTBUFMAX ((NUMREGBYTES * 2) + 512)
|
||||
|
||||
#define BREAK_INSTR 0x7d821008 /* twge r2, r2 */
|
||||
|
||||
|
||||
@@ -72,8 +72,7 @@ static __always_inline void __kuap_kernel_restore(struct pt_regs *regs, unsigned
|
||||
* platforms.
|
||||
*/
|
||||
#ifndef CONFIG_PPC_BOOK3S_64
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
unsigned long size, unsigned long dir) { }
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir) { }
|
||||
static __always_inline void prevent_user_access(unsigned long dir) { }
|
||||
static __always_inline unsigned long prevent_user_access_return(void) { return 0UL; }
|
||||
static __always_inline void restore_user_access(unsigned long flags) { }
|
||||
@@ -132,55 +131,6 @@ static __always_inline void kuap_assert_locked(void)
|
||||
kuap_get_and_assert_locked();
|
||||
}
|
||||
|
||||
static __always_inline void allow_read_from_user(const void __user *from, unsigned long size)
|
||||
{
|
||||
barrier_nospec();
|
||||
allow_user_access(NULL, from, size, KUAP_READ);
|
||||
}
|
||||
|
||||
static __always_inline void allow_write_to_user(void __user *to, unsigned long size)
|
||||
{
|
||||
allow_user_access(to, NULL, size, KUAP_WRITE);
|
||||
}
|
||||
|
||||
static __always_inline void allow_read_write_user(void __user *to, const void __user *from,
|
||||
unsigned long size)
|
||||
{
|
||||
barrier_nospec();
|
||||
allow_user_access(to, from, size, KUAP_READ_WRITE);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_read_from_user(const void __user *from, unsigned long size)
|
||||
{
|
||||
prevent_user_access(KUAP_READ);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_write_to_user(void __user *to, unsigned long size)
|
||||
{
|
||||
prevent_user_access(KUAP_WRITE);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_read_write_user(void __user *to, const void __user *from,
|
||||
unsigned long size)
|
||||
{
|
||||
prevent_user_access(KUAP_READ_WRITE);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_current_access_user(void)
|
||||
{
|
||||
prevent_user_access(KUAP_READ_WRITE);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_current_read_from_user(void)
|
||||
{
|
||||
prevent_user_access(KUAP_READ);
|
||||
}
|
||||
|
||||
static __always_inline void prevent_current_write_to_user(void)
|
||||
{
|
||||
prevent_user_access(KUAP_WRITE);
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#endif /* _ASM_POWERPC_KUAP_H_ */
|
||||
|
||||
@@ -49,8 +49,7 @@ static __always_inline void uaccess_end_8xx(void)
|
||||
"i"(SPRN_MD_AP), "r"(MD_APG_KUAP), "i"(MMU_FTR_KUAP) : "memory");
|
||||
}
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
unsigned long size, unsigned long dir)
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
|
||||
{
|
||||
uaccess_begin_8xx(MD_APG_INIT);
|
||||
}
|
||||
|
||||
@@ -170,10 +170,6 @@
|
||||
|
||||
#define mmu_linear_psize MMU_PAGE_8M
|
||||
|
||||
#define MODULES_END PAGE_OFFSET
|
||||
#define MODULES_SIZE (CONFIG_MODULES_SIZE * SZ_1M)
|
||||
#define MODULES_VADDR (MODULES_END - MODULES_SIZE)
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <linux/mmdebug.h>
|
||||
|
||||
@@ -73,8 +73,7 @@ static __always_inline void uaccess_end_booke(void)
|
||||
"i"(SPRN_PID), "r"(0), "i"(MMU_FTR_KUAP) : "memory");
|
||||
}
|
||||
|
||||
static __always_inline void allow_user_access(void __user *to, const void __user *from,
|
||||
unsigned long size, unsigned long dir)
|
||||
static __always_inline void allow_user_access(void __user *to, unsigned long dir)
|
||||
{
|
||||
uaccess_begin_booke(current->thread.pid);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/kobject.h>
|
||||
|
||||
// Object policy flags from supported_policies
|
||||
#define PLPKS_OSSECBOOTAUDIT PPC_BIT32(1) // OS secure boot must be audit/enforce
|
||||
@@ -22,6 +23,7 @@
|
||||
#define PLPKS_IMMUTABLE PPC_BIT32(5) // Once written, object cannot be removed
|
||||
#define PLPKS_TRANSIENT PPC_BIT32(6) // Object does not persist through reboot
|
||||
#define PLPKS_SIGNEDUPDATE PPC_BIT32(7) // Object can only be modified by signed updates
|
||||
#define PLPKS_WRAPPINGKEY PPC_BIT32(8) // Object contains a wrapping key
|
||||
#define PLPKS_HVPROVISIONED PPC_BIT32(28) // Hypervisor has provisioned this object
|
||||
|
||||
// Signature algorithm flags from signed_update_algorithms
|
||||
@@ -67,128 +69,67 @@ struct plpks_var_name_list {
|
||||
struct plpks_var_name varlist[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the authenticated variable. It expects NULL as the component.
|
||||
*/
|
||||
int plpks_signed_update_var(struct plpks_var *var, u64 flags);
|
||||
|
||||
/**
|
||||
* Writes the specified var and its data to PKS.
|
||||
* Any caller of PKS driver should present a valid component type for
|
||||
* their variable.
|
||||
*/
|
||||
int plpks_write_var(struct plpks_var var);
|
||||
|
||||
/**
|
||||
* Removes the specified var and its data from PKS.
|
||||
*/
|
||||
int plpks_remove_var(char *component, u8 varos,
|
||||
struct plpks_var_name vname);
|
||||
|
||||
/**
|
||||
* Returns the data for the specified os variable.
|
||||
*
|
||||
* Caller must allocate a buffer in var->data with length in var->datalen.
|
||||
* If no buffer is provided, var->datalen will be populated with the object's
|
||||
* size.
|
||||
*/
|
||||
int plpks_read_os_var(struct plpks_var *var);
|
||||
|
||||
/**
|
||||
* Returns the data for the specified firmware variable.
|
||||
*
|
||||
* Caller must allocate a buffer in var->data with length in var->datalen.
|
||||
* If no buffer is provided, var->datalen will be populated with the object's
|
||||
* size.
|
||||
*/
|
||||
int plpks_read_fw_var(struct plpks_var *var);
|
||||
|
||||
/**
|
||||
* Returns the data for the specified bootloader variable.
|
||||
*
|
||||
* Caller must allocate a buffer in var->data with length in var->datalen.
|
||||
* If no buffer is provided, var->datalen will be populated with the object's
|
||||
* size.
|
||||
*/
|
||||
int plpks_read_bootloader_var(struct plpks_var *var);
|
||||
|
||||
/**
|
||||
* Returns if PKS is available on this LPAR.
|
||||
*/
|
||||
bool plpks_is_available(void);
|
||||
|
||||
/**
|
||||
* Returns version of the Platform KeyStore.
|
||||
*/
|
||||
u8 plpks_get_version(void);
|
||||
|
||||
/**
|
||||
* Returns hypervisor storage overhead per object, not including the size of
|
||||
* the object or label. Only valid for config version >= 2
|
||||
*/
|
||||
u16 plpks_get_objoverhead(void);
|
||||
|
||||
/**
|
||||
* Returns maximum password size. Must be >= 32 bytes
|
||||
*/
|
||||
u16 plpks_get_maxpwsize(void);
|
||||
|
||||
/**
|
||||
* Returns maximum object size supported by Platform KeyStore.
|
||||
*/
|
||||
u16 plpks_get_maxobjectsize(void);
|
||||
|
||||
/**
|
||||
* Returns maximum object label size supported by Platform KeyStore.
|
||||
*/
|
||||
u16 plpks_get_maxobjectlabelsize(void);
|
||||
|
||||
/**
|
||||
* Returns total size of the configured Platform KeyStore.
|
||||
*/
|
||||
u32 plpks_get_totalsize(void);
|
||||
|
||||
/**
|
||||
* Returns used space from the total size of the Platform KeyStore.
|
||||
*/
|
||||
u32 plpks_get_usedspace(void);
|
||||
|
||||
/**
|
||||
* Returns bitmask of policies supported by the hypervisor.
|
||||
*/
|
||||
u32 plpks_get_supportedpolicies(void);
|
||||
|
||||
/**
|
||||
* Returns maximum byte size of a single object supported by the hypervisor.
|
||||
* Only valid for config version >= 3
|
||||
*/
|
||||
u32 plpks_get_maxlargeobjectsize(void);
|
||||
|
||||
/**
|
||||
* Returns bitmask of signature algorithms supported for signed updates.
|
||||
* Only valid for config version >= 3
|
||||
*/
|
||||
u64 plpks_get_signedupdatealgorithms(void);
|
||||
|
||||
/**
|
||||
* Returns the length of the PLPKS password in bytes.
|
||||
*/
|
||||
u64 plpks_get_wrappingfeatures(void);
|
||||
|
||||
u16 plpks_get_passwordlen(void);
|
||||
|
||||
/**
|
||||
* Called in early init to retrieve and clear the PLPKS password from the DT.
|
||||
*/
|
||||
void plpks_early_init_devtree(void);
|
||||
|
||||
/**
|
||||
* Populates the FDT with the PLPKS password to prepare for kexec.
|
||||
*/
|
||||
int plpks_populate_fdt(void *fdt);
|
||||
|
||||
int plpks_config_create_softlink(struct kobject *from);
|
||||
|
||||
bool plpks_wrapping_is_supported(void);
|
||||
|
||||
int plpks_gen_wrapping_key(void);
|
||||
|
||||
int plpks_wrap_object(u8 **input_buf, u32 input_len, u16 wrap_flags,
|
||||
u8 **output_buf, u32 *output_len);
|
||||
|
||||
int plpks_unwrap_object(u8 **input_buf, u32 input_len,
|
||||
u8 **output_buf, u32 *output_len);
|
||||
#else // CONFIG_PSERIES_PLPKS
|
||||
static inline bool plpks_is_available(void) { return false; }
|
||||
static inline u16 plpks_get_passwordlen(void) { BUILD_BUG(); }
|
||||
static inline void plpks_early_init_devtree(void) { }
|
||||
static inline int plpks_populate_fdt(void *fdt) { BUILD_BUG(); }
|
||||
static inline int plpks_config_create_softlink(struct kobject *from)
|
||||
{ return 0; }
|
||||
#endif // CONFIG_PSERIES_PLPKS
|
||||
|
||||
#endif // _ASM_POWERPC_PLPKS_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user