<riku.voi...@iki.fi>,qemu-arm <qemu-...@nongnu.org> Bcc: Subject: Re: [Qemu-devel] [RESEND PATCH] target-arm/abi32: check for segfault in do_kernel_trap Reply-To: In-Reply-To: <cafeaca-9ayrhcn1dad0xur9h8sj__hok9aywmsk7h-cr2rj...@mail.gmail.com>
Hi Peter, thanks for the feedback. On Thu, Jan 05, 2017 at 02:42:38PM +0000, Peter Maydell wrote: > If you compare what happens with this segv code with > what happens for the segvs detected inside > arm_kernel_cmpxchg64_helper(), there's a difference. > With this code we will queue the signal and then return, > skipping the code which updates env->regs[15] and env->thumb. > The existing codepath for cmpxchg64 doesn't skip that code. > The effect is that for cmpxchg64 the SEGV signal handler > will see a PC pointing at the call into the kernel commpage, > whereas for this code it will see the PC actually in the > kernel commpage. > > I'm not sure which of these options is the best choice, > but I do think we should be consistent. I think it would be safer to keep the current behaviour. In terms of implementation, I find it would be better to extract the __kernel_cmpxchg code in a separate function. On the one hand, this would avoid code duplication or strange gotos and make do_kernel_trap more readable. On the other hand, this would clutter a bit git history. If it is acceptable, I will send a patch with those changes. If not, will try to find a cleaner solution without creating new functions. Cheers, Seraphime Kirkovski