Commit 281572bd authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

pie: provide callbacks for stack-protector

  The other way to solve this is to compile shared between
CRIU and PIEs objects twice: without stack-protection and
with environment choice. But I don't think it worth it.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 3c85c535
...@@ -867,3 +867,21 @@ int __used __parasite_entry parasite_service(unsigned int cmd, void *args) ...@@ -867,3 +867,21 @@ int __used __parasite_entry parasite_service(unsigned int cmd, void *args)
return parasite_trap_cmd(cmd, args); return parasite_trap_cmd(cmd, args);
} }
/*
* Mainally, -fstack-protector is disabled for parasite.
* But we share some object files, compiled for CRIU with parasite.
* Those files (like cpu.c) may be compiled with stack protector
* support. We can't use gcc-ld provided stackprotector callback,
* as Glibc is unmapped. Let's just try to cure application in
* case of stack smashing in parasite.
*/
void __stack_chk_fail(void)
{
/*
* Smash didn't happen in printing part, as it's not shared
* with CRIU, therefore compiled with -fnostack-protector.
*/
pr_err("Stack smash detected in parasite\n");
fini();
}
...@@ -1504,3 +1504,14 @@ core_restore_end: ...@@ -1504,3 +1504,14 @@ core_restore_end:
sys_exit_group(1); sys_exit_group(1);
return -1; return -1;
} }
/*
* For most of the restorer's objects -fstack-protector is disabled.
* But we share some of them with CRIU, which may have it enabled.
*/
void __stack_chk_fail(void)
{
pr_err("Restorer stack smash detected %ld\n", sys_getpid());
sys_exit_group(1);
BUG();
}
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