Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2340711ybt; Tue, 16 Jun 2020 03:35:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLm0mbbPVM7dZwxDl6r7O9CCCCEs6+gqSBUMMS5jujSTqhDmU8FTTFJ5bdf7jCJ7nMmCmY X-Received: by 2002:a17:906:f6d6:: with SMTP id jo22mr2056783ejb.310.1592303753751; Tue, 16 Jun 2020 03:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592303753; cv=none; d=google.com; s=arc-20160816; b=Nv0CmNzKx5qbhDHhMj50HHEHgcQp3BerxU19cdIah9eFyR4aODaVV31rpr6NQYSru5 0NtfZadOXH0rjDt0Dr9qhY0H48FQvXJfIAccniLhzaeU7VIplvU3JQDVKYl7dtuYMqDc Y48UI3WIkXJKqhF6GE4D1rghR18RcSaSJQXDotaCx/CCICqahd3zhb6YHz35joOJfzWX U/P+kPiKst1Ko557C9eMvirAZw6aMc+k2t+mk1Oph1+YIB6zr0+vJ5oK/H41cywj0lxT F7z2CWfNDoLFxD1Qo8vSVuA+2RR5bjeuVmjtVav3fxpIf3F3E1BHcRU8psD+BTOEejn2 wClw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=alTJ9p4nWvYUTK7mDJqDBP0LTnyLhWTKFclLkxqwpn8=; b=lbQ4Ap34LOGfme5igSpKkSdRnmdQ6FESDjQvkDt9D1H0Cc0xZ5ihUGwqpGfbj3AFhN LhmQ0fultqHgK8vku7ALpS7q23w7sna1XvBJb6m7O4njSovL4GyZDmaGhEtEd+1QrtP9 SY2iPyj+dJYjuQtM12x05dHC95b2GMxR7jGglJWKPD+FNdANT+xe6LL7OQEKQZVrmEiC HLBx6s5A4tkU+zubI0STn8Uf1GE3jmfQKRSSrpYIoxhVIA50gMDC+QvbNeSLO4ANGsVA JUMgyRpeL6mEGaPabdGj3Ng1wgJF3UXVaU8/KA4ZtO0Zta+vtZDgFC+/ZVBXZaO1EXF8 96kQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 89si9928471edo.459.2020.06.16.03.35.29; Tue, 16 Jun 2020 03:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbgFPKdS (ORCPT + 99 others); Tue, 16 Jun 2020 06:33:18 -0400 Received: from verein.lst.de ([213.95.11.211]:37487 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgFPKdR (ORCPT ); Tue, 16 Jun 2020 06:33:17 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 6DDF068AEF; Tue, 16 Jun 2020 12:33:13 +0200 (CEST) Date: Tue, 16 Jun 2020 12:33:13 +0200 From: Christoph Hellwig To: Peter Zijlstra Cc: Christoph Hellwig , Dexuan Cui , vkuznets , Stephen Hemminger , Andy Lutomirski , Andy Lutomirski , Michael Kelley , Ju-Hyoung Lee , "x86@kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , KY Srinivasan , Tom Lendacky Subject: Re: hv_hypercall_pg page permissios Message-ID: <20200616103313.GA30833@lst.de> References: <87y2ooiv5k.fsf@vitty.brq.redhat.com> <20200616072318.GA17600@lst.de> <20200616101807.GO2531@hirez.programming.kicks-ass.net> <20200616102350.GA29684@lst.de> <20200616102412.GB29684@lst.de> <20200616103137.GQ2531@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200616103137.GQ2531@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 12:31:37PM +0200, Peter Zijlstra wrote: > On Tue, Jun 16, 2020 at 12:24:12PM +0200, Christoph Hellwig wrote: > > On Tue, Jun 16, 2020 at 12:23:50PM +0200, Christoph Hellwig wrote: > > > > > + hv_hypercall_pg = module_alloc(PAGE_SIZE); > > > > if (hv_hypercall_pg == NULL) { > > > > wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0); > > > > goto remove_cpuhp_state; > > > > } > > > > > > > > + set_memory_ro((unsigned long)hv_hypercall_pg, 1); > > > > + set_memory_x((unsigned long)hv_hypercall_pg, 1); > > > > > > The changing of the permissions sucks. I thought about adding > > > a module_alloc_prot with an explicit pgprot_t argument. On x86 > > > alone at least ftrace would also benefit from that. > > How would ftrace benefit from a RX permission? We need to actually write > to the page first. This HV thing is special in that it lets the host > write. sorry, s/ftrace/kprobes/. See my updated branch here: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/module_alloc-cleanup