[CRIU] [PATCH 0/3] Print stack trace in case of segmentation fault

Kirill Tkhai ktkhai at virtuozzo.com
Mon May 29 07:01:29 PDT 2017


Currently, if task meets segmentation fault, it silently dies:

(01.227591)pie: 1: Task 86  exited, status= 11
(01.241495) Error (criu/cr-restore.c:1114): 489968 exited, status=1

Nobody knows why and where.

The patchset adds stack trace printing to make debug more comfortable.
Also this helps not-developers to sort BUGs more effectively. See below
the new printed message (the reason of SIGSEGV is from real BUG):

(01.090136)     86: Error (criu/mount.c:346): mnt: stack 86#0: criu(print_stack_trace+0x1e) [0x459aee]
(01.090143)     86: Error (criu/mount.c:346): mnt: stack 86#1: criu(print_stack_and_exit+0x3e) [0x459b8e]
(01.090145)     86: Error (criu/mount.c:346): mnt: stack 86#2: /lib64/libc.so.6(+0x35250) [0x7fbbf16fb250]
(01.090147)     86: Error (criu/mount.c:346): mnt: stack 86#3: criu(phys_stat_resolve_dev+0x63) [0x459c03]
(01.090149)     86: Error (criu/mount.c:346): mnt: stack 86#4: criu(__open_mountpoint+0x4d) [0x45ca7d]
(01.090151)     86: Error (criu/mount.c:346): mnt: stack 86#5: criu() [0x44cf8e]
(01.090153)     86: Error (criu/mount.c:346): mnt: stack 86#6: criu() [0x44d7d3]
(01.090155)     86: Error (criu/mount.c:346): mnt: stack 86#7: criu() [0x44db6e]
(01.090157)     86: Error (criu/mount.c:346): mnt: stack 86#8: criu(prepare_fds+0x477) [0x44b077]
(01.090159)     86: Error (criu/mount.c:346): mnt: stack 86#9: criu() [0x43cbef]
(01.090471)pie: 1: Task 86  exited, status= 255
(01.103910) Error (criu/cr-restore.c:1114): 492906 exited, status=1

Everything is clear, and everybody can see where segmentation fault happened.

https://travis-ci.org/tkhai/criu/builds/237156968

---

Kirill Tkhai (3):
      utils: Add print_stack_trace()
      restore: Restore SIGSEGV sigaction later
      core: Print stack trace in case of SIGSEGV


 criu/cr-dump.c          |    6 ++++++
 criu/cr-restore.c       |   25 +++++++++++++++++++++++--
 criu/include/restorer.h |    1 +
 criu/include/util.h     |    2 ++
 criu/pie/restorer.c     |    4 ++++
 criu/util.c             |   28 ++++++++++++++++++++++++++++
 6 files changed, 64 insertions(+), 2 deletions(-)

--
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>


More information about the CRIU mailing list