Received: from eggs.gnu.org ([2001:4830:134:3::10]:42386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnkBt-0005b4-7d for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:19:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnkBo-00007C-Na for qemu-devel@nongnu.org; Mon, 10 Nov 2014 03:19:13 -0500 From: Markus Armbruster References: <545D935F.3070300@lekkertech.net> Date: Mon, 10 Nov 2014 09:18:58 +0100 In-Reply-To: (Peter Maydell's message of "Sat, 8 Nov 2014 15:26:53 +0000") Message-ID: <87sihr31u5.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] coroutine-sigaltstack: Change jmp_buf to sigjmp_buf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Willem Pinckaers , QEMU Trivial , QEMU Developers Peter Maydell writes: > On 8 November 2014 03:51, Willem Pinckaers wrote: >> This is a simple patch to change the type of old_env from jmp_buf >> to sigjmp_buf. old_env is used by sigsetjmp and as such should be >> a sigjmp_buf. >> >> This fixes a stack_chk fail in a OSX 32bit build. Since at least on >> OSX sigjmp_buf is four bytes larger then a jmpbuf, resulting in an >> overflow in sigsetjmp. Due to variable reordering this overwrites >> the stack cookie. >> >> Signed-off-by: Willem Pinckaers >> --- >> coroutine-sigaltstack.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c >> index 3de0bb3..63519ff 100644 >> --- a/coroutine-sigaltstack.c >> +++ b/coroutine-sigaltstack.c >> @@ -155,7 +155,7 @@ Coroutine *qemu_coroutine_new(void) >> stack_t oss; >> sigset_t sigs; >> sigset_t osigs; >> - jmp_buf old_env; >> + sigjmp_buf old_env; >> >> /* The way to manipulate stack is with the sigaltstack function. We >> * prepare a stack, with it delivering a signal to ourselves and then > > Reviewed-by: Peter Maydell > > I think I must have missed this one when I converted all the jmp_buf > to sigjmp_buf in commit 6ab7e546. Useful bit of information, perhaps you can amend the commit message with it on commit.