Re: [PATCH] x86/alternatives: Fix optimize_nops() checking

From: Borislav Petkov
Date: Wed Jan 10 2018 - 15:50:35 EST


On Wed, Jan 10, 2018 at 12:20:40PM -0800, Linus Torvalds wrote:
> No, that's not valid. That could never work anyway. The ".long 2f"
> would be the absolute address in the alternative section, but opcode
> E9 takes a relative 32-bit offset.

Ah, right, doh. I remember now. We used to do those jmps by computing the
relative offset:

From: 090a3f615524c3f75d09fdb37f15ea1868d79f7e
- .section .altinstr_replacement,"ax"
-1: .byte 0xeb /* jmp <disp8> */
- .byte (copy_page_rep - copy_page) - (2f - 1b) /* offset */

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.