Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp682345ybe; Thu, 5 Sep 2019 04:23:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXCsBSUfwZAjklIdgA/VKaUv4LQ0qscnO6v54ewrtpIsWQgStzrWRu87+pI03OiBbjycDu X-Received: by 2002:a17:90a:8c91:: with SMTP id b17mr3310726pjo.45.1567682619977; Thu, 05 Sep 2019 04:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567682619; cv=none; d=google.com; s=arc-20160816; b=QyMosm5iKFOjqLfMMdHyuQkkZ/lQpJY5LPApL0sztTjly4Pcotj8QkfDEUYQwcGYbo B+VFqzK2VCCblhqTBiPRBVwBO5YZtrZl5Vjl1HePKnYS6njFt0DqkNljXwsVP44tOS0A 5Pn6QLMZ9mZ1e0IRg7RjJxx1I4UeXbX4NfSWhHJ5ON9jyEC15LHEiRbXT//NHvgLQ1PZ bYG182e9L0TOkW9TsFCvx3wQQTrE1pK75cSJ1ToVW9FVcF4KtsIjGJN9cr57Dl80wD5I ZA1MrmKxNk2ZyL9Eef/UHm5ptRP5DkYZQ0dGpL2x7ipEYuqvxk32r8LEERIImRjNpyMV VcZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date; bh=A6zF5xJX5LRprln4SZvrd+IHkk1K+KVIRefdhh+1Sug=; b=ERB7kB9gBZfNUSs8pl1OcFIbAhGBjOIwjP/qSsIoxWOyTMlSNM2QdRWvzm6+9Ooin1 FrdRyz475beLCb0Q09OaD+DlTIwd6UIzyViyY6rg/xZiHUdzzA4ntkDikQuBRB5vKeAR 1dWPKmeyVvtBmLoNs7kz8e+bsWkL8ZOFo/AtdsS9tWlgq6r0y4DZUmSV/MGQIURZ6dZH lvZ04jRKCMITb+OjPCyo0rEOMBlQCp+mzTZFrg6gG2Pyj0tRl+QaR+3+59TeBPA4O0Md BCQlDSWKHfJEDvh3KfjSe37prRppzC5ybnEOK0TKAbQ5gbvLCq7Pbxn7Cd619vZ7PY1k dvPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n102si1837182pjc.68.2019.09.05.04.23.23; Thu, 05 Sep 2019 04:23:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732827AbfIEIwl (ORCPT + 99 others); Thu, 5 Sep 2019 04:52:41 -0400 Received: from foss.arm.com ([217.140.110.172]:39608 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732205AbfIEIwk (ORCPT ); Thu, 5 Sep 2019 04:52:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6AA23337; Thu, 5 Sep 2019 01:52:40 -0700 (PDT) Received: from big-swifty.misterjones.org (unknown [10.1.27.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 205A93F67D; Thu, 5 Sep 2019 01:52:37 -0700 (PDT) Date: Thu, 05 Sep 2019 09:52:36 +0100 Message-ID: <86mufjrup7.wl-maz@kernel.org> From: Marc Zyngier To: Peter Maydell Cc: Heinrich Schuchardt , James Morse , Julien Thierry , Suzuki K Pouloze , Stefan Hajnoczi , =?UTF-8?B?IkRhbmllbCBQIC4gQmVycmFuZ8OpIg==?= , arm-mail-list , kvmarm@lists.cs.columbia.edu, lkml - Kernel Mailing List Subject: Re: [PATCH 1/1] KVM: inject data abort if instruction cannot be decoded In-Reply-To: References: <20190904180736.29009-1-xypron.glpk@gmx.de> <86r24vrwyh.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/26 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: Approximate MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 05 Sep 2019 09:16:54 +0100, Peter Maydell wrote: > > On Thu, 5 Sep 2019 at 09:04, Marc Zyngier wrote: > > How can you tell that the access would fault? You have no idea at that > > stage (the kernel doesn't know about the MMIO ranges that userspace > > handles). All you know is that you're faced with a memory access that > > you cannot emulate in the kernel. Injecting a data abort at that stage > > is not something that the architecture allows. > > To be fair, locking up the whole CPU (which is effectively > what the kvm_err/ENOSYS is going to do to the VM) isn't > something the architecture allows either :-) Hey, I didn't say things were good as they are now! ;-) I'm definitely willing to change things in that area, but I also don't want anyone to start relying on things that are not specified anywhere. > > > Of course, the best thing would be to actually fix the guest so that > > it doesn't use non-emulatable MMIO accesses. In general, that the sign > > of a bug in low-level accessors. > > This is true, but the problem is that barfing out to userspace > makes it harder to debug the guest because it means that > the VM is immediately destroyed, whereas AIUI if we > inject some kind of exception then (assuming you're set up > to do kernel-debug via gdbstub) you can actually examine > the offending guest code with a debugger because at least > your VM is still around to inspect... To Christoffer's point, I find the benefit a bit dubious. Yes, you get an exception, but the instruction that caused it may be completely legal (store with post-increment, for example), leading to an even more puzzled developer (that exception should never have been delivered the first place). I'm far more in favour of dumping the state of the access in the run structure (much like we do for a MMIO access) and let userspace do something about it (such as dumping information on the console or breaking). It could even inject an exception *if* the user has asked for it. Thanks, M. -- Jazz is not dead, it just smells funny.