Thread (429 messages) 429 messages, 18 authors, 2020-05-15

Re: [PATCH v7 11/11] arm64: scs: add shadow stacks for SDEI

From: Sami Tolvanen <samitolvanen@google.com>
Date: 2020-02-12 20:59:36
Also in: lkml

On Tue, Feb 11, 2020 at 5:57 AM James Morse [off-list ref] wrote:
Hi Sami,

On 28/01/2020 18:49, Sami Tolvanen wrote:
quoted
This change adds per-CPU shadow call stacks for the SDEI handler.
Similarly to how the kernel stacks are handled, we add separate shadow
stacks for normal and critical events.
Reviewed-by: James Morse <james.morse@arm.com>
Tested-by: James Morse <james.morse@arm.com>
Thank you for taking the time to test this, James!
quoted
diff --git a/arch/arm64/kernel/scs.c b/arch/arm64/kernel/scs.c
index eaadf5430baa..dddb7c56518b 100644
--- a/arch/arm64/kernel/scs.c
+++ b/arch/arm64/kernel/scs.c
quoted
+static int scs_alloc_percpu(unsigned long * __percpu *ptr, int cpu)
+{
+     unsigned long *p;
+
+     p = __vmalloc_node_range(PAGE_SIZE, SCS_SIZE,
+                              VMALLOC_START, VMALLOC_END,
+                              GFP_SCS, PAGE_KERNEL,
+                              0, cpu_to_node(cpu),
+                              __builtin_return_address(0));
(What makes this arch specific? arm64 has its own calls like this for the regular vmap
stacks because it plays tricks with the alignment. Here the alignment requirement comes
from the core SCS code... Would another architecture implement these
scs_alloc_percpu()/scs_free_percpu() differently?)
You are correct, these aren't necessarily specific to arm64. However,
right now, we are not allocating per-CPU shadow stacks anywhere else,
so this was a natural place for the helper functions. Would you prefer
me to move these to kernel/scs.c instead?

Sami

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help