Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-19 Thread Blue Swirl
On 3/19/10, Jamie Lokier ja...@shareable.org wrote: Blue Swirl wrote: But what if in addition to this, the user process forked and the other process ptraced the QEMU process, How good is the cross-arch ptrace() emulation, anyway? :-) Probably as good as SIGABRT abuse support. But the

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-18 Thread Markus Armbruster
Jamie Lokier ja...@shareable.org writes: Markus Armbruster wrote: Paolo Bonzini pbonz...@redhat.com writes: On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-18 Thread Paolo Bonzini
The guest replacing one of QEMU's handlers with SIG_IGN or SIG_DFL would be fun, too. No idea whether that's actually possible; I know next to nothing about user mode emulation. No, the guest program cannot replace QEMU's handlers; the host OS always sees host_signal_handler for all signals.

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-18 Thread Jamie Lokier
Blue Swirl wrote: But what if in addition to this, the user process forked and the other process ptraced the QEMU process, How good is the cross-arch ptrace() emulation, anyway? :-) -- Jamie

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-17 Thread Paolo Bonzini
On 03/16/2010 06:55 PM, Jamie Lokier wrote: A guest program is also allowed to trap SIGABRT with a signal handler, and that does have some uses. E.g. cleaning up temporary files and shmem segments following a crash when calling 3rd party code. Whatever the guest does with SIGABRT, it should

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-17 Thread Blue Swirl
On 3/17/10, Paolo Bonzini pbonz...@redhat.com wrote: On 03/16/2010 06:55 PM, Jamie Lokier wrote: A guest program is also allowed to trap SIGABRT with a signal handler, and that does have some uses. E.g. cleaning up temporary files and shmem segments following a crash when calling 3rd

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-16 Thread Paolo Bonzini
On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely on that. If the user programs make a signal (SIGABRT, SIG_IGN) call, I suppose abort() will return. Paolo

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-16 Thread Markus Armbruster
Paolo Bonzini pbonz...@redhat.com writes: On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely on that. If the user programs make a signal (SIGABRT, SIG_IGN) call, I

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-16 Thread Jamie Lokier
Paolo Bonzini wrote: On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely on that. If the user programs make a signal (SIGABRT, SIG_IGN) call, I suppose abort() will

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-16 Thread Jamie Lokier
Markus Armbruster wrote: Paolo Bonzini pbonz...@redhat.com writes: On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely on that. If the user programs make a

Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-16 Thread Markus Armbruster
Jamie Lokier ja...@shareable.org writes: Paolo Bonzini wrote: On 03/15/2010 07:36 PM, Markus Armbruster wrote: Please don't tell me that user emulators make abort() return. abort() is declared __noreturn__, and the optimizer may well rely on that. If the user programs make a signal

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-15 Thread Paolo Bonzini
I sympathize with the general idea, but I don't like dead code after abort(). What about cleaning that up? Good idea, but it should be a separate patch. This patch is safe, whereas the cleanup patch could cause problems if it's not done carefully. This patch is safe, however I'd consider

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-15 Thread Blue Swirl
On 3/15/10, Paolo Bonzini pbonz...@redhat.com wrote: I sympathize with the general idea, but I don't like dead code after abort(). What about cleaning that up? Good idea, but it should be a separate patch. This patch is safe, whereas the cleanup patch could cause

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-15 Thread Markus Armbruster
Paolo Bonzini pbonz...@redhat.com writes: I sympathize with the general idea, but I don't like dead code after abort(). What about cleaning that up? Good idea, but it should be a separate patch. This patch is safe, whereas the cleanup patch could cause problems if it's not done carefully.

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-15 Thread Paolo Bonzini
I'd consider not changing assert(0)-abort() if there is code after the assert that looks like an attempt at recovering. Example: if (!p) { printf (the impossible has happened!); assert (0); } return p-q; should be changed to abort, while if (!p) {

[Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort()

2010-03-15 Thread Blue Swirl
On 3/15/10, Paolo Bonzini pbonz...@redhat.com wrote: I'd consider not changing assert(0)-abort() if there is code after the assert that looks like an attempt at recovering. Example: if (!p) { printf (the impossible has happened!); assert (0); }