coroutine-sigaltstack: Change jmp_buf to sigjmp_buf
PATCH 1/1 coroutine-sigaltstack: Change jmp_buf to sigjmp_buf
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.
--- coroutine-sigaltstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
coroutine-sigaltstack.c +1 -1
@@ -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
Signature · 1 line
1.9.3 (Apple Git-50)
Quoted 19 lines · Willem Pinckaers
This is a simple patch to change the type of
old_envfromjmp_buftosigjmp_buf.old_envis used by sigsetjmp and as such should be asigjmp_buf.This fixes a
stack_chkfail in a OSX 32bit build. Since at least on OSXsigjmp_bufis 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 <[email protected]>--- coroutine-sigaltstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)coroutine-sigaltstack.c +0
-0
coroutine-sigaltstack.c Coroutine *qemu_coroutine_new(void) · line 161
Quoted 8 lines
coroutine-sigaltstack.c +1
-1@@ -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
I think I must have missed this one when I converted all the jmp_buf to sigjmp_buf in commit 6ab7e546.
-- PMM
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Willem Pinckaers
This is a simple patch to change the type of
old_envfromjmp_buftosigjmp_buf.old_envis used by sigsetjmp and as such should be asigjmp_buf.This fixes a
stack_chkfail in a OSX 32bit build. Since at least on OSXsigjmp_bufis 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 <[email protected]>--- coroutine-sigaltstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)coroutine-sigaltstack.c +1
-1@@ -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;
Quoted 7 lines
coroutine-sigaltstack.c Coroutine *qemu_coroutine_new(void) · line 161
Quoted 2 lines
coroutine-sigaltstack.c +0
-0/* 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 <[email protected]>I think I must have missed this one when I converted all the
jmp_buftosigjmp_bufin commit6ab7e546.
Useful bit of information, perhaps you can amend the commit message with it on commit.
Michael Tokarev
AppliedApplied to -trivial, adding Peter's comment.
Thanks,
/mjt