[CRIU] [PATCH 09/10] restore: Add restoration of alternative signal stack, v2
Pavel Emelyanov
xemul at parallels.com
Tue Jul 9 13:11:38 EDT 2013
On 07/09/2013 09:04 PM, Cyrill Gorcunov wrote:
> On Tue, Jul 09, 2013 at 08:52:11PM +0400, Pavel Emelyanov wrote:
>>>
>>> setup_sas does check that ->sas is not null, thus in protobuf
>>> format it's either valid pointer to sas data or NULL otherwise.
>>
>> OK. Let's assume we ptraced a task with SAS and injected a parasite
>> into it. Later for any reason the sigreturn rescue code started to
>> return from parasite. Would we restore it with proper SAS?
>
> Yes, as far as I know. The sas saving code is generic, iow
>
> +static void copy_sas(ThreadSasEntry *dst, stack_t *src)
> +{
> + dst->ss_sp = encode_pointer(src->ss_sp);
> + dst->ss_size = (u64)src->ss_size;
> + dst->ss_flags = src->ss_flags;
> +}
> +
> +static int parasite_init(struct parasite_ctl *ctl, pid_t pid, struct pstree_item *item)
> {
> static int ssock = -1;
>
> @@ -421,6 +428,9 @@ static int parasite_init(struct parasite_ctl *ctl, pid_t pid, int nr_threads)
> ctl->sig_blocked = args->sig_blocked;
> ctl->use_sig_blocked = true;
>
> + BUG_ON(!item->core[0]->thread_core->sas);
> + copy_sas(item->core[0]->thread_core->sas, &args->sas);
> +
>
> on init we save dumpee sas in memory, thus if something go wrong we restore
Do we have the sas at hands at that time?
> it via sigreturn by parasite code.
> .
>
More information about the CRIU
mailing list