From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 1/3] x86/mmuext: tighten TLB flush address checks Date: Wed, 20 Jan 2016 14:48:51 +0000 Message-ID: <569F9E53.7030305@citrix.com> References: <569FA12902000078000C91C7@prv-mh.provo.novell.com> <569FA23E02000078000C91E6@prv-mh.provo.novell.com> <569F9873.2030404@citrix.com> <569FAABD02000078000C92BA@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLu47-0000bH-ME for xen-devel@lists.xenproject.org; Wed, 20 Jan 2016 14:48:55 +0000 In-Reply-To: <569FAABD02000078000C92BA@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 20/01/16 14:41, Jan Beulich wrote: >>>> On 20.01.16 at 15:23, wrote: >> On 20/01/16 14:05, Jan Beulich wrote: >>> Addresses passed by PV guests should be subjected to __addr_ok(), >>> avoiding undue TLB flushes; . >>> >>> Signed-off-by: Jan Beulich >>> >>> --- a/xen/arch/x86/mm.c >>> +++ b/xen/arch/x86/mm.c >>> @@ -3268,8 +3268,9 @@ long do_mmuext_op( >>> case MMUEXT_INVLPG_LOCAL: >>> if ( unlikely(d != pg_owner) ) >>> rc = -EPERM; >>> - else if ( !paging_mode_enabled(d) || >>> - paging_invlpg(curr, op.arg1.linear_addr) != 0 ) >>> + else if ( !paging_mode_enabled(d) >>> + ? __addr_ok(op.arg1.linear_addr) >>> + : paging_invlpg(curr, op.arg1.linear_addr) ) >> paging_mode_enabled() changes depending on whether the guest has >> logdirty currently enabled. >> >> As you have also patched paging_invlpg() to DTRT with __addr_ok(), I >> think this hunk can be dropped. > How that? Without the change there's no address validation at > all when !paging_mode_enabled(d). Oh - there is an inversion in there. Sorry for the noise. Entire patch Reviewed-by: Andrew Cooper