Skip to content

Commit

Permalink
kaiser: Set _PAGE_NX only if supported
Browse files Browse the repository at this point in the history
This finally resolve crash if loaded under qemu + haxm. Haitao Shan pointed
out that the reason of that crash is that NX bit get set for page tables.
It seems we missed checking if _PAGE_NX is supported in kaiser_add_user_map

Link: https://www.spinics.net/lists/kernel/msg2689835.html

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Lepton Wu <ytht.net@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(backported from Greg K-H's 4.4 stable-queue)
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Lepton Wu authored and Ben Hutchings committed Feb 13, 2018
1 parent 8c88582 commit 7481652
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/mm/kaiser.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ static int kaiser_add_user_map(const void *__start_addr, unsigned long size,
* requires that not to be #defined to 0): so mask it off here.
*/
flags &= ~_PAGE_GLOBAL;
if (!(__supported_pte_mask & _PAGE_NX))
flags &= ~_PAGE_NX;

for (; address < end_addr; address += PAGE_SIZE) {
target_address = get_pa_from_mapping(address);
Expand Down

0 comments on commit 7481652

Please sign in to comment.