Patch "x86/text-patching: Make text_gen_insn() play nice with ANNOTATE_NOENDBR" has been added to the 5.10-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

    x86/text-patching: Make text_gen_insn() play nice with ANNOTATE_NOENDBR

to the 5.10-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:
     x86-text-patching-make-text_gen_insn-play-nice-with-annotate_noendbr.patch
and it can be found in the queue-5.10 subdirectory.

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


>From ffdfac21ffa69fd4c05a4baa4d0ad48e7abf4d8a Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Tue, 8 Mar 2022 16:30:19 +0100
Subject: x86/text-patching: Make text_gen_insn() play nice with ANNOTATE_NOENDBR

From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

Upstream commit: bbf92368b0b1fe472d489e62d3340d7897e9c697

Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20220308154317.638561109@xxxxxxxxxxxxx
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/include/asm/text-patching.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/arch/x86/include/asm/text-patching.h
+++ b/arch/x86/include/asm/text-patching.h
@@ -101,13 +101,21 @@ void *text_gen_insn(u8 opcode, const voi
 	static union text_poke_insn insn; /* per instance */
 	int size = text_opcode_size(opcode);
 
+	/*
+	 * Hide the addresses to avoid the compiler folding in constants when
+	 * referencing code, these can mess up annotations like
+	 * ANNOTATE_NOENDBR.
+	 */
+	OPTIMIZER_HIDE_VAR(addr);
+	OPTIMIZER_HIDE_VAR(dest);
+
 	insn.opcode = opcode;
 
 	if (size > 1) {
 		insn.disp = (long)dest - (long)(addr + size);
 		if (size == 2) {
 			/*
-			 * Ensure that for JMP9 the displacement
+			 * Ensure that for JMP8 the displacement
 			 * actually fits the signed byte.
 			 */
 			BUG_ON((insn.disp >> 31) != (insn.disp >> 7));


Patches currently in stable-queue which might be from peterz@xxxxxxxxxxxxx are

queue-5.10/x86-ftrace-use-alternative-ret-encoding.patch
queue-5.10/x86-uaccess-implement-macros-for-cmpxchg-on-user-add.patch
queue-5.10/x86-text-patching-make-text_gen_insn-play-nice-with-annotate_noendbr.patch
queue-5.10/x86-alternative-make-custom-return-thunk-unconditional.patch
queue-5.10/task_stack-x86-cea-force-inline-stack-helpers.patch
queue-5.10/x86-returnthunk-allow-different-return-thunks.patch
queue-5.10/x86-ibt-paravirt-use-text_gen_insn-for-paravirt_patch.patch
queue-5.10/sched-rt-fix-sysctl_sched_rr_timeslice-intial-value.patch
queue-5.10/sched-rt-sysctl_sched_rr_timeslice-show-default-timeslice-after-reset.patch




[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