Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753465AbeADWNU (ORCPT + 1 other); Thu, 4 Jan 2018 17:13:20 -0500 Received: from mail-io0-f182.google.com ([209.85.223.182]:38233 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbeADWNS (ORCPT ); Thu, 4 Jan 2018 17:13:18 -0500 X-Google-Smtp-Source: ACJfBovJTzWjFUxOOTpHOoIfVt3NokpmmolJVG2R6NcZiLYR+w2nqkQJumVtSUXvZ3J0Hc6qGkKpou+wO6QaXABJ2uE= MIME-Version: 1.0 From: lepton Date: Thu, 4 Jan 2018 14:13:17 -0800 Message-ID: Subject: Some linux kernel with KAISER/KPTI patch can't work under qemu + haxm. To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: It seems for some reason, some linux kernel with KAISER/KPTI patch can't work with qemu + haxm. The mainline kernel from Linus is fine. But the patch to 4.4/4.10 doesn't work. I am not familiar with HAXM and KPTI either. so not sure if this is a qemu bug or KPTI bug or haxm bug. The same kernel works fine under qemu + kvm. This is the way to reproduce it: 1. Download qemu for windows, follow instructions here: https://www.qemu.org/2017/11/22/haxm-usage-windows/ 2. Build a kernel with KAISER/KPTI, I am using kernel here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=linux-4.4.y Or follow instruction here to build a 4.10 kernel: https://github.com/IAIK/KAISER/tree/master/KAISER 3. Build an ext2 image which has a simple init: dd of=img count=8192 bs=4096 if=/dev/zero mke2fs img gcc --static -o init init.c debugfs -R "write init init" -w img cat init.c #include #include int main() { while(1) { printf("This is init %d\n", time(NULL)); sleep(3600); } } 4. copy kernel and disk image generated from 3 to windows and run it: qemu-system-x86_64.exe -kernel bzImage -hda img -append "init=/init root=/dev/sda" -serial stdio -accel hax You will see kernel panic or "vpu shutdown reqeust" to qemu.