mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-19 01:26:22 +00:00
restorer: don't use printk in restorer
BUG_ON_HANDLER from util.h may be used in restorer.
E.g. #include <util.h>
#include <lock.h>
Now the process will be segfaulted and you can find a line
number in assemgler code. We will print messages a bit late.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
c266644150
commit
f05e2dcc1f
3 changed files with 9 additions and 16 deletions
|
|
@ -345,20 +345,4 @@ task_get_entry(struct task_entries *base, int pid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* We need own handler */
|
||||
|
||||
#ifdef BUG_ON_HANDLER
|
||||
# undef BUG_ON_HANDLER
|
||||
#endif
|
||||
|
||||
#define BUG_ON_HANDLER(condition) \
|
||||
do { \
|
||||
if ((condition)) { \
|
||||
long tgid = sys_gettid(); \
|
||||
write_hex_n(0x5a5a5a5a); \
|
||||
write_num_n(__LINE__); \
|
||||
sys_tgkill(tgid, tgid, SIGABRT); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif /* CR_RESTORER_H__ */
|
||||
|
|
|
|||
|
|
@ -87,6 +87,13 @@ extern void printk(const char *format, ...);
|
|||
} while (0)
|
||||
|
||||
#ifndef BUG_ON_HANDLER
|
||||
#ifdef CR_NOGLIBC
|
||||
#define BUG_ON_HANDLER(condition) \
|
||||
do { \
|
||||
if ((condition)) \
|
||||
*(unsigned long *)NULL = 0xdead0000 + __LINE__; \
|
||||
} while (0)
|
||||
#else
|
||||
# define BUG_ON_HANDLER(condition) \
|
||||
do { \
|
||||
if ((condition)) { \
|
||||
|
|
@ -95,6 +102,7 @@ extern void printk(const char *format, ...);
|
|||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUG_ON(condition) BUG_ON_HANDLER((condition))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#define CR_NOGLIBC
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue