linux-user: fix segfault deadlock
authorAlexander Graf <agraf@suse.de>
Fri, 13 Jan 2012 16:05:41 +0000 (17:05 +0100)
committerhyokeun <hyokeun.jeon@samsung.com>
Tue, 6 Sep 2016 06:55:31 +0000 (15:55 +0900)
commit6d51e4f117ee530d466855546169a0212cdf8ea4
treedb643ee4808a098e3d04e0a8fb86fe8e620899f1
parent9d721e1a0b3fc49081b37a6d7ead77da667d87e9
linux-user: fix segfault deadlock

When entering the guest we take a lock to ensure that nobody else messes
with our TB chaining while we're doing it. If we get a segfault inside that
code, we manage to work on, but will not unlock the lock.

This patch forces unlocking of that lock in the segv handler. I'm not sure
this is the right approach though. Maybe we should rather make sure we don't
segfault in the code? I would greatly appreciate someone more intelligible
than me to look at this :).

Example code to trigger this is at: http://csgraf.de/tmp/conftest.c

Reported-by: Fabio Erculiani <lxnay@sabayon.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
[AF: Drop spinlock_safe_unlock() and switch to tb_lock_reset() (bonzini)]
Signed-off-by: Andreas Färber <afaerber@suse.de>
user-exec.c