Skip to content

Commit 4544db3

Browse files
committed
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas: - Ensure context synchronisation after a write to APIAKey. - Fix bullet list formatting in Documentation/arm64/amu.rst to eliminate doc warnings. * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: Documentation: arm64: fix amu.rst doc warnings arm64: sync kernel APIAKey when installing
2 parents b9916af + 59bff30 commit 4544db3

File tree

2 files changed

+32
-24
lines changed

2 files changed

+32
-24
lines changed

Documentation/arm64/amu.rst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ optional external memory-mapped interface.
2323

2424
Version 1 of the Activity Monitors architecture implements a counter group
2525
of four fixed and architecturally defined 64-bit event counters.
26-
- CPU cycle counter: increments at the frequency of the CPU.
27-
- Constant counter: increments at the fixed frequency of the system
28-
clock.
29-
- Instructions retired: increments with every architecturally executed
30-
instruction.
31-
- Memory stall cycles: counts instruction dispatch stall cycles caused by
32-
misses in the last level cache within the clock domain.
26+
27+
- CPU cycle counter: increments at the frequency of the CPU.
28+
- Constant counter: increments at the fixed frequency of the system
29+
clock.
30+
- Instructions retired: increments with every architecturally executed
31+
instruction.
32+
- Memory stall cycles: counts instruction dispatch stall cycles caused by
33+
misses in the last level cache within the clock domain.
3334

3435
When in WFI or WFE these counters do not increment.
3536

@@ -57,11 +58,12 @@ counters, only the presence of the extension.
5758

5859
Firmware (code running at higher exception levels, e.g. arm-tf) support is
5960
needed to:
60-
- Enable access for lower exception levels (EL2 and EL1) to the AMU
61-
registers.
62-
- Enable the counters. If not enabled these will read as 0.
63-
- Save/restore the counters before/after the CPU is being put/brought up
64-
from the 'off' power state.
61+
62+
- Enable access for lower exception levels (EL2 and EL1) to the AMU
63+
registers.
64+
- Enable the counters. If not enabled these will read as 0.
65+
- Save/restore the counters before/after the CPU is being put/brought up
66+
from the 'off' power state.
6567

6668
When using kernels that have this feature enabled but boot with broken
6769
firmware the user may experience panics or lockups when accessing the
@@ -78,10 +80,11 @@ are not trapped in EL2/EL3.
7880

7981
The fixed counters of AMUv1 are accessible though the following system
8082
register definitions:
81-
- SYS_AMEVCNTR0_CORE_EL0
82-
- SYS_AMEVCNTR0_CONST_EL0
83-
- SYS_AMEVCNTR0_INST_RET_EL0
84-
- SYS_AMEVCNTR0_MEM_STALL_EL0
83+
84+
- SYS_AMEVCNTR0_CORE_EL0
85+
- SYS_AMEVCNTR0_CONST_EL0
86+
- SYS_AMEVCNTR0_INST_RET_EL0
87+
- SYS_AMEVCNTR0_MEM_STALL_EL0
8588

8689
Auxiliary platform specific counters can be accessed using
8790
SYS_AMEVCNTR1_EL0(n), where n is a value between 0 and 15.
@@ -93,9 +96,10 @@ Userspace access
9396
----------------
9497

9598
Currently, access from userspace to the AMU registers is disabled due to:
96-
- Security reasons: they might expose information about code executed in
97-
secure mode.
98-
- Purpose: AMU counters are intended for system management use.
99+
100+
- Security reasons: they might expose information about code executed in
101+
secure mode.
102+
- Purpose: AMU counters are intended for system management use.
99103

100104
Also, the presence of the feature is not visible to userspace.
101105

@@ -105,8 +109,9 @@ Virtualization
105109

106110
Currently, access from userspace (EL0) and kernelspace (EL1) on the KVM
107111
guest side is disabled due to:
108-
- Security reasons: they might expose information about code executed
109-
by other guests or the host.
112+
113+
- Security reasons: they might expose information about code executed
114+
by other guests or the host.
110115

111116
Any attempt to access the AMU registers will result in an UNDEFINED
112117
exception being injected into the guest.

arch/arm64/include/asm/pointer_auth.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys)
4747
get_random_bytes(&keys->apga, sizeof(keys->apga));
4848
}
4949

50-
#define __ptrauth_key_install(k, v) \
50+
#define __ptrauth_key_install_nosync(k, v) \
5151
do { \
5252
struct ptrauth_key __pki_v = (v); \
5353
write_sysreg_s(__pki_v.lo, SYS_ ## k ## KEYLO_EL1); \
@@ -62,8 +62,11 @@ static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel
6262

6363
static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys)
6464
{
65-
if (system_supports_address_auth())
66-
__ptrauth_key_install(APIA, keys->apia);
65+
if (!system_supports_address_auth())
66+
return;
67+
68+
__ptrauth_key_install_nosync(APIA, keys->apia);
69+
isb();
6770
}
6871

6972
extern int ptrauth_prctl_reset_keys(struct task_struct *tsk, unsigned long arg);

0 commit comments

Comments
 (0)