Commit e7ce30c1 authored by Hugh Dickins's avatar Hugh Dickins Committed by Kleber Sacilotto de Souza

kaiser: name that 0x1000 KAISER_SHADOW_PGD_OFFSET

There's a 0x1000 in various places, which looks better with a name.
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

CVE-2017-5754
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 62dec7ee
...@@ -1292,7 +1292,7 @@ ENTRY(nmi) ...@@ -1292,7 +1292,7 @@ ENTRY(nmi)
movq %cr3, %rax movq %cr3, %rax
pushq %rax pushq %rax
#ifdef CONFIG_KAISER_REAL_SWITCH #ifdef CONFIG_KAISER_REAL_SWITCH
andq $(~0x1000), %rax andq $(~KAISER_SHADOW_PGD_OFFSET), %rax
#endif #endif
movq %rax, %cr3 movq %rax, %cr3
#endif #endif
...@@ -1535,7 +1535,7 @@ end_repeat_nmi: ...@@ -1535,7 +1535,7 @@ end_repeat_nmi:
movq %cr3, %rax movq %cr3, %rax
pushq %rax pushq %rax
#ifdef CONFIG_KAISER_REAL_SWITCH #ifdef CONFIG_KAISER_REAL_SWITCH
andq $(~0x1000), %rax andq $(~KAISER_SHADOW_PGD_OFFSET), %rax
#endif #endif
movq %rax, %cr3 movq %rax, %cr3
#endif #endif
......
...@@ -13,13 +13,16 @@ ...@@ -13,13 +13,16 @@
* A minimalistic kernel mapping holds the parts needed to be mapped in user * A minimalistic kernel mapping holds the parts needed to be mapped in user
* mode, such as the entry/exit functions of the user space, or the stacks. * mode, such as the entry/exit functions of the user space, or the stacks.
*/ */
#define KAISER_SHADOW_PGD_OFFSET 0x1000
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#ifdef CONFIG_KAISER #ifdef CONFIG_KAISER
.macro _SWITCH_TO_KERNEL_CR3 reg .macro _SWITCH_TO_KERNEL_CR3 reg
movq %cr3, \reg movq %cr3, \reg
#ifdef CONFIG_KAISER_REAL_SWITCH #ifdef CONFIG_KAISER_REAL_SWITCH
andq $(~0x1000), \reg andq $(~KAISER_SHADOW_PGD_OFFSET), \reg
#endif #endif
movq \reg, %cr3 movq \reg, %cr3
.endm .endm
...@@ -27,7 +30,7 @@ movq \reg, %cr3 ...@@ -27,7 +30,7 @@ movq \reg, %cr3
.macro _SWITCH_TO_USER_CR3 reg .macro _SWITCH_TO_USER_CR3 reg
movq %cr3, \reg movq %cr3, \reg
#ifdef CONFIG_KAISER_REAL_SWITCH #ifdef CONFIG_KAISER_REAL_SWITCH
orq $(0x1000), \reg orq $(KAISER_SHADOW_PGD_OFFSET), \reg
#endif #endif
movq \reg, %cr3 movq \reg, %cr3
.endm .endm
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment