Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/aarch64 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/2d278abd95d0
branches:  netbsd-9
changeset: 1001323:2d278abd95d0
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 24 17:30:28 2019 +0000

description:
Pull up following revision(s) (requested by ryo in ticket #574):

        sys/arch/aarch64/include/asm.h: revision 1.5
        sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.13

Add a speculation barrier after the 'eret'.

Some aarch64 cpus speculatively execute instructions after 'eret',
and this potentiates side-channel attack.

from
 https://github.com/torvalds/linux/commit/679db70801da9fda91d26caf13bf5b5ccc74e8e8

diffstat:

 sys/arch/aarch64/aarch64/cpuswitch.S |   8 ++++----
 sys/arch/aarch64/include/asm.h       |  10 +++++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diffs (58 lines):

diff -r d092ddcde7eb -r 2d278abd95d0 sys/arch/aarch64/aarch64/cpuswitch.S
--- a/sys/arch/aarch64/aarch64/cpuswitch.S      Wed Dec 18 20:21:11 2019 +0000
+++ b/sys/arch/aarch64/aarch64/cpuswitch.S      Tue Dec 24 17:30:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.11 2018/12/27 09:55:27 mrg Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 #include "opt_ddb.h"
 #include "opt_kasan.h"
 
-RCSID("$NetBSD: cpuswitch.S,v 1.11 2018/12/27 09:55:27 mrg Exp $")
+RCSID("$NetBSD: cpuswitch.S,v 1.11.4.1 2019/12/24 17:30:28 martin Exp $")
 
 /*
  * At IPL_SCHED:
@@ -268,7 +268,7 @@
        ldp     x1, x2, [x0, #TF_X1]
        ldr     x0, [x0, #TF_X0]
 
-       eret
+       ERET
 END(el1_trap_exit)
 #ifdef DDB
 END(el1_trap)
@@ -339,7 +339,7 @@
        unwind_x0_x2
 
        /* leave sp at l_md.md_utf, return back to EL0 user process */
-       eret
+       ERET
 END(el0_trap_exit)
 #ifdef DDB
 END(el0_trap)
diff -r d092ddcde7eb -r 2d278abd95d0 sys/arch/aarch64/include/asm.h
--- a/sys/arch/aarch64/include/asm.h    Wed Dec 18 20:21:11 2019 +0000
+++ b/sys/arch/aarch64/include/asm.h    Tue Dec 24 17:30:28 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.3 2018/07/17 18:08:37 christos Exp $ */
+/* $NetBSD: asm.h,v 1.3.4.1 2019/12/24 17:30:28 martin Exp $ */
 
 #ifndef _AARCH64_ASM_H_
 #define _AARCH64_ASM_H_
@@ -8,4 +8,12 @@
 #define        fp      x29
 #define        lr      x30
 
+/*
+ * Add a speculation barrier after the 'eret'.
+ * Some aarch64 cpus speculatively execute instructions after 'eret',
+ * and this potentiates side-channel attacks.
+ */
+#define        ERET    \
+       eret; dsb sy; isb
+
 #endif /* !_AARCH64_ASM_H_ */



Home | Main Index | Thread Index | Old Index