[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 4/9] x86/pv: Implement pv_hypercall() in C
>>> On 02.08.16 at 16:06, <andrew.cooper3@xxxxxxxxxx> wrote: > On 02/08/16 14:12, Jan Beulich wrote: >>>>> On 18.07.16 at 11:51, <andrew.cooper3@xxxxxxxxxx> wrote: >>> +long pv_hypercall(struct cpu_user_regs *regs) >>> +{ >>> + struct vcpu *curr = current; >>> +#ifndef NDEBUG >>> + unsigned long old_rip = regs->rip; >>> +#endif >>> + long ret; >>> + uint32_t eax = regs->eax; >>> + >>> + ASSERT(curr->arch.flags & TF_kernel_mode); >> I'm afraid TF_kernel_mode can't be relied on for 32-bit guests, so >> this needs to move into the if() below. > > In which case it should become ASSERT(guest_mode_kernel(curr, regs)) Ah, yes. >>> + if ( (eax >= NR_hypercalls) || !hypercall_table[eax] ) >>> + return -ENOSYS; >>> + >>> + if ( !is_pv_32bit_vcpu(curr) ) >>> + { >>> + unsigned long rdi = regs->rdi; >>> + unsigned long rsi = regs->rsi; >>> + unsigned long rdx = regs->rdx; >>> + unsigned long r10 = regs->r10; >>> + unsigned long r8 = regs->r8; >>> + unsigned long r9 = regs->r9; >>> + >>> +#ifndef NDEBUG >>> + /* Deliberately corrupt parameter regs not used by this hypercall. >>> */ >>> + switch ( hypercall_args_table[eax] ) >>> + { >>> + case 0: rdi = 0xdeadbeefdeadf00dUL; >>> + case 1: rsi = 0xdeadbeefdeadf00dUL; >>> + case 2: rdx = 0xdeadbeefdeadf00dUL; >>> + case 3: r10 = 0xdeadbeefdeadf00dUL; >>> + case 4: r8 = 0xdeadbeefdeadf00dUL; >>> + case 5: r9 = 0xdeadbeefdeadf00dUL; >> Without comments, aren't these going to become 5 new Coverity >> issues? > > There are no current warnings from the HVM side, so I doubt it. > Coverities' logic is rather complicated, but in this case I think the > lack of any break statements at all is a sufficient hint that its fine. Okay. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |