Skip to content

Commit f92ff8f

Browse files
KAGA-KOKOsuryasaimadhu
authored andcommitted
x86/paravirt: Ensure proper alignment
The entries in the .parainstructions sections are 8 byte aligned and the corresponding C struct paravirt_patch_site makes the array offset 16 bytes. Though the pushed entries are only using 12 bytes, __parainstructions_end is therefore 4 bytes short. That works by chance because it's only used in a loop: for (p = start; p < end; p++) But this falls flat when calculating the number of elements: n = end - start That's obviously off by one. Ensure that the gap is filled and the last entry is occupying 16 bytes. [ bp: Add the proper struct and section names. ] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20220915111142.992398801@infradead.org
1 parent 521a547 commit f92ff8f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/include/asm/paravirt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ extern void default_banner(void);
743743
word 771b; \
744744
.byte ptype; \
745745
.byte 772b-771b; \
746+
_ASM_ALIGN; \
746747
.popsection
747748

748749

arch/x86/include/asm/paravirt_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ extern struct paravirt_patch_template pv_ops;
294294
" .byte " type "\n" \
295295
" .byte 772b-771b\n" \
296296
" .short " clobber "\n" \
297+
_ASM_ALIGN "\n" \
297298
".popsection\n"
298299

299300
/* Generate patchable code, with the default asm parameters. */

0 commit comments

Comments
 (0)