lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 19 Jun 2012 10:24:22 +0800 From: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com> To: Avi Kivity <avi@...hat.com> CC: Marcelo Tosatti <mtosatti@...hat.com>, LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org> Subject: Re: [PATCH v3 5/6] KVM: introduce gfn_to_hva_read/kvm_read_hva/kvm_read_hva_atomic On 06/18/2012 06:16 PM, Avi Kivity wrote: > On 06/12/2012 05:48 AM, Xiao Guangrong wrote: >> This set of functions is only used to read data from host space, read is >> a special case in the later patch >> >> >> +/* >> + * The hva returned by this function is only allowed to be read. >> + * It should pair with kvm_read_hva() or kvm_read_hva_atomic(). >> + */ >> +static unsigned long gfn_to_hva_read(struct kvm *kvm, gfn_t gfn) >> +{ >> + return gfn_to_hva_many(gfn_to_memslot(kvm, gfn), gfn, NULL); >> +} >> + >> +static int kvm_read_hva(void *data, void *hva, int len) >> +{ >> + return __copy_from_user(data, (void __user *)hva, len); >> + >> +} >> + >> +static int kvm_read_hva_atomic(void *data, void *hva, int len) >> +{ >> + return __copy_from_user_inatomic(data, (void __user *)hva, len); >> + >> +} > > Why cast to __user? Make it __user in the first place. > Okay. > Also these are just simple wrappers, why to them at all? For gfn_to_hva_read(), they will call gfn_to_hva_many(...write = false) in the later patch. For kvm_read_hva() and kvm_read_hva_atomic(), they are pure wrappers, i think its name is a good hint to let gfn_to_hva_read to pair with kvm_read_hva()/kvm_read_hva_atomic(). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists