Commit 20b7dafa authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

restore: Add restoration of alternative signal stack

To restore SAS we have two ways:
- call for sigaltstack explicitly in restorer.c right before we call for sigreturn
- pass stack value to sigreturn call and allow the kernel to restore stack for us

Since second way is a simplier one -- we stick with it.

[alekskartashov@: use RT_SIGFRAME_UC]
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
CC: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent de75a0a3
......@@ -5,6 +5,9 @@
#ifndef __CR_SIGFRAME_H__
#define __CR_SIGFRAME_H__
#include "asm/types.h"
#include "protobuf/core.pb-c.h"
struct rt_sigframe;
#ifndef __ARCH_SI_PREAMBLE_SIZE
......@@ -43,4 +46,18 @@ extern int construct_sigframe(struct rt_sigframe *sigframe,
struct rt_sigframe *rsigframe,
CoreEntry *core);
/*
* FIXME Convert it to inline helper, which requires
* to unweave types mess we've generated for
* run-time data.
*/
#define setup_sas(sigframe, sas) \
do { \
if ((sas)) { \
RT_SIGFRAME_UC((sigframe)).uc_stack.ss_sp = (void *)decode_pointer((sas)->ss_sp); \
RT_SIGFRAME_UC((sigframe)).uc_stack.ss_flags = (int)(sas)->ss_flags; \
RT_SIGFRAME_UC((sigframe)).uc_stack.ss_size = (size_t)(sas)->ss_size; \
} \
} while (0)
#endif /* __CR_SIGFRAME_H__ */
......@@ -31,5 +31,7 @@ int construct_sigframe(struct rt_sigframe *sigframe,
if (restore_gpregs(sigframe, CORE_THREAD_ARCH_INFO(core)->gpregs))
return -1;
setup_sas(sigframe, core->thread_core->sas);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment