From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Subject: Re: [RFC PATCH v3 5/6] kvm/ppc/mpic: in-kernel MPIC emulation Date: Wed, 3 Apr 2013 18:23:28 -0500 Message-ID: <1365031408.25627.19@snotra> References: <1365026850.25627.16@snotra> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Transfer-Encoding: 8BIT Cc: Alexander Graf , "" , "" , "" , To: Scott Wood Return-path: In-Reply-To: <1365026850.25627.16@snotra> (from scottwood@freescale.com on Wed Apr 3 17:07:30 2013) Content-Disposition: inline Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 04/03/2013 05:07:30 PM, Scott Wood wrote: > On 04/03/2013 04:58:56 PM, Alexander Graf wrote: >> >> >> Am 03.04.2013 um 23:38 schrieb Scott Wood : >> >> > On 04/03/2013 11:19:42 AM, Alexander Graf wrote: >> >> On 03.04.2013, at 03:57, Scott Wood wrote: >> >> > + switch (attr->group) { >> >> > + case KVM_DEV_MPIC_GRP_MISC: >> >> > + switch (attr->attr) { >> >> > + case KVM_DEV_MPIC_BASE_ADDR: >> >> > + mutex_lock(&opp->kvm->slots_lock); >> >> > + attr64 = opp->reg_base; >> >> > + mutex_unlock(&opp->kvm->slots_lock); >> >> > + >> >> > + if (copy_to_user((u64 __user *)(long)attr->addr, >> >> > + &attr64, sizeof(u64))) >> >> u64 is tricky with put_user on 32bit hosts, so here copy_to_user >> makes sense >> > >> > What are the issues with put_user? It looks like it's supported >> with a pair of "stw" instructions. >> >> Oh? Last time I tried to use get/put_user for one_reg it failed on >> ppc32. So maybe the u64 support is new? > > Not new according to git -- though I haven't tried to use it yet; > maybe it's broken. Yeah, it's broken. :-P __get_user_size() looks OK, but __get_user_check/nocheck() goes through an intermediary "unsigned long __gu_val". There's a separate __get_user64_nocheck() that uses "long long", but no "check" variant, no "put", and it's only available in 32-bit builds. And it's not used anywhere (barring ungreppable token-pasting magic). Sigh. -Scott