]> git.baikalelectronics.ru Git - kernel.git/commit
x86/paravirt: Ensure proper alignment
authorThomas Gleixner <tglx@linutronix.de>
Thu, 15 Sep 2022 11:10:40 +0000 (13:10 +0200)
committerBorislav Petkov <bp@suse.de>
Wed, 21 Sep 2022 10:30:16 +0000 (12:30 +0200)
commit292ac0944df68df5d428a0993db48c1f8cbe8d54
treeeef0269eafb93b7cebb66724d3e4dea26eda930d
parent27f9b03c399355c5a93e7f1cf491765f72d4bb7d
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
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h