platform/core/system/crash-worker.git
7 years agoRemoving dependency of tizen-debug-on/off service from sys-assert 28/123228/2 accepted/tizen/unified/20170426.061702 submit/tizen/20170425.080615
Karol Lewandowski [Mon, 24 Apr 2017 15:34:18 +0000 (17:34 +0200)]
Removing dependency of tizen-debug-on/off service from sys-assert

Tizen-debug-on/off service should control enabling/disabling coredump generation.
When Tizen-debug-off service is executed, only callstack should be generated.

Thus, although disabling sys-assert, the services should be remained.

TODO : For disabling sys-assert, the services should be changed properly.

Change-Id: I617356cd31b51dbe4f103cb3118fefe454e717db

7 years agocrash-pipe: Drop all reporting functionality 48/125748/1
Karol Lewandowski [Wed, 15 Mar 2017 15:43:03 +0000 (16:43 +0100)]
crash-pipe: Drop all reporting functionality

Reporting is handled by crash-stack.

Change-Id: I6066c5a414fd2e98efbcc0ddc57f2f967cbfb859

7 years agocrash-pipe: Introduce option to copy core using splice(2) 47/125747/1
Karol Lewandowski [Wed, 15 Mar 2017 15:39:51 +0000 (16:39 +0100)]
crash-pipe: Introduce option to copy core using splice(2)

Linux splice(2) avoids user-space copy and is effectively faster than
regular read(2) + write(2).

According to (ftrace) test below splice is about 20% faster.

  sysctl -w kernel.core_pattern='|/usr/libexec/core-pipe --save-core /opt/usr/share/temp/core.%p'
  cd /sys/fs/kernel/tracing/
  echo do_coredump > set_ftrace_filter
  echo function_graph > current_tracer
  cat trace_pipe

/* splice */

 2) $ 2183078 us |  } /* do_coredump */
 4) $ 2127946 us |  } /* do_coredump */
 1) $ 2377004 us |  } /* do_coredump */
 1) $ 2088114 us |  } /* do_coredump */

/* read/write */
 1) $ 3088297 us |  } /* do_coredump */
 1) $ 2953330 us |  } /* do_coredump */
 1) $ 2647784 us |  } /* do_coredump */
 3) $ 2271315 us |  }

Change-Id: Id2c681a364ce96d98c70329abdf4a64f6d0b405d

7 years agoMerge branch 'tizen_3.0' 46/125746/1
Karol Lewandowski [Tue, 18 Apr 2017 13:00:30 +0000 (15:00 +0200)]
Merge branch 'tizen_3.0'

This commit brings followings fixes from tizen_3.0 branch:
- Fallback to ptrace call-stack unwinder if sys-assert failed
- libunwind: Fix off by one in _create_crash_stack
- sys-assert: Fix handle leak of mmap

Change-Id: I422c4ddff0fb4dfb72738d70a7170080304081dd

7 years agocrash-stack: Eliminate now-deprecated readdir_r 31/125231/1
Karol Lewandowski [Fri, 14 Apr 2017 07:36:14 +0000 (09:36 +0200)]
crash-stack: Eliminate now-deprecated readdir_r

This commit fixes build break with new toolchain.

Glibc 2.24 deprecated readdir_r() - readdir() now recommended even
for multithreaded programs.  This commit fixes following error:

/home/abuild/rpmbuild/BUILD/crash-worker-1.0.0/src/crash-stack/crash-stack.c: In function 'find_crash_tid':
/home/abuild/rpmbuild/BUILD/crash-worker-1.0.0/src/crash-stack/crash-stack.c:891:4: error: 'readdir_r' is deprecated [-Werror=deprecated-declarations]
while (readdir_r(dir, &entry, &dentry) == 0 && dentry) {
^~~~~

Change-Id: I99f22a0de87f2539988e1669ae2149dcac74a4df

7 years agosys-assert: Fix handle leak of mmap 47/123347/1 accepted/tizen/unified/20170406.055541 submit/tizen/20170405.094846
Sunmin Lee [Wed, 5 Apr 2017 07:53:29 +0000 (16:53 +0900)]
sys-assert: Fix handle leak of mmap

Unmap the memory after using it if it was mmaped.

Change-Id: Ia567c165ac09308a57ae8bb5eac4a9a2a524ec15
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoRevert "Separate logdump from crash-worker" 14/122514/1
Sunmin Lee [Mon, 3 Apr 2017 01:27:39 +0000 (10:27 +0900)]
Revert "Separate logdump from crash-worker"

This reverts commit c7826eefdccc5776eb0665cb0feb5d060e69fe96.

Change-Id: I398cf722d445b037d32d8116cc9c18a3a326b673

7 years agoFallback to ptrace call-stack unwinder if sys-assert failed 89/118089/1
Karol Lewandowski [Tue, 7 Mar 2017 15:13:18 +0000 (16:13 +0100)]
Fallback to ptrace call-stack unwinder if sys-assert failed

This commit enables ptrace-based call stack unwinder
(TIZEN_FEATURE_PTRACE_CALLSTACK).

When both SYS_ASSERT and PTRACE flavors are enabled
crash-manager will default to SYS_ASSERT, and fallback
to PTRACE only if former failed to generate the report
(eg. client application overwriten libsysassert's
signal handlers).

Change-Id: Ifc3626b7b46f47c3fd68efcb18d3900908ce3884

7 years agolibunwind: Fix off by one in _create_crash_stack 88/118088/1
Karol Lewandowski [Wed, 8 Mar 2017 15:23:52 +0000 (16:23 +0100)]
libunwind: Fix off by one in _create_crash_stack

This fixes call stack missing last element (usually _start,
in the case of invalid PC - the PC itself).

Change-Id: Ib1dae12bd06f1a4dfa1339fa6ea704bff05926c9

7 years agoSeparate logdump from crash-worker 51/116751/1
Sunmin Lee [Tue, 28 Feb 2017 06:02:25 +0000 (15:02 +0900)]
Separate logdump from crash-worker

In Tizen 4.0, the log_dump tool is supposed to be managed
in separate package.

Change-Id: Ie45cfdd9ee0530ef2e520ac781e9971120c87aeb
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoMerge branch 'tizen_3.0' into tizen 50/116750/1
Sunmin Lee [Fri, 24 Feb 2017 02:27:58 +0000 (11:27 +0900)]
Merge branch 'tizen_3.0' into tizen

Change-Id: I56715923d0ac0257736598e711d2c113548372cb

7 years agoFix vulnerability 77/115677/1 accepted/tizen/3.0/common/20170222.125537 accepted/tizen/3.0/ivi/20170222.082717 accepted/tizen/3.0/mobile/20170222.082645 accepted/tizen/3.0/tv/20170222.082659 accepted/tizen/3.0/wearable/20170222.082710 submit/tizen_3.0/20170221.053734
Sunmin Lee [Tue, 21 Feb 2017 05:02:20 +0000 (14:02 +0900)]
Fix vulnerability

- Enforce read size of read() less than buffer
- Do null check about opened bufferfile

Change-Id: Ie7d43eb1b04e68e03e97d5e9fed75aee669bfd0a
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoExecute dump_systemstate in parallel 34/115634/2
Sunmin Lee [Tue, 21 Feb 2017 01:07:11 +0000 (10:07 +0900)]
Execute dump_systemstate in parallel

Since rearrange the order of crash modules, coredump had made
too late. It has caused several issues such as missing coredump
when something happened during dump_systemstate.
Therefore, execute dump_systemstate in parallel.

In addition, to avoid confusing launch crash-popup right after
whole crash works are finished.

Change-Id: I73c10c7d60f04d218f313b760c0381d0b8d95de7
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: Get executable name from cmdline 61/115561/1
Sunmin Lee [Mon, 20 Feb 2017 09:46:44 +0000 (18:46 +0900)]
crash-stack: Get executable name from cmdline

The executable name in crash-stack is different with sys-assert.
In case of some applications, "exe" has indicated real path of app
that makes it hard to know what the actual app name is.
It's better to refer to "cmdline" instead.

Change-Id: I4895dbce427d50cd20a593585f2640554a4268fc
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoPrint pre-ptrace info to buffer file 14/108814/2
Sunmin Lee [Wed, 28 Dec 2016 08:03:36 +0000 (17:03 +0900)]
Print pre-ptrace info to buffer file

Some information had lost after ptrace.
However, the order of info also should be preserved.

To resolve this, that information are going to be printed
to temporal space first and will be merged in result file.

Change-Id: I523ded4ffc15b5edeac1944b62b5a42a5a44bc83
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: Find crashed tid by wchan 03/107503/4
Sunmin Lee [Fri, 6 Jan 2017 00:37:33 +0000 (09:37 +0900)]
crash-stack: Find crashed tid by wchan

If tid is not offered by kernel, crash-stack would
find crashed tid by checking wchan value of each thread.

Change-Id: Idfd6866fe17af4c7a266b3ae127e39087b0848f0
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-manager: Utilize cmdline instead of core_pattern 90/109190/5
Sunmin Lee [Mon, 9 Jan 2017 05:03:34 +0000 (14:03 +0900)]
crash-manager: Utilize cmdline instead of core_pattern

There are limitations on using core_pattern variables to get command info.
 %e: *its length is limited (up to 16 byte)
 %E: in case of some applications, it returns not actual app binary path
     (it returns launchpad-loader)
Because of these reasons, use cmdline of /proc instead to get command info.
(It also makes a consensus with sys-assert)

* Refer to: http://lxr.free-electrons.com/source/include/linux/sched.h#L1663

Change-Id: Ie486785485e4bcee2c62fb1e4fa98329d0f01170
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoSet suid_dumpable to debug (1) 22/114822/1
Sunmin Lee [Wed, 15 Feb 2017 07:27:57 +0000 (16:27 +0900)]
Set suid_dumpable to debug (1)

As a platform policy, Tizen offers core dumping for
all process by default. However, until now some process
has got cleared dump flag by the system.
We modify it to these processes also could be dumpable.

Change-Id: I2f8fb6a76b891f4ce6af97349ab963ef5c8183fc
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: Make output match sys-assert report 82/112582/3
Łukasz Stelmach [Wed, 1 Feb 2017 13:58:04 +0000 (14:58 +0100)]
crash-stack: Make output match sys-assert report

Change-Id: I7ecc9b045cc9b83d328d1d97bb08d4174c9d72ba

7 years agocrash-stack: remove the core dump handling remains 60/108060/3
Adrian Szyndela [Mon, 2 Jan 2017 14:03:58 +0000 (15:03 +0100)]
crash-stack: remove the core dump handling remains

Hopefully, there is no more rotting flesh.

Change-Id: I59003e8a38dd2817f78d23319848273615a0a5be

7 years agocrash-stack: add file offset to output 56/108056/3
Adrian Szyndela [Mon, 2 Jan 2017 13:37:54 +0000 (14:37 +0100)]
crash-stack: add file offset to output

Change-Id: Ib9f77b61d98a60e192877fad965a30ad8730af2f

7 years agocrash-stack: disable unw_get_proc_name prediction 80/107880/6
Rafal Pietruch [Fri, 30 Dec 2016 07:38:29 +0000 (08:38 +0100)]
crash-stack: disable unw_get_proc_name prediction

libunwind unw_get_proc_name function may return the name of
a label or a preceeding, nearby procedure; although the value
of the returned name plus the returned offset will
be equal to the instruction-pointer of the stack frame,
developers can find a exact symbol with related code position
in debug packages

Change-Id: I2471c2a9483b577844110f25128a6d539d39e5ad

7 years agocrash-stack: integration test added 02/107302/9
Rafal Pietruch [Wed, 21 Dec 2016 16:39:01 +0000 (17:39 +0100)]
crash-stack: integration test added

Change-Id: Iaac051671b89018dda37c212bb1c9da756879ed4

7 years ago(Modified) Deal with Toolchain upgrade 14/110814/1 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170118.174031 accepted/tizen/ivi/20170118.223040 accepted/tizen/mobile/20170118.222949 accepted/tizen/tv/20170118.223006 accepted/tizen/unified/20170309.033723 accepted/tizen/wearable/20170118.223022 submit/tizen/20170118.071648 submit/tizen_unified/20170308.100409
Sunmin Lee [Wed, 18 Jan 2017 05:23:37 +0000 (14:23 +0900)]
(Modified) Deal with Toolchain upgrade

(Revert "Deal with Toolchain upgrade")
This patch substitutes deprecated function "readdir_r" with "readdir"
rather than ignoring warning.

Change-Id: I3b4d3f9c28cc60c851f30332aa88780078471085
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoDeal with Toolchain upgrade 50/107950/1 accepted/tizen/common/20170102.152227 accepted/tizen/ivi/20170102.222935 accepted/tizen/mobile/20170102.222840 accepted/tizen/tv/20170102.222855 accepted/tizen/wearable/20170102.222917 submit/tizen/20170102.065224
Sunmin Lee [Mon, 2 Jan 2017 04:26:55 +0000 (13:26 +0900)]
Deal with Toolchain upgrade

According to Tizen toolchain will be upgraded in 4.0,
several build issues should be resolved.
This patch deals with "Language rules stricting".

Change-Id: I1993fb3b2a285c341f8b8b92ec32a428704ddc5a
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoMerge branch 'tizen_3.0' into tizen 13/107913/1
Sunmin Lee [Fri, 30 Dec 2016 00:59:56 +0000 (09:59 +0900)]
Merge branch 'tizen_3.0' into tizen

Change-Id: I62eb5bc520f06ea0daa13a7de4c3364d0a12695d

7 years agoChange internal modules work 35/107435/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.141409 accepted/tizen/3.0.m2/tv/20170104.142012 accepted/tizen/3.0.m2/wearable/20170104.142306 accepted/tizen/3.0/common/20161228.162501 accepted/tizen/3.0/ivi/20161228.095940 accepted/tizen/3.0/mobile/20161228.095844 accepted/tizen/3.0/tv/20161228.095905 accepted/tizen/3.0/wearable/20161228.095922 submit/tizen_3.0.m2/20170104.093751 submit/tizen_3.0/20161228.075358
Sunmin Lee [Wed, 28 Dec 2016 05:35:13 +0000 (14:35 +0900)]
Change internal modules work

- crash-pipe: create core file only
- crash-stack: create .info file (call-stack)

Change-Id: I71ba012f426e5d055f3acfc2b2820b5fcb2e17ec
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoFix vulnerability 89/107389/1 submit/tizen_3.0/20161228.020839
Sunmin Lee [Wed, 28 Dec 2016 01:20:32 +0000 (10:20 +0900)]
Fix vulnerability

Check range of signo before use it

Change-Id: Icae63a7185a897ba6688b45715b208c2d92df1b7
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: libunwind used on aarch64 39/105839/6
Kunhoon Baik [Tue, 27 Dec 2016 13:00:35 +0000 (22:00 +0900)]
crash-stack: libunwind used on aarch64

Make use of "ptrace: Add support for GETREGSET" patch to libunwind
https://lists.nongnu.org/archive/html/libunwind-devel/2016-07/msg00001.html

Depends-On: I2e720e6697fbc1facf1d7547b398f5665b17731e
Change-Id: I0ce3886d271c9b78d2a44b99a628ccc502e6e400

7 years agocrash-stack: Simplify signal info 13/107313/1
Sunmin Lee [Tue, 27 Dec 2016 05:49:41 +0000 (14:49 +0900)]
crash-stack: Simplify signal info

It is hard to get signal info which caused dump using ptrace.
Therefore, crash-stack prints signal number only
which came from core_pattern.

Change-Id: I6cd865a89d3e2c5dd83cfe134bb8cddec4f7f81f
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoRemove PD License 04/107304/1 accepted/tizen/3.0/common/20161228.071657 accepted/tizen/3.0/ivi/20161228.022249 accepted/tizen/3.0/mobile/20161228.022154 accepted/tizen/3.0/tv/20161228.022211 accepted/tizen/3.0/wearable/20161228.022229 submit/tizen_3.0/20161227.112255
Sunmin Lee [Tue, 27 Dec 2016 11:15:52 +0000 (20:15 +0900)]
Remove PD License

Change-Id: Iaa3daf6bf96c5ae59ad77515a0f942f4d4a71586
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoAdjust smack label 95/107295/2 submit/tizen_3.0/20161227.111028
Sunmin Lee [Tue, 27 Dec 2016 10:33:55 +0000 (19:33 +0900)]
Adjust smack label

In response to security issue, restrict smack label of crash-manager.
In addition, adjust crash directories label to accord with
work of crash-worker.

Change-Id: I97390d50337fd36a746e260f3f6ebc29c6990526
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoMerge "log_dump: Restrict dbus permission" into tizen_3.0
Sunmin Lee [Tue, 27 Dec 2016 10:48:51 +0000 (02:48 -0800)]
Merge "log_dump: Restrict dbus permission" into tizen_3.0

7 years agoSeparate package dependencies of crash-stack 30/107230/2 submit/tizen_3.0/20161227.102645
Sunmin Lee [Tue, 27 Dec 2016 07:44:49 +0000 (16:44 +0900)]
Separate package dependencies of crash-stack

According to experimental variable, exclude unused package
dependencies from crash-worker.spec.

+ Bug fix:
   "crash-stack: Make ptrace callstack feature selective"

Change-Id: If8746a74fb937f7929538a995d6f1cf392e19bd4
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agolog_dump: Restrict dbus permission 66/107166/1
Sunmin Lee [Tue, 27 Dec 2016 02:25:12 +0000 (11:25 +0900)]
log_dump: Restrict dbus permission

log_dump can be activated using dbus method call.
Because this feature should be used by administrator only,
restrict the dbus activation permission.

Change-Id: Ib63ea10fd5101af146e35cf9ef47e96f91a3229f
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: Make ptrace callstack feature selective 00/107100/1 accepted/tizen/3.0/common/20161227.102347 accepted/tizen/3.0/ivi/20161227.011727 accepted/tizen/3.0/mobile/20161227.011714 accepted/tizen/3.0/tv/20161227.011720 accepted/tizen/3.0/wearable/20161227.011722 submit/tizen_3.0/20161226.231846
Sunmin Lee [Mon, 26 Dec 2016 11:31:43 +0000 (20:31 +0900)]
crash-stack: Make ptrace callstack feature selective

In Tizen 3.0, the crash-stack using ptrace to generate callstack
will be offered as a choice.
Developers can enable this feature through setting a variable as on:
TIZEN_FEATURE_PTRACE_CALLSTACK

Change-Id: I7dfbf563144174abcd5e50677eb8943cdb8d8ebe
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoRemove SIGSEGV handling 60/106760/1 submit/tizen_3.0/20161226.093327
Kunhoon Baik [Mon, 4 Jul 2016 11:01:31 +0000 (20:01 +0900)]
Remove SIGSEGV handling

SIGSEGV (signal number - 11) may occur double crash when sys-assert tries to unwind backtrace.
like that

If the double crash is generated, it causes useless backtrace of corefile (double crashed memory dump)
Thus, sys-assert does not handle SIGSEGV.

Change-Id: I826ee2bab796fc87b2b4a003683315514af96339

7 years agoFix handle leak 38/106638/1 accepted/tizen/3.0/common/20161223.110758 accepted/tizen/3.0/ivi/20161223.082249 accepted/tizen/3.0/mobile/20161223.082230 accepted/tizen/3.0/tv/20161223.082234 accepted/tizen/3.0/wearable/20161223.082240 submit/tizen_3.0/20161222.092901 submit/tizen_3.0/20161222.232700
Sunmin Lee [Thu, 22 Dec 2016 08:58:58 +0000 (17:58 +0900)]
Fix handle leak

Fix handle leak of file pointer at crash-stack

Change-Id: I2d68e04ad84ea7263e3c45cc91ef295557532bde
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoMerge "crash-stack: use libunwind for i686 and x86_64" into tizen_3.0
Karol Lewandowski [Tue, 20 Dec 2016 17:33:58 +0000 (09:33 -0800)]
Merge "crash-stack: use libunwind for i686 and x86_64" into tizen_3.0

7 years agoMerge "crash-stack: fixed attaching to thread" into tizen_3.0
Karol Lewandowski [Tue, 20 Dec 2016 16:23:33 +0000 (08:23 -0800)]
Merge "crash-stack: fixed attaching to thread" into tizen_3.0

7 years agocrash-stack: use libunwind for i686 and x86_64 52/105152/2
Rafal Pietruch [Thu, 15 Dec 2016 15:28:17 +0000 (16:28 +0100)]
crash-stack: use libunwind for i686 and x86_64

Change-Id: I0022cc3ac772ba26ed67f7d64d45c3ab4e22db88

7 years agocrash-stack: fixed attaching to thread 36/105436/2
Adrian Szyndela [Fri, 16 Dec 2016 12:27:35 +0000 (13:27 +0100)]
crash-stack: fixed attaching to thread

It is not necessary to attach to parent process main thread to
resolve stack in another thread. This commit also solves hanging up
on 'D' (and 'Z') processes - main thread is not attachable,
when a crash occurs in another thread.

Change-Id: Ic3a085951acb4057fcdd4a476693954d1d3a522b

7 years agocrash-manager: consider backward compatibility for crash-stack 23/105623/4 accepted/tizen/3.0/common/20161221.181339 accepted/tizen/3.0/ivi/20161221.011328 accepted/tizen/3.0/mobile/20161221.011734 accepted/tizen/3.0/tv/20161221.011025 accepted/tizen/3.0/wearable/20161221.011357 submit/tizen_3.0/20161220.115150
Sunmin Lee [Mon, 19 Dec 2016 06:26:30 +0000 (15:26 +0900)]
crash-manager: consider backward compatibility for crash-stack

Though the crash-stack is available about tid option,
previous kernel has not supported this feature.
Therefore the crash-manager should call crash-stack
considering backward compatibility.

Change-Id: I779783ed46760b88a6d454a05710b29cd4418a44
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: deprecate corefile option 80/106080/3
Sunmin Lee [Tue, 20 Dec 2016 09:41:00 +0000 (18:41 +0900)]
crash-stack: deprecate corefile option

crash-stack should be able to generate call stack
using pid only.
(Generating corefile causes sluggish issue)

Change-Id: Ie9e74494b966838d1dd6548424d51bfd2df4c1e0

7 years agoRevert "engineer mode: make .debugmode on engineer image" 56/104956/2
Sunmin Lee [Thu, 15 Dec 2016 02:26:38 +0000 (11:26 +0900)]
Revert "engineer mode: make .debugmode on engineer image"

.debugmode is moved to other package

This reverts commit b153665a12cda6a29f9ba9d12db7f2682ade9af5.

Change-Id: Idfe9cae63b8f4e4122c74abb144250eea45d9f07

7 years agocrash-stack: get registers from tid instead of pid 18/105118/1
Adrian Szyndela [Thu, 15 Dec 2016 12:03:21 +0000 (13:03 +0100)]
crash-stack: get registers from tid instead of pid

Change-Id: Id4ea3f57808420ec6ac0941c2612a5af51136c96

7 years agocrash-stack: work around hanging up on 'D' processes 64/104564/3
Adrian Szyndela [Tue, 13 Dec 2016 13:43:06 +0000 (14:43 +0100)]
crash-stack: work around hanging up on 'D' processes

Processes in uninterruptible sleep state ('D' status in ps)
cannot be ptraced until they leave the state. To prevent
hanging up of crash-stack, we check the target process state.
If it is 'D', then we give up ptracing it, and instead
print the information from /proc/<pid>/wchan, /proc/<pid>/syscall
and /proc/<pid>/stack.

Change-Id: I82644051a5499c42db2a8e51a7af98693e8da363

7 years agocrash-stack: Drop duplicate call stack footer 15/104915/2
Karol Lewandowski [Wed, 14 Dec 2016 16:53:05 +0000 (17:53 +0100)]
crash-stack: Drop duplicate call stack footer

Change-Id: I938f2ead95d312450edb853740cce47becf796fc

7 years agocrash-stack: print memory information 14/104914/2
Łukasz Stelmach [Wed, 14 Dec 2016 16:30:54 +0000 (17:30 +0100)]
crash-stack: print memory information

Print information from /proc/meminfo and /proc/PID/status

Change-Id: I6c66e9ee6c8eca20a8925e9ecc23e09c0dabcb25

7 years agocrash-stack: change error reporting file handle 13/104913/1
Łukasz Stelmach [Wed, 14 Dec 2016 16:28:10 +0000 (17:28 +0100)]
crash-stack: change error reporting file handle

Change-Id: I734b431f56f9e32c440839e1bd4e5b90112773ec

7 years agocrash-stack: print maps information 12/104912/1
Łukasz Stelmach [Wed, 14 Dec 2016 14:06:43 +0000 (15:06 +0100)]
crash-stack: print maps information

Print information about mapped memory regions.

Add stub for printing system and process VM information.

Change-Id: I47b2c5f837620f9d22b3270a75d8f5e663d44c78

7 years agocrash-stack: print executable file path 11/104911/1
Łukasz Stelmach [Wed, 14 Dec 2016 15:26:54 +0000 (16:26 +0100)]
crash-stack: print executable file path

Change-Id: Ib5946bcfb5bbad8af7b7bbfc7c8568a3cb3ab207

7 years agocrash-stack: support for resolving stack from threads 98/104898/3
Adrian Szyndela [Wed, 14 Dec 2016 13:52:37 +0000 (14:52 +0100)]
crash-stack: support for resolving stack from threads

Change-Id: Ic80b6b83acb80b3c332b6b6674fbf662b1003586

7 years agocrash-stack: put more effort into getting names 25/104725/6
Adrian Szyndela [Wed, 14 Dec 2016 07:16:22 +0000 (08:16 +0100)]
crash-stack: put more effort into getting names

It seems libdwfl-0.153 sometimes can't get symbol names
automatically. This commit adds fallback procedure, that
takes module name and mapping provided by libdwfl,
and - using libelf - looks for the symbol name, instead
of relying only on libdwfl.

Change-Id: I7e65f810b46dc43bea217b715852a5ae5c3d70c9

7 years agocrash-stack: reformat callstack output 70/104870/3
Rafal Pietruch [Wed, 14 Dec 2016 12:11:12 +0000 (13:11 +0100)]
crash-stack: reformat callstack output

Change-Id: Ica727d63de389d8a4a2f1ff7cfced2a463630282

7 years agoMerge "crash-stack: resolving symbols extracted from printing function" into tizen_3.0
Karol Lewandowski [Wed, 14 Dec 2016 15:45:12 +0000 (07:45 -0800)]
Merge "crash-stack: resolving symbols extracted from printing function" into tizen_3.0

7 years agoMerge "crash-stack: print information about threads" into tizen_3.0
Karol Lewandowski [Wed, 14 Dec 2016 15:44:42 +0000 (07:44 -0800)]
Merge "crash-stack: print information about threads" into tizen_3.0

7 years agocrash-stack: resolving symbols extracted from printing function 69/104869/2
Rafal Pietruch [Wed, 14 Dec 2016 07:17:39 +0000 (08:17 +0100)]
crash-stack: resolving symbols extracted from printing function

Change-Id: I0ae01bc7a2a9a0e6f084a9e275e1025058645c77

7 years agoMerge "crash-manager: pass tid number to identify failing thread" into tizen_3.0
Karol Lewandowski [Wed, 14 Dec 2016 15:11:37 +0000 (07:11 -0800)]
Merge "crash-manager: pass tid number to identify failing thread" into tizen_3.0

7 years agoMerge "tests: Add a test program for crashing with threads" into tizen_3.0
Karol Lewandowski [Wed, 14 Dec 2016 15:11:09 +0000 (07:11 -0800)]
Merge "tests: Add a test program for crashing with threads" into tizen_3.0

7 years agoMerge "crash-stack: align output format with sys-assert" into tizen_3.0
Karol Lewandowski [Wed, 14 Dec 2016 15:10:59 +0000 (07:10 -0800)]
Merge "crash-stack: align output format with sys-assert" into tizen_3.0

7 years agocrash-stack: print information about threads 13/104813/5
Łukasz Stelmach [Wed, 14 Dec 2016 13:51:14 +0000 (14:51 +0100)]
crash-stack: print information about threads

Change-Id: Ib0e2d9c2bdbd5fd4eacc0608a8c5ecccdfd4f2a8

7 years agocrash-manager: pass tid number to identify failing thread 05/104805/2
Łukasz Stelmach [Tue, 13 Dec 2016 15:03:49 +0000 (16:03 +0100)]
crash-manager: pass tid number to identify failing thread

Accept tid as second argument for crash-manager and pass it to
crash-stack.

Change-Id: Icfc0db6f5675eb781777ea7a7c5dc2d4cb581105

7 years agotests: Add a test program for crashing with threads 04/104804/1
Łukasz Stelmach [Tue, 13 Dec 2016 13:01:19 +0000 (14:01 +0100)]
tests: Add a test program for crashing with threads

Change-Id: I0b9ef8567b0bb1203fdd9fe3e0aa753e25ff50df

7 years agocrash-manager: make secure program 47/104647/2 accepted/tizen/3.0/common/20161215.163612 accepted/tizen/3.0/ivi/20161215.044958 accepted/tizen/3.0/mobile/20161215.044940 accepted/tizen/3.0/tv/20161215.044951 accepted/tizen/3.0/wearable/20161215.044955 submit/tizen_3.0/20161214.090816
Sunmin Lee [Wed, 14 Dec 2016 03:51:31 +0000 (12:51 +0900)]
crash-manager: make secure program

- Use secure function (strncat)
- Prevent buffer overrun

Change-Id: I47acf1bb39c0be123a486116f811b78f30d6ff01
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agocrash-stack: align output format with sys-assert 60/104560/1
Łukasz Stelmach [Tue, 13 Dec 2016 09:33:24 +0000 (10:33 +0100)]
crash-stack: align output format with sys-assert

Make crash-stack print register information the very same way as
sys-assert does it.

Change output format slightly for 64 bit architectures to match hw
requirements.

Support both i686 and x86_64 in the same architecture specific file.

Change-Id: Ica03360b61c1aa133b83c5622334cf4f375db3c2

7 years agoUpdate authorship information 29/103829/3
Łukasz Stelmach [Fri, 9 Dec 2016 14:06:14 +0000 (15:06 +0100)]
Update authorship information

Change-Id: I064948790ce22c0167ce6986a4d0a0e78fd974ab

7 years agocrash-stack: separate libunw code 51/104551/1
Rafal Pietruch [Mon, 12 Dec 2016 16:19:07 +0000 (17:19 +0100)]
crash-stack: separate libunw code

Change-Id: I1f24781316a78439db862c3ab0d2492fea095c1c

7 years agocrash-stack: add symbol resolution for arm 30/103830/2
Rafal Pietruch [Fri, 9 Dec 2016 14:04:03 +0000 (15:04 +0100)]
crash-stack: add symbol resolution for arm

Change-Id: Iabb556a96907156a9b8775cdb25281dea560ce69

7 years agouse libunwind for ARM in case of McTernan unwinder 05/102605/5
Rafal Pietruch [Fri, 9 Dec 2016 14:02:57 +0000 (15:02 +0100)]
use libunwind for ARM in case of McTernan unwinder

Change-Id: I6fb6f95df6f09a1b4c7e38489606aaab1e452e59

7 years agoResolve crash-stack build issue in emulator 90/104290/2 accepted/tizen/3.0/common/20161213.164254 accepted/tizen/3.0/ivi/20161213.064926 accepted/tizen/3.0/mobile/20161213.064846 accepted/tizen/3.0/tv/20161213.064858 accepted/tizen/3.0/wearable/20161213.064912 submit/tizen_3.0/20161213.043921
Kunhoon Baik [Tue, 13 Dec 2016 04:27:31 +0000 (13:27 +0900)]
Resolve crash-stack build issue in emulator

32 bit: Add stub function for _crash_stack_print_regs
64 bit: correct output format specifier

Change-Id: I4d95ab2ebee9c86a4fa05015f6ca5b3ccc8ea151

7 years agoRevert "crash-pipe: read and parse core" 70/104270/2 submit/tizen_3.0/20161213.034539
Kunhoon Baik [Tue, 13 Dec 2016 03:34:28 +0000 (19:34 -0800)]
Revert "crash-pipe: read and parse core"

This reverts commit b3661520e5b660ce7352381e6bfa5d25647357e4.

Change-Id: I01557e7b7bf4ed5f8c278e2e168d8aaa04f8d49e

7 years agocrash-manager: change default configuration values to unlimited 92/103992/3 submit/tizen_3.0/20161213.021549
Sunmin Lee [Mon, 12 Dec 2016 04:51:13 +0000 (13:51 +0900)]
crash-manager: change default configuration values to unlimited

For ease of debugging, default values of coredump configuration
are changed to 0 (unlimited).

Change-Id: I53188215b55e98acd6aac835195697cbda50b0ae
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agotests: add a glib based crash test 40/103540/4
Łukasz Stelmach [Fri, 2 Dec 2016 12:20:39 +0000 (13:20 +0100)]
tests: add a glib based crash test

Change-Id: Ib5c2a176e0108b1fa20cbd0d156fb1f29139b8fa

7 years agotests: add a simple test 39/103539/3
Łukasz Stelmach [Mon, 28 Nov 2016 13:09:19 +0000 (14:09 +0100)]
tests: add a simple test

test1-crash crashes and dumps a core. test1-sleep enters an infinite
sleep enabling ptrace-based stack examination. test1-ill triggers
the "illegal instruction" exception (SIGILL).

Change-Id: I995f5ce8817e49ec57bac6cac8e7f458807d03f0

7 years agocrash-pipe: read and parse core 59/103559/1
Łukasz Stelmach [Fri, 25 Nov 2016 15:12:55 +0000 (16:12 +0100)]
crash-pipe: read and parse core

Read basic information from elf notes segment and dump:

+ NT_SIGINFO: siginfo_t describing the signal that killed the process
+ NT_AUXV: auxiliary vector
+ NT_FILE: memory mapped files
+ NT_PRSTATUS: registers

The information is at the beginnig of the core (< 8kB) so it is not
necessary to read large amounts of data.

Change-Id: Ia2232ce88bb039e49f2129f7a28ff1f4a7c9bbda

7 years agocrash-pipe: Print maps information 16/96916/2
Łukasz Stelmach [Fri, 4 Nov 2016 09:43:52 +0000 (10:43 +0100)]
crash-pipe: Print maps information

Change-Id: Idab48c5dde20e0aa2a8337b7008a8244a612d844

7 years agocrash-pipe: Print memory information 15/96915/2
Łukasz Stelmach [Fri, 21 Oct 2016 13:06:53 +0000 (15:06 +0200)]
crash-pipe: Print memory information

The code has been ported from sys-assert.

Change-Id: I64ae2fb0d2a12f7def29328b1ac46cb6c335e0a5

7 years agocrash-pipe: Print the executable file path 14/96914/2
Łukasz Stelmach [Mon, 10 Oct 2016 13:37:27 +0000 (15:37 +0200)]
crash-pipe: Print the executable file path

Change-Id: I730978b87b15a02e9464505426d53b9d2037d85f

7 years agocrash-pipe: the buffer does not need to be a static variable 13/96913/2
Łukasz Stelmach [Mon, 10 Oct 2016 13:37:08 +0000 (15:37 +0200)]
crash-pipe: the buffer does not need to be a static variable

Change-Id: Ibb1f489564ecc888451d59c549db9dab9d0d97e9

7 years agocrash-stack: report on siginfo_t 35/103535/1
Łukasz Stelmach [Tue, 6 Dec 2016 09:31:30 +0000 (10:31 +0100)]
crash-stack: report on siginfo_t

Change-Id: I86e8058eded47f23c51d213fffb56f2f078931bc

7 years agocrash-stack: Print signal information 34/103534/1
Łukasz Stelmach [Fri, 4 Nov 2016 13:06:54 +0000 (14:06 +0100)]
crash-stack: Print signal information

Change-Id: Ia6d535d1d229dbc55aafd6b50529062e63b411ff

7 years agocrash-stack: link against libebl conditionally 33/103533/1
Łukasz Stelmach [Thu, 8 Dec 2016 11:48:21 +0000 (12:48 +0100)]
crash-stack: link against libebl conditionally

Link against libebl only if crash-stack is built with support for
core dump files.

Rewrite conditional building of sys_assert to use %bcond_with.

Change-Id: I50edbd417a5426a43da3b9c0e912933a7db95f4b

7 years agocrash-stack: Print register values 11/96911/2
Łukasz Stelmach [Thu, 20 Oct 2016 10:14:53 +0000 (12:14 +0200)]
crash-stack: Print register values

Change-Id: If8d82aa32eb524ffb23715af6016f0fec12bd144

7 years agoAdd .gitignore and .dir-locals.el files for easier development. 10/96910/2
Łukasz Stelmach [Thu, 20 Oct 2016 10:17:27 +0000 (12:17 +0200)]
Add .gitignore and .dir-locals.el files for easier development.

Change-Id: I6ecab2063adb5d5660592becc31db8f21e67c89a

7 years agoFixed coding style & added doxygen docs 09/96909/2
Adrian Szyndela [Wed, 7 Sep 2016 10:26:48 +0000 (12:26 +0200)]
Fixed coding style & added doxygen docs

This fixes and adds again commit 11c142a267540ee070db0c8c1dc47c022edd02a6.
Thus, this reverts commit 7ec36fc1820b0b3622f0c1d941439e906a4603ff
which reverted commit 11c142a267540ee070db0c8c1dc47c022edd02a6.

Change-Id: I944d1e9a664cbc38e84853f9a67b093ecb68754b

7 years agocrash-stack: adding fallback heuristic method for unwinding 08/96908/2
Adrian Szyndela [Wed, 7 Sep 2016 10:15:20 +0000 (12:15 +0200)]
crash-stack: adding fallback heuristic method for unwinding

This reverts commit b7ef1fff4dd5f8f754df1431fe4b80fc1901b459,
which reverted commit f29763ccb1cf24bea7807b55ecd9722e3cb03743.

In case no better method is ready or available, this method
may yield some useful results. It simply walks over data stack
and checks word after word if it looks like an address from
any function. All such addresses are considered as call stack
functions. It should generally show all the called functions
that left any trace on the stack. However, among those there
may be a number of false positives.

This is currently used for x86_64 architecture.

Change-Id: If8fd88b8ab3e345a256006127c36bcb4022cc736

7 years agocrash-stack: unwinding by frame pointer on aarch64 07/96907/2
Adrian Szyndela [Wed, 7 Sep 2016 09:46:01 +0000 (11:46 +0200)]
crash-stack: unwinding by frame pointer on aarch64

This fixes and adds again commit 269790304eea1bde27644962efa7803c7ab611df.
Thus, this reverts commit ba3f2151f97c3e4bba1ac04c953f28ac4eb1e463,
which reverted commit 269790304eea1bde27644962efa7803c7ab611df.

To unwind call stack on aarch64 we need to use external
method, as libelf 0.153 does not support unwinding yet.
Possible methods are:
- using libunwind;
- manual walk with frame pointers;
- heuristic unwind by inspecting data stack.

This patch adds support for unwinding on aarch64 with frame pointers,
along with changes needed to modularize unwinding.

Change-Id: I461a06c96d56804fefb7167550e44074e734c94b

7 years agocrash-manager: refine internal code 60/103360/2
Sunmin Lee [Thu, 8 Dec 2016 06:19:19 +0000 (15:19 +0900)]
crash-manager: refine internal code

1) Use flock instead of manual lock
  The standard function flock substituted lock function
 implemented by itself.
2) Clean dump at once
  The clean dump logic can be done in single scan.
 It would simplify the operation of the function.

Change-Id: Ica807df6f52677a8353bd89395197651f01d99d0
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoChange log buffer to system 98/100798/3
Sunmin Lee [Tue, 29 Nov 2016 08:27:00 +0000 (17:27 +0900)]
Change log buffer to system

Use SLOGs instead of LOGs

Change-Id: Id4ce90d14ceab024514b2b5da7696aca414887fc
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoChange compressing format to zip 90/100490/4
Sunmin Lee [Mon, 28 Nov 2016 08:57:57 +0000 (17:57 +0900)]
Change compressing format to zip

Change compressing format from tar.gz to zip
due to compatibility issues

Change-Id: I1e08c1c139617af9baf3b488c3b8db4bd360e95c
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoConfigurable crash-manager 46/99646/6
Sunmin Lee [Fri, 18 Nov 2016 02:20:20 +0000 (11:20 +0900)]
Configurable crash-manager

crash-manager can manage dump output according to configured value
in config file (crash-manager.conf).

The config values
 SystemMaxUse   : The maximum usage of partition that crash dump can be generated
 SystemKeepFree : The free space should be kept
 MaxRetentionSec: The retention time of each dump file
 MaxCrashDump   : The maximum number of dump file to be preserved
 AllowZip       : Whether compressing dump or not

Change-Id: Ib0c3cd9445338e469040b07aebf81bf6705fd29e
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoConvert crash-manager into c code 21/97521/13
Sunmin Lee [Fri, 11 Nov 2016 02:01:27 +0000 (11:01 +0900)]
Convert crash-manager into c code

For ease of adding features, crash-manager is converted to c code.

* Minor changes
 - unused library headers removed (log_dump)
 - change date format (epoch -> local)

Change-Id: I6f27547469769b2ba3c01027cf53bc0d17d82c5e
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoRearrange crash-manager tasks 27/102227/2 accepted/tizen/3.0/common/20161209.160720 accepted/tizen/3.0/ivi/20161209.102509 accepted/tizen/3.0/mobile/20161209.102413 accepted/tizen/3.0/tv/20161209.102432 accepted/tizen/3.0/wearable/20161209.102502 submit/tizen_3.0/20161208.073002
Sunmin Lee [Mon, 5 Dec 2016 07:59:22 +0000 (16:59 +0900)]
Rearrange crash-manager tasks

Launching crash popup and collecting log are required to be done first.

Change-Id: I97d48117223fffc7c61923c742062f16b4f288eb

7 years agodump_systemstate: extend sort buffer size 80/101880/1
Sunmin Lee [Fri, 2 Dec 2016 09:25:08 +0000 (18:25 +0900)]
dump_systemstate: extend sort buffer size

Dump info needs to have enough information.
So set the buffer size of dlogutil larger than default.

Change-Id: I999caa73c130649fd75449b7ace400f683abfc89

7 years agoUpgrade: set RW update script number 57/101857/1 accepted/tizen/3.0/common/20161205.091943 accepted/tizen/3.0/ivi/20161205.000009 accepted/tizen/3.0/mobile/20161204.235901 accepted/tizen/3.0/tv/20161204.235939 accepted/tizen/3.0/wearable/20161204.235947 submit/tizen_3.0/20161202.091046
Sunmin Lee [Fri, 2 Dec 2016 08:47:36 +0000 (17:47 +0900)]
Upgrade: set RW update script number

Change-Id: Ib8f40eaf90ee0d096de6f0191a367f458375bb09

7 years agoDisable New Crash Stack 72/101072/1 accepted/tizen/3.0/common/20161203.012219 accepted/tizen/3.0/ivi/20161202.005611 accepted/tizen/3.0/mobile/20161202.005518 accepted/tizen/3.0/tv/20161202.005535 accepted/tizen/3.0/wearable/20161202.005555 submit/tizen_3.0/20161201.060326
Kunhoon Baik [Wed, 30 Nov 2016 08:04:52 +0000 (17:04 +0900)]
Disable New Crash Stack

Change-Id: I3a7446f91e1d6289f8a37150c13669f058442685

7 years agolog_dump: broadcast start/finish dbus signal 36/97636/6
Sunmin Lee [Tue, 15 Nov 2016 01:27:56 +0000 (10:27 +0900)]
log_dump: broadcast start/finish dbus signal

log_dump offers start/finish signal so other processes can recognize
log_dump's operation in different way rather than waiting it's reply.

Change-Id: Id23f181fd820f996071da30c895896850c4c474a

7 years agoSeveral modifications for backward compatibility 53/98853/3
Sunmin Lee [Mon, 21 Nov 2016 05:03:36 +0000 (14:03 +0900)]
Several modifications for backward compatibility

1) Change log_dump dbus path and interface.
2) Add delete_dump option to log_dump's dbus interface.
3) Move log_dump's result from CRASH_ROOT to LOG_DUMP_RESULT.
4) tizen-debug on/off services are added.

Change-Id: I0257537ad69b524714370c1ecfa11cc9d942a560
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
7 years agoChange executable to shared object 46/99146/1 accepted/tizen/3.0/common/20161124.181826 accepted/tizen/3.0/ivi/20161124.082111 accepted/tizen/3.0/mobile/20161124.082043 accepted/tizen/3.0/tv/20161124.082055 accepted/tizen/3.0/wearable/20161124.082104 submit/tizen_3.0/20161123.105217
Sunmin Lee [Tue, 22 Nov 2016 04:56:38 +0000 (13:56 +0900)]
Change executable to shared object

Because of security issue, executables made by crash-worker
should be shared object.

Change-Id: I898b8c2f7b6e70366e69d56339fc355ef4c33944
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>