Re: [Xen-devel] [PATCH] x86/memshr: properly check grant references

2016-11-14 Thread Jan Beulich
>>> On 14.11.16 at 12:56, wrote: > On 14/11/16 10:34, Jan Beulich wrote: >> --- a/xen/common/grant_table.c >> +++ b/xen/common/grant_table.c >> @@ -3438,6 +3438,53 @@ void grant_table_init_vcpu(struct vcpu * >> v->maptrack_tail = MAPTRACK_TAIL; >> } >> >> +#ifdef CONFIG_HAS_MEM_SHARING >>

Re: [Xen-devel] [PATCH] x86/memshr: properly check grant references

2016-11-14 Thread Andrew Cooper
On 14/11/16 10:34, Jan Beulich wrote: > --- a/xen/common/grant_table.c > +++ b/xen/common/grant_table.c > @@ -3438,6 +3438,53 @@ void grant_table_init_vcpu(struct vcpu * > v->maptrack_tail = MAPTRACK_TAIL; > } > > +#ifdef CONFIG_HAS_MEM_SHARING > +int mem_sharing_gref_to_gfn(struct grant_ta

[Xen-devel] [PATCH] x86/memshr: properly check grant references

2016-11-14 Thread Jan Beulich
They need to be range checked against the current table limit in any event. Reported-by: Huawei PSIRT Move the code to where it belongs, eliminating a number of duplicate definitions. Add locking. Produce proper error codes, and consume them instead of making one up. Check grant type. Convert pa