Patch "arm64: entry: Make the trampoline cleanup optional" has been added to the 5.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    arm64: entry: Make the trampoline cleanup optional

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-entry-make-the-trampoline-cleanup-optional.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f44bc676e3ffb0cc5512bc3790f81526139b8686
Author: James Morse <james.morse@xxxxxxx>
Date:   Tue Mar 15 18:23:59 2022 +0000

    arm64: entry: Make the trampoline cleanup optional
    
    commit d739da1694a0eaef0358a42b76904b611539b77b upstream.
    
    Subsequent patches will add additional sets of vectors that use
    the same tricks as the kpti vectors to reach the full-fat vectors.
    The full-fat vectors contain some cleanup for kpti that is patched
    in by alternatives when kpti is in use. Once there are additional
    vectors, the cleanup will be needed in more cases.
    
    But on big/little systems, the cleanup would be harmful if no
    trampoline vector were in use. Instead of forcing CPUs that don't
    need a trampoline vector to use one, make the trampoline cleanup
    optional.
    
    Entry at the top of the vectors will skip the cleanup. The trampoline
    vectors can then skip the first instruction, triggering the cleanup
    to run.
    
    Reviewed-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
    Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>
    Signed-off-by: James Morse <james.morse@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 98991aa9d0b1..a6dcd68ce7de 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -61,16 +61,20 @@
 	.align 7
 .Lventry_start\@:
 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0
-alternative_if ARM64_UNMAP_KERNEL_AT_EL0
 	.if	\el == 0
+	/*
+	 * This must be the first instruction of the EL0 vector entries. It is
+	 * skipped by the trampoline vectors, to trigger the cleanup.
+	 */
+	b	.Lskip_tramp_vectors_cleanup\@
 	.if	\regsize == 64
 	mrs	x30, tpidrro_el0
 	msr	tpidrro_el0, xzr
 	.else
 	mov	x30, xzr
 	.endif
+.Lskip_tramp_vectors_cleanup\@:
 	.endif
-alternative_else_nop_endif
 #endif
 
 	sub	sp, sp, #S_FRAME_SIZE
@@ -1079,7 +1083,7 @@ alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
 	prfm	plil1strm, [x30, #(1b - tramp_vectors)]
 alternative_else_nop_endif
 	msr	vbar_el1, x30
-	add	x30, x30, #(1b - tramp_vectors)
+	add	x30, x30, #(1b - tramp_vectors + 4)
 	isb
 	ret
 .org 1b + 128	// Did we overflow the ventry slot?



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux