Patch "objtool: Make .altinstructions section entry size consistent" has been added to the 5.14-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

    objtool: Make .altinstructions section entry size consistent

to the 5.14-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:
     objtool-make-.altinstructions-section-entry-size-con.patch
and it can be found in the queue-5.14 subdirectory.

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



commit 9644e387c94b261560f2b26be8dea74f42786b6d
Author: Joe Lawrence <joe.lawrence@xxxxxxxxxx>
Date:   Sun Aug 22 18:50:36 2021 -0400

    objtool: Make .altinstructions section entry size consistent
    
    [ Upstream commit dc02368164bd0ec603e3f5b3dd8252744a667b8a ]
    
    Commit e31694e0a7a7 ("objtool: Don't make .altinstructions writable")
    aligned objtool-created and kernel-created .altinstructions section
    flags, but there remains a minor discrepency in their use of a section
    entry size: objtool sets one while the kernel build does not.
    
    While sh_entsize of sizeof(struct alt_instr) seems intuitive, this small
    deviation can cause failures with external tooling (kpatch-build).
    
    Fix this by creating new .altinstructions sections with sh_entsize of 0
    and then later updating sec->sh_size as alternatives are added to the
    section.  An added benefit is avoiding the data descriptor and buffer
    created by elf_create_section(), but previously unused by
    elf_add_alternative().
    
    Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
    Signed-off-by: Joe Lawrence <joe.lawrence@xxxxxxxxxx>
    Reviewed-by: Miroslav Benes <mbenes@xxxxxxx>
    Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210822225037.54620-2-joe.lawrence@xxxxxxxxxx
    Cc: Andy Lavr <andy.lavr@xxxxxxxxx>
    Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
    Cc: x86@xxxxxxxxxx
    Cc: linux-kernel@xxxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index bc821056aba9..0893436cc09f 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
 	sec = find_section_by_name(elf, ".altinstructions");
 	if (!sec) {
 		sec = elf_create_section(elf, ".altinstructions",
-					 SHF_ALLOC, size, 0);
+					 SHF_ALLOC, 0, 0);
 
 		if (!sec) {
 			WARN_ELF("elf_create_section");



[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