Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755108AbdIGKNw (ORCPT ); Thu, 7 Sep 2017 06:13:52 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58148 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755008AbdIGKNv (ORCPT ); Thu, 7 Sep 2017 06:13:51 -0400 Subject: Re: [PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host To: gengdongjiu , James Morse Cc: christoffer.dall@linaro.org, vladimir.murzin@arm.com, rkrcmar@redhat.com, catalin.marinas@arm.com, shankerd@codeaurora.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, zhanghaibin7@huawei.com, huangshaoyu@huawei.com References: <1504763684-30128-1-git-send-email-gengdongjiu@huawei.com> <59B10F52.9010400@arm.com> From: Marc Zyngier Organization: ARM Ltd Message-ID: Date: Thu, 7 Sep 2017 11:13:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 946 Lines: 25 On 07/09/17 11:05, gengdongjiu wrote: > Hi James, > > On 2017/9/7 17:20, James Morse wrote: >> Hi Dongjiu Geng, >> >> On 07/09/17 06:54, Dongjiu Geng wrote: >>> In VHE mode, host kernel runs in the EL2 and can enable >>> 'User Access Override' when fs==KERNEL_DS so that it can >>> access kernel memory. However, PSTATE.UAO is set to 0 on >>> an exception taken from EL1 to EL2. Thus when VHE is used >>> and exception taken from a guest UAO will be disabled and >>> host will use the incorrect PSTATE.UAO. So check and reset >>> the PSTATE.UAO when switching to host. >> >> This would only be a problem if KVM were calling into world-switch with >> fs==KERNEL_DS. I can't see where this happens. > Not only KVM, may also kernel sets the fs == KERNEL_DS before calling into world-switch How? Please describe the exact sequence of event that lead to this situation with the current code base. M. -- Jazz is not dead. It just smells funny...