Commit f05e2dcc authored by Andrey Vagin's avatar Andrey Vagin

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: 's avatarAndrey Vagin <avagin@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c2666441
...@@ -345,20 +345,4 @@ task_get_entry(struct task_entries *base, int pid) ...@@ -345,20 +345,4 @@ task_get_entry(struct task_entries *base, int pid)
return NULL; 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__ */ #endif /* CR_RESTORER_H__ */
...@@ -87,6 +87,13 @@ extern void printk(const char *format, ...); ...@@ -87,6 +87,13 @@ extern void printk(const char *format, ...);
} while (0) } while (0)
#ifndef BUG_ON_HANDLER #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) \ # define BUG_ON_HANDLER(condition) \
do { \ do { \
if ((condition)) { \ if ((condition)) { \
...@@ -95,6 +102,7 @@ extern void printk(const char *format, ...); ...@@ -95,6 +102,7 @@ extern void printk(const char *format, ...);
} \ } \
} while (0) } while (0)
#endif #endif
#endif
#define BUG_ON(condition) BUG_ON_HANDLER((condition)) #define BUG_ON(condition) BUG_ON_HANDLER((condition))
......
#define CR_NOGLIBC
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
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