platform/core/system/crash-worker.git
5 years agosystem tests: add basic log_dump tests 87/200387/5
Karol Lewandowski [Thu, 21 Feb 2019 15:36:45 +0000 (16:36 +0100)]
system tests: add basic log_dump tests

Change-Id: Ibcbf680ba2b4c105d66c9f0c93acf6aaababe375

5 years agosystem tests: rationalize naming 86/200386/5
Karol Lewandowski [Thu, 21 Feb 2019 15:34:57 +0000 (16:34 +0100)]
system tests: rationalize naming

Change-Id: I21d22e7cba27ce4ede716573056946bf3cd3ddd6

5 years agosystem tests: scripts depend on bash extensions 85/200385/5
Karol Lewandowski [Thu, 21 Feb 2019 14:55:19 +0000 (15:55 +0100)]
system tests: scripts depend on bash extensions

Even if given script does not explicitly use bash extensions it
sources minicore-utils.sh, which do require bash.

Change-Id: I1689531bf9f9a60f0e2c607dad504d92c5419fba

5 years agoRelease 5.5.8 53/200153/1 accepted/tizen/unified/20190220.071628 submit/tizen/20190219.142715
Karol Lewandowski [Tue, 19 Feb 2019 12:23:59 +0000 (13:23 +0100)]
Release 5.5.8

This change brings on Coverity fix.

Change-Id: I8da5e50276189c609a70712d3d652f44237346d5

5 years agocrash-manager: Fix error checking for pkgmgrinfo*() invocation 40/200140/3
Karol Lewandowski [Tue, 19 Feb 2019 12:04:34 +0000 (13:04 +0100)]
crash-manager: Fix error checking for pkgmgrinfo*() invocation

This commit fixes 'unchecked return value' as reported by coverity.

Change-Id: I8c31504fd03826862f85df5ff24d7752a12262e9

5 years agoRelease 5.5.7 12/199812/1 accepted/tizen/unified/20190218.063827 submit/tizen/20190214.144730
Karol Lewandowski [Thu, 14 Feb 2019 14:41:44 +0000 (15:41 +0100)]
Release 5.5.7

This release brings following changes:
 - Fix allocation size mismatch (SVACE fix)
 - log_dump: change permission of service file

Change-Id: I8ca897471a727b811d62baa323c7a166ff40412a

5 years agoFix allocation size mismatch 33/199533/4
Mateusz Moscicki [Tue, 12 Feb 2019 13:48:10 +0000 (14:48 +0100)]
Fix allocation size mismatch

Change-Id: Iee761aafd7f7cb63d12acc48345519faba821536

5 years agolog_dump: change permission of service file 66/199066/1
Sunmin Lee [Fri, 1 Feb 2019 08:22:58 +0000 (17:22 +0900)]
log_dump: change permission of service file

The systemd service file should be set to root ownership.

Change-Id: I27978116c0b6f1c782285a604e30ee093999166b
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
5 years agoRelease 5.5.6 10/198010/1 accepted/tizen/unified/20190128.061511 submit/tizen/20190117.152408 submit/tizen/20190122.114956
Karol Lewandowski [Thu, 17 Jan 2019 15:20:23 +0000 (16:20 +0100)]
Release 5.5.6

This release adds information about crashed application (.tpk)
to .so_info file.

Additionally, one svace issue is fixed.

Change-Id: I0ce18e1c47906df26bc996960681685a33f88c89

5 years agoMerge "svace: fix closing potentially negative fd" into tizen
Karol Lewandowski [Thu, 17 Jan 2019 15:19:16 +0000 (15:19 +0000)]
Merge "svace: fix closing potentially negative fd" into tizen

5 years agoAdd support for tpk packages 32/197632/5
Mateusz Moscicki [Mon, 14 Jan 2019 12:41:50 +0000 (13:41 +0100)]
Add support for tpk packages

Change-Id: Ic625678478e3dc888bea786bb203ef021c579228

5 years agosvace: fix closing potentially negative fd 89/197989/1
Karol Lewandowski [Thu, 17 Jan 2019 11:38:48 +0000 (12:38 +0100)]
svace: fix closing potentially negative fd

This commit fixes following issue reported by svace:

 "Variable 'cinfo.prstatus_fd', which may receive negative value at
  crash-manager.c:588 by calling function 'set_crash_info' at
  crash-manager.c:1267, is used at crash-manager.c:1332 by calling
  function 'close'."

Change-Id: Ie625bc8ac5eb16a84bb7b139b569c6189e1a5e25

5 years agoRelease 5.5.5 27/195827/2 accepted/tizen/unified/20181219.063407 submit/tizen/20181218.160613
Karol Lewandowski [Tue, 18 Dec 2018 11:25:56 +0000 (12:25 +0100)]
Release 5.5.5

This release brings one change - DLog format specifier fixes for 64-bit
architecures.

Change-Id: I443faa5a06afb9c272c953360e0f85cbf913f7db

5 years agoFix DLog format specifier for 64-bit architecures 26/195826/2
Karol Lewandowski [Tue, 18 Dec 2018 11:15:40 +0000 (12:15 +0100)]
Fix DLog format specifier for 64-bit architecures

Change-Id: I3f29eb0dc3e5081843f0c982dab92cd45aad1364

5 years agoRelease 5.5.4 97/195597/1 accepted/tizen/unified/20181217.142314 submit/tizen/20181214.153700
Karol Lewandowski [Fri, 14 Dec 2018 15:08:46 +0000 (16:08 +0100)]
Release 5.5.4

This release brings following fixes:

 - fix DLog format specifier (needed if DLog start enforcing valid
   printf-formats)

 - fix: Make disk-usage functions use off_t

 - relability fix: crash-manager: Do not force system to wait for
   crash-popup to complete

Change-Id: I733f09298c34c1c7824f57dfa156f23cf9196947

5 years agocrash-stack: Fix format specifier 38/194838/2
Karol Lewandowski [Fri, 7 Dec 2018 10:02:24 +0000 (11:02 +0100)]
crash-stack: Fix format specifier

Change-Id: Ifdc4a229275b866f5718f0779b1a9cba01d7b1ea

5 years agoMake disk-usage functions use off_t 37/194837/2
Karol Lewandowski [Fri, 7 Dec 2018 10:02:06 +0000 (11:02 +0100)]
Make disk-usage functions use off_t

The off_t is the same type that stat(2) uses and it's widest type
that can actually hold information real disk usage.

Change-Id: Id4b5d1160bdecafb065cf6792274c255619817fc

5 years agocrash-manager: Do not force system to wait for crash-popup to complete 46/193646/5
Karol Lewandowski [Thu, 22 Nov 2018 19:34:17 +0000 (20:34 +0100)]
crash-manager: Do not force system to wait for crash-popup to complete

Calling crash-popup is synchronous, meaning that call has to complete
for crash-manager to complete, releasing core pipe descriptor - which
allows another crash to be handled.

This commit releases the core pipe descriptor allowing another crash
to be handled before popup is shown.

Change-Id: Iea08efc6318960ee43bb5494eaff42636529ec17

5 years agoRelease 5.5.3 27/193727/1 submit/tizen/20181123.160941
Karol Lewandowski [Fri, 23 Nov 2018 16:04:11 +0000 (17:04 +0100)]
Release 5.5.3

This release brings full suite of system tests, verified on TM1, Odroid,
32-bit emulator.

Addtionaly, this commit sets fs.suid_dumpable=2 sysctl to ensure all
processes are subject to core dumping.

Change-Id: I0d7142a42ef580ce1cb11c9d246c267438fb299c

5 years agoMerge "Add system tests" into tizen
Karol Lewandowski [Fri, 23 Nov 2018 16:01:27 +0000 (16:01 +0000)]
Merge "Add system tests" into tizen

5 years agoDrop unused service files 44/193644/2
Karol Lewandowski [Thu, 22 Nov 2018 17:49:36 +0000 (18:49 +0100)]
Drop unused service files

This commit removes unused service files originally disabled in
commit 9ef91ff21 ("Fix bugs [..] - Do not install unused services:
tizen-debug-on/off").

Change-Id: Icb41586586106a427524f1c8eddfdedc23d53f93

5 years agosysctl: Set fs.suid_dumpable=2 for release builds 43/193643/2
Karol Lewandowski [Thu, 22 Nov 2018 17:44:03 +0000 (18:44 +0100)]
sysctl: Set fs.suid_dumpable=2 for release builds

This commit enables dumping all processes - including those considered
by kernel as "suid".

Process is considered "suid" not only when it does (among other)
setuid/setgid but also when Capabilities are defined in systemd
unit.  With suid_dumpable=0 crash of such "suid" processes would
not trigger execution of crash-worker by the kernel.

Please see suid_dumpable description in proc(5) for full explanation
what kernel considers "suid".

Change-Id: I067355ba651507b35ef7c8d23245443184b670cf

5 years agoAdd system tests 09/193009/17
Mateusz Moscicki [Mon, 5 Nov 2018 12:46:03 +0000 (13:46 +0100)]
Add system tests

Change-Id: I9db485028d328bcc43e3bc4626c24a7f1a844f53

5 years agoRelease 5.5.2 67/193267/1 accepted/tizen/unified/20181119.153038 submit/tizen/20181116.154004
Karol Lewandowski [Fri, 16 Nov 2018 15:34:31 +0000 (16:34 +0100)]
Release 5.5.2

This version brings one major change - from now on buxton2ctl is used
instead of vconftool to dump the internal database (buxton is the
backend used by vconf anyway).  The reason for this change is
inefficency of vconftool utility, for details see commit 5991e4b
("dump_systemstate: Replace extremely inefficient vconftool with
buxton2ctl").

Minor improvements include:
 - util: Add fsync_path to selectively flush file buffer to disk
 - util: Fix and replace nullvec2str utility function with concatenate()
 - Define _GNU_SOURCE once for whole codebase
 - packaging: Drop unused variables from cmake invocation
 - util: Unify function calling convention to specify destination first
 - util: copy_bytes: Multiple changes

Change-Id: I260c34576783ee0dfa79c9b704939b943dfa0515

5 years agodump_systemstate: Replace extremely inefficient vconftool with buxton2ctl 11/189811/7
Karol Lewandowski [Thu, 20 Sep 2018 19:32:11 +0000 (21:32 +0200)]
dump_systemstate: Replace extremely inefficient vconftool with buxton2ctl

vconftool and buxton2ctl access the same data. vconftool is shell script
which under the hood uses buxton2ctl. However, it does so in very inefficient
manner - to get the keys it calls buxton2ctl once, but to get key values
it calls buxton2ctl for each key.  This causes it to fork

On TM1 target with 548 keys in "db/" this means 548 fork & buxton2ctl execs.
buxton2ctl gets the data from server via socket connection, meaning that
it needs to connect & write request and wait for response.

All of this together sums up to absurd - `buxton2ctl dump system` takes ~50ms,
while `vconftool get db/ -r` takes more than 12seconds - which is roughly
250 times slower!

  sh-3.2# time buxton2ctl dump system >/dev/null
  real    0m0.050s
  user    0m0.040s
  sys     0m0.000s

  sh-3.2# time vconftool get db/ -r >/dev/null
  real    0m12.344s
  user    0m0.560s
  sys     0m1.190s

With this change applied, dump_systemstate invocation time drops from
13seconds to 1.5-2sec (without logs), and from 13 seconds to 3-4secs (with
logs, ie. -k -d -j options).

Change-Id: I0cb042d18e5322d8246bf03ee142117217c83b4c

5 years agoutil: Add fsync_path to selectively flush file buffer to disk 68/192668/5
Karol Lewandowski [Wed, 7 Nov 2018 11:58:19 +0000 (12:58 +0100)]
util: Add fsync_path to selectively flush file buffer to disk

Change-Id: I3cd9169dafff33cdfbaf1c21955c37d38a524fae

5 years agoutil: Fix and replace nullvec2str utility function with concatenate() 47/190547/9
Karol Lewandowski [Tue, 6 Nov 2018 23:21:26 +0000 (00:21 +0100)]
util: Fix and replace nullvec2str utility function with concatenate()

Multiple issues were found and fixed in previously-unused nullvec2str
function, including major problem with possible stack corruption via
long parameters.

This commit completely rewrites the function to dynamically resize the
buffer while appending new parameters to avoid previous problems.

Additionally, name is changed to somewhat more developer friendly name.

Influenced-by: Mateusz Mościcki and Michał Bloch
Change-Id: Ia97e3851bb4b5779a14704098752e3644c487f0b

5 years agoDefine _GNU_SOURCE once for whole codebase 39/190539/7
Karol Lewandowski [Wed, 3 Oct 2018 11:59:18 +0000 (13:59 +0200)]
Define _GNU_SOURCE once for whole codebase

There is no need to repeat this in every file.

Change-Id: Ia788840d819b8d72122296a5e5d64aa2a7c3cb40

5 years agopackaging: Drop unused variables from cmake invocation 38/190538/7
Karol Lewandowski [Wed, 3 Oct 2018 11:40:13 +0000 (13:40 +0200)]
packaging: Drop unused variables from cmake invocation

Ideally, crash-worker codebase should not know about
any of TZ_ vars - as all needed paths should be specified
explicitly from the .spec.

Change-Id: Id80fe0ae5f93940ce49bbe11903723a00f0261f0

5 years agoutil: Unify function calling convention to specify destination first 67/192667/3
Karol Lewandowski [Wed, 7 Nov 2018 11:00:18 +0000 (12:00 +0100)]
util: Unify function calling convention to specify destination first

This commit adjusts signature of copy_file(), move_file() and
dump_file_write_fd() to specify destination first, source second.
This in line with rest of codebase.

Change-Id: I81285cda73d43ff2428ea5daf7ad27676e51ca8a
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
5 years agoutil: copy_bytes: Multiple changes 25/189425/12
Karol Lewandowski [Wed, 3 Oct 2018 11:36:17 +0000 (13:36 +0200)]
util: copy_bytes: Multiple changes

 - Use max possible buffer size for sendfile()

   The fewer we call sendfile() the better (performance)

 - Provide read()/write() fallback when sendfile will
   not work (eg. copying data from pipe to pipe)

 - Add third argument with number of copied bytes. This is
   to avoid mixing error code (negative) with transferred size.

 - Make API available for rest of codebase

Change-Id: If80feb578b01fb715008a20e7c000c5ede9b62a1

5 years agoRelease 5.5.1 37/192437/1
Karol Lewandowski [Mon, 5 Nov 2018 13:02:41 +0000 (14:02 +0100)]
Release 5.5.1

Version bump due to Tizen 5.0 M2 release & corresponding branching
repo to additional tizen_5.0 line.

This version contains one fix for /proc/<PID>/maps parsing (not present
in tizen_5.0).

Change-Id: Ibbfebbd05b54bd81a0c55dafa357720ddfeb71cb

5 years agocrash-stack: Fix a /proc/<pid>/maps file parsing 26/192426/1
Mateusz Moscicki [Mon, 5 Nov 2018 10:39:40 +0000 (11:39 +0100)]
crash-stack: Fix a /proc/<pid>/maps file parsing

Change-Id: If164f3bf5cfaf7eefc68d992d90ff4110b52ca04

6 years agoRelease 5.0.8 03/192203/1 submit/tizen/20181031.134751
Mateusz Moscicki [Wed, 31 Oct 2018 13:04:09 +0000 (14:04 +0100)]
Release 5.0.8

Changes:

- Handle spaces in the crashed app pathname and in the maps file
- Don't interrupt the dump_systemstate if any of subcommands return
  an error

Change-Id: Ifc81df710c4441cbc63b42e719102e50f44b138b

6 years agodump_systemstate: Continue dumping after failure of a subcommand 99/191499/5
Mateusz Moscicki [Wed, 17 Oct 2018 11:23:29 +0000 (13:23 +0200)]
dump_systemstate: Continue dumping after failure of a subcommand

Change-Id: I7c0481984fbb9c04b26f913fb25208b11f9d6869

6 years agoHandle spaces in the crashed app pathname and in the maps file 59/191359/5
Mateusz Moscicki [Mon, 15 Oct 2018 11:43:15 +0000 (13:43 +0200)]
Handle spaces in the crashed app pathname and in the maps file

Change-Id: I98ff537cab9c37b78dc3f3056a375fd10461b7ea

6 years agoMerge "crash-manager: Do not make temporary copy of crashed process maps" into tizen
Mateusz Mo?cicki [Fri, 19 Oct 2018 15:14:08 +0000 (15:14 +0000)]
Merge "crash-manager: Do not make temporary copy of crashed process maps" into tizen

6 years agoMerge "Do not copy source files, it breaks SCQV process" into tizen
Łukasz Stelmach [Tue, 16 Oct 2018 11:33:07 +0000 (11:33 +0000)]
Merge "Do not copy source files, it breaks SCQV process" into tizen

6 years agocrash-manager: Do not make temporary copy of crashed process maps 62/189862/5
Karol Lewandowski [Wed, 3 Oct 2018 11:14:20 +0000 (13:14 +0200)]
crash-manager: Do not make temporary copy of crashed process maps

It was needed when crash-worker used (now removed) ptrace
-based crash-stack, which woken up crashed process, causing
/proc/<PID>/ entries to disappear.

Change-Id: Iec344e6c3b9d7d12979173dea530684573a0761d

6 years agoRelease 5.0.7 44/190544/1 accepted/tizen/5.0/unified/20181102.021639 accepted/tizen/unified/20181005.012519 submit/tizen/20181003.140929 submit/tizen_5.0/20181101.000004 submit/tmp003/20181003.140912
Karol Lewandowski [Wed, 3 Oct 2018 13:44:20 +0000 (15:44 +0200)]
Release 5.0.7

This release brings one addtional fix for indexing array with negative
index bug.

Change-Id: I9e49379a68f4839256d1df26e42b144b6ed6a708

6 years agoFix: Another instance of indexing array with negative index 43/190543/1
Karol Lewandowski [Wed, 3 Oct 2018 13:43:16 +0000 (15:43 +0200)]
Fix: Another instance of indexing array with negative index

Issue reported by Coverity.

Change-Id: Ida7f3106d650f48d5fff7e976f1bbc0df0fdc308

6 years agoRelease 5.0.6 29/190529/1 submit/tizen/20181003.104223
Karol Lewandowski [Wed, 3 Oct 2018 09:35:46 +0000 (11:35 +0200)]
Release 5.0.6

This change brings one fix and set of assorted cleanups:

 - Fix: Do not index buffer[] with negative index in case of read failure
 - util: Remove unused file_exist()
 - util: Allow functions to be called from c++
 - util: Add nullvec2str
 - util: Remove unused cat_file()
 - util: Dead code removal
 - crash-manager: Use same constant for minicoredumper, crash-stack and zip command timeouts

Change-Id: I46fbdea06ad36f06116751c5f14105350569cad5

6 years agoFix: Do not index buffer[] with negative index in case of read failure 28/190528/1
Karol Lewandowski [Wed, 3 Oct 2018 09:29:30 +0000 (11:29 +0200)]
Fix: Do not index buffer[] with negative index in case of read failure

Issue reported by Coverity.

Change-Id: Ie9cd66d2801770a096bb1849d11c860533508174

6 years agoutil: Remove unused file_exist() 27/190527/1
Karol Lewandowski [Wed, 3 Oct 2018 09:27:57 +0000 (11:27 +0200)]
util: Remove unused file_exist()

Change-Id: I1e20fc6cd55c9685db304a9aa40b58af56df0c00

6 years agoutil: Allow functions to be called from c++ 10/189810/4
Karol Lewandowski [Tue, 25 Sep 2018 11:38:58 +0000 (13:38 +0200)]
util: Allow functions to be called from c++

Change-Id: If4dc6b6e494096713e76a1345ab3753a6914e1c2

6 years agoutil: Add nullvec2str 83/189983/2
Karol Lewandowski [Wed, 3 Oct 2018 09:15:31 +0000 (11:15 +0200)]
util: Add nullvec2str

This function will be used to convert char *arr[] arrays
(like argv[] and envp[]) arrays to simple strings.

Change-Id: I352f2cc35ee5f06f6a9e6bc81b45702ea11f711d

6 years agoutil: Remove unused cat_file() 82/189982/2
Karol Lewandowski [Tue, 25 Sep 2018 11:13:32 +0000 (13:13 +0200)]
util: Remove unused cat_file()

Change-Id: Ie56ce502a4a1d6ca27574bf7f05b0f097079eaa2

6 years agoDo not copy source files, it breaks SCQV process 41/190141/1
Łukasz Stelmach [Thu, 27 Sep 2018 08:01:35 +0000 (10:01 +0200)]
Do not copy source files, it breaks SCQV process

Change-Id: Id9a7c450e67a67c366a937ad4337833f34404a3a
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoutil: Dead code removal 07/189807/1
Karol Lewandowski [Thu, 20 Sep 2018 09:55:38 +0000 (11:55 +0200)]
util: Dead code removal

Change-Id: I42bd0466c365c84b0720291504e10d86cb9859fe

6 years agocrash-manager: Use same constant for minicoredumper, crash-stack and zip command... 23/189423/1
Karol Lewandowski [Fri, 14 Sep 2018 21:42:34 +0000 (23:42 +0200)]
crash-manager: Use same constant for minicoredumper, crash-stack and zip command timeouts

Change-Id: I50d41e850d32cf40ee403f93020db67700002d3c

6 years agoRelease 5.0.5 58/189258/1 accepted/tizen/unified/20180917.041311 submit/tizen/20180914.151908
Mateusz Moscicki [Fri, 14 Sep 2018 14:04:41 +0000 (16:04 +0200)]
Release 5.0.5

Changes from last version:

- Code improvements
- Fixed SVACE and Coverity warnings
- Run zip and crash-stack commands with timeout

Change-Id: I84784e44c9baef654159ab55cb70aeaeaa150b42

6 years agoFix Coverity warnings: #1020601 #1020599 #1020595 #1020587 08/189008/5
Mateusz Moscicki [Wed, 12 Sep 2018 10:36:37 +0000 (12:36 +0200)]
Fix Coverity warnings: #1020601 #1020599 #1020595 #1020587

Change-Id: I6cd513db97ad4f67f259f11e088be3e68c8dc319

6 years agoFix after security review 85/188885/4
Mateusz Moscicki [Mon, 10 Sep 2018 13:41:20 +0000 (15:41 +0200)]
Fix after security review

* File: src/shared/util.c
  Function: write_fd
  Write in function may return EINTR correctly. Function does  not
  support this case correctly. If the interrupt occurs program will not
  dump all data to file. The interrupt may come from child process
  (SIGCHILD).

* File: src/shared/util.c
  Function: fprintf_fd
  You may replace fprintf_fd with standard library function dprintf.

* File: src/shared/util.c
  Functions: dump_file_write_fd, copy_file, cat_file
  Functions don’t support EINTR correctly (write in function write_fd
  may be interrupt). In this functions it is not clear who will generate
  signal to interrupt write call, so this is not security risk now.  You
  may replace loop with standard library function sendfile.

* File: crash-manager.c
  Function: launch_crash_popup
  Memory leak: value conn was allocated but was not deallocated.

* File: crash-manager.c
  Function: prepare_paths
  Invalid strings are stored in crash_crash_path and crash_temp_path.
  Both strings are truncated by 1 byte.

Change-Id: Ie174b5ee043321861912f1b9233f0f6a6afd027e

6 years agoUse dynamic allocated memory instead of fixed-size arrays 22/188522/1
Mateusz Moscicki [Wed, 5 Sep 2018 08:42:58 +0000 (10:42 +0200)]
Use dynamic allocated memory instead of fixed-size arrays

Change-Id: I03e91bf530204de6f03f1db79e2aa9bdd2608f95

6 years agoAdd timeout to the zip command 43/188143/4
Mateusz Moscicki [Fri, 31 Aug 2018 13:40:54 +0000 (15:40 +0200)]
Add timeout to the zip command

Change-Id: I52db6f8ccd1a2103da030c10898ec33c4a9bcc57

6 years agoAdd timeout to run the crash-stack 41/188141/5
Mateusz Moscicki [Fri, 31 Aug 2018 12:04:49 +0000 (14:04 +0200)]
Add timeout to run the crash-stack

In case the crash-stack hangs, the crash-manager will still be able to
create a raport.

Change-Id: I62b3022dc1aec6507821473619c73cf90337643f

6 years agoMerge move_dump_dir() and move_info_file() 27/188127/5
Mateusz Moscicki [Fri, 31 Aug 2018 10:44:13 +0000 (12:44 +0200)]
Merge move_dump_dir() and move_info_file()

Change-Id: I246bf743eefb199577bd00d6b3fd0defa6948eff

6 years agoStop using crash_info struct as a global variable 26/188126/5
Mateusz Moscicki [Fri, 31 Aug 2018 10:07:56 +0000 (12:07 +0200)]
Stop using crash_info struct as a global variable

Change-Id: I1dee72cb7abf29e7ff2bf5bdc4e0852bda1329b1

6 years agoUse parsed command line arguments instead of raw string values 44/188044/6
Mateusz Moscicki [Thu, 30 Aug 2018 11:38:39 +0000 (13:38 +0200)]
Use parsed command line arguments instead of raw string values

Change-Id: I28c9479c2d6cb5d754e7ff3ee37f8cab34235456

6 years agoMerge "Release 5.0.4" into tizen accepted/tizen/unified/20180830.182653 submit/tizen/20180829.134902
Karol Lewandowski [Wed, 29 Aug 2018 13:39:10 +0000 (13:39 +0000)]
Merge "Release 5.0.4" into tizen

6 years agoRelease 5.0.4 19/187919/3
Mateusz Moscicki [Wed, 29 Aug 2018 11:06:11 +0000 (13:06 +0200)]
Release 5.0.4

Changes from last version:

 - crash-stack use the same function to read /proc/<pid>/exe symlink as
   the crash-manager

 - crash-manager: Simplify dump_core error reporting

Change-Id: Id5d65baedcfe73c88e7aadee2cc7aef62c91269c

6 years agoMerge "crash-manager: Simplify dump_core error reporting" into tizen
Mateusz Mo?cicki [Wed, 29 Aug 2018 13:38:28 +0000 (13:38 +0000)]
Merge "crash-manager: Simplify dump_core error reporting" into tizen

6 years agoMove the function to read /proc/<pid>/exe symlink to util.c 18/187918/2
Mateusz Moscicki [Tue, 28 Aug 2018 13:27:30 +0000 (15:27 +0200)]
Move the function to read /proc/<pid>/exe symlink to util.c

Change-Id: Ieb533fb66dd3d06eb5bbc827aa016a308cf892a3

6 years agocrash-manager: Simplify dump_core error reporting 98/187898/2
Karol Lewandowski [Wed, 29 Aug 2018 08:36:21 +0000 (10:36 +0200)]
crash-manager: Simplify dump_core error reporting

Change-Id: If8ff95811e4e5f16cb3a7a2e48dfe34a0bd3b1cb

6 years agoRelease 5.0.3 12/187812/2 submit/tizen/20180828.140302
Mateusz Moscicki [Tue, 28 Aug 2018 12:22:37 +0000 (14:22 +0200)]
Release 5.0.3

This version contains fixes of SVACE warnings

Change-Id: Id51181c8bf839922b83d0d85d3596a414d005ee5

6 years agoFix SVACE warnings 01/187801/2
Mateusz Moscicki [Tue, 28 Aug 2018 10:35:24 +0000 (12:35 +0200)]
Fix SVACE warnings

Warnings:

352484, 352485, 352486, 352488, 352489, 352490, 352491, 352492, 352493,
352494, 352495, 352496, 352497, 352498, 352501, 352502, 352487, 358117,
358162

Change-Id: I205ddaee97836c3146b25bbb380e11464713cb25

6 years agoRelease 5.0.2 76/187476/2 accepted/tizen/unified/20180824.162511 submit/tizen/20180823.142438
Mateusz Moscicki [Thu, 23 Aug 2018 11:54:30 +0000 (13:54 +0200)]
Release 5.0.2

Changes from last version:

 - For INFO report type D-Bus signal has a proper report path

 - Update license (imported tbstack code is BSD-licensed)

 - Move finding TID to crash-manager - fixes support on older kernels

Change-Id: Ie7e038d4740fcd442e5c599c9d22c91a24c2ce74

6 years agoUpdate license information in spec file 75/187475/1
Mateusz Moscicki [Thu, 23 Aug 2018 11:51:11 +0000 (13:51 +0200)]
Update license information in spec file

Change-Id: Iee77a2f8580167eb6e7087465fd820f0fae575a1

6 years agoFix report path for INFO report type 74/187474/1
Mateusz Moscicki [Thu, 23 Aug 2018 10:45:51 +0000 (12:45 +0200)]
Fix report path for INFO report type

Change-Id: I973c452cd08a4ac18d4ad7460b21ceb28d9d6364

6 years agoMove finding TID to crash-manager 57/187457/1
Mateusz Moscicki [Tue, 14 Aug 2018 13:42:02 +0000 (15:42 +0200)]
Move finding TID to crash-manager

Additionally find_crash_tid() returns PID for single-threaded applications,
instead of -1.

Change-Id: Id6fcc652b95bddda954f25cd448f1e090918c231

6 years agoRelease 5.0.1 38/187338/5 submit/tizen/20180822.121814
Karol Lewandowski [Wed, 22 Aug 2018 05:43:14 +0000 (07:43 +0200)]
Release 5.0.1

Major version bump due to versioning scheme change.  Major versions
will now follow major Tizen releases (eg. crash-worker 5 for Tizen 5).

New features:

 - callstack resolver has been rewritten to not use ptrace

   This was required to avoid races during resolve process (kernel
   would wake up ptraced process).

   Consequently, it's now possible to prepare crash report of VIP
   process (whose failure causes system to be rebooted).

 - New-style D-Bus signal ProcessCrashed is now emitted to notify
   about the crash

 - .info-only report type now can be selected via configuration
   option ReportType

 - Crash dump location can be changed by CrashReportPath config
   option

 - Saving core dump (for FULL/.zip reports) can be changed by
   DumpCore option

Change-Id: I91e806d0d516e618802aee7a742120c0281034a1

6 years agoNormalize minicoredumper config variable naming 78/187378/2
Karol Lewandowski [Wed, 22 Aug 2018 10:30:45 +0000 (12:30 +0200)]
Normalize minicoredumper config variable naming

Change-Id: I5669d0d46fc15c8193b5e8ea11d1254838a8dfd1

6 years agoMove crash-manager.conf to /etc 77/187377/2
Karol Lewandowski [Wed, 22 Aug 2018 10:28:48 +0000 (12:28 +0200)]
Move crash-manager.conf to /etc

This commit brings back config to /etc to avoid problems
with config not being available for crashes happening
during bootup (when /opt/ is not mounted yet)

Change-Id: Ib384f1fd28192dd199565d888c59f0a33d4d578d

6 years agoFail early if can not run minicoredumper properly 53/187353/3
Karol Lewandowski [Wed, 22 Aug 2018 07:02:41 +0000 (09:02 +0200)]
Fail early if can not run minicoredumper properly

Minicoredumper is essential for gathering report, so
it does not make much sense to continue when we can't
even pass right parameters (prstatus).

Change-Id: Id7560452110871190f243f7ff61f4e849351a8af

6 years agoRemove unsupported and misleading configuration options 37/187337/4
Karol Lewandowski [Wed, 22 Aug 2018 06:50:42 +0000 (08:50 +0200)]
Remove unsupported and misleading configuration options

 - Remove TIZEN_FEATURE_PTRACE_CALLSTACK option

   Crash report generation method has been reworked
   and does not depend on ptrace anymore.

 - Remove TIZEN_ENABLE_MINICOREDUMPER option

   Minicoredumper is required to dump PRSTATUS, which
   is later used by crash-manager (for D-Bus signal)
   and by crash-stack (for callstack unwinding)

 - Remove TIZEN_ENABLE_COREDUMP option

   crash-pipe does not dump PRSTATUS so can not be
   used as an option (see above).

Consequently, enabling/disabling coredumps has been
moved to configuration file (DumpCore=0/1).

Change-Id: If535acfe7e64fdde0a8b50afd8b3a1f44fda2490

6 years agoMerge changes I5ecf4873,I049952ab into tizen
Karol Lewandowski [Wed, 22 Aug 2018 10:53:19 +0000 (10:53 +0000)]
Merge changes I5ecf4873,I049952ab into tizen

* changes:
  log_dump: dbus: Only root can own org.tizen.system.crash name
  log_dump: Rework service file

6 years agoAdd report types 21/185421/12
Mateusz Moscicki [Fri, 20 Jul 2018 09:00:49 +0000 (11:00 +0200)]
Add report types

Depending on report type we save all zip archive with coredump, logs,
so_info and info file, or just only the *.info file. Report type can be set in
crash-manager.conf:

    [CrashManager]
    ...
    ReportType=INFO
    ...

Available report types:

* INFO - Save *.info file
* FULL - Save coredump, *.log, *.so_info and *info file as a ZIP archive (default)

Change-Id: I486049ac8eb928ebdc6ac513bdeac3c98aa4adcc

6 years agoSplit execute_crash_modules 20/185420/10
Mateusz Moscicki [Fri, 20 Jul 2018 10:58:22 +0000 (12:58 +0200)]
Split execute_crash_modules

Change-Id: Iae6af748786c68dcb45a50dc37275fe12e40d85d

6 years agoAdd ability to set report path in crash-manager.conf 19/185419/10
Mateusz Moscicki [Thu, 19 Jul 2018 07:42:54 +0000 (09:42 +0200)]
Add ability to set report path in crash-manager.conf

To change default report path (/opt/usr/crash/dump/) modify the value in
crash-manager.conf:

    [CrashManager]
    ...
    CrashRootPath=/var/crash
    ...

Change-Id: I39b9bc178e989a1aad5727f5becdee74b1e1b13b

6 years agoAdd DBus signal emitting after report save 65/186565/6
Mateusz Moscicki [Thu, 2 Aug 2018 09:16:56 +0000 (11:16 +0200)]
Add DBus signal emitting after report save

Interface: "org.tizen.system.crash.Crash"
Path: "/org/Tizen/System/Crash/Crash"
Signal: "ProcessCrashed"

Message (signature "sssssiia{sv}"), contains:
* process name
* exe path
* appid
* pkgid
* report path
* PID
* TID
* dictionary a{sv} contains registers values depends on the architecture:

    * for x86:
      * x86.eip

    * for x86_64:
      * x86_64.rip

    * for armv7l:
      * arm.pc
      * arm.lr

    * for aarch64:
      * aarch64.pc
      * aarch64.lr

Change-Id: I081a3f4982e2f0d4b01fd665b4dffcd3bab847f4

6 years agoSave full cmd_line 64/186564/6
Mateusz Moscicki [Fri, 10 Aug 2018 08:41:39 +0000 (10:41 +0200)]
Save full cmd_line

Change-Id: I98ac10c8931a0e1c0b586c6e116279faa6ef9d44

6 years agolog: Enable logging messages to a FILE* instead of dlog 46/186146/18
Łukasz Stelmach [Mon, 6 Aug 2018 12:09:34 +0000 (14:09 +0200)]
log: Enable logging messages to a FILE* instead of dlog

For development purposes it is possible to write log messages to a FILE*
instead of dlog. To do it add the line below before including log.h.

#define LOG_FILE stderr

You may to choose any other FILE* than stderr but you need to make sure
it is available.

Change-Id: I500fd774b95d84b78c8bc46d4274ac1f94947f9c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agocrash-stack: Use dlog-based macros for logging messages 45/186145/18
Łukasz Stelmach [Tue, 7 Aug 2018 13:51:52 +0000 (15:51 +0200)]
crash-stack: Use dlog-based macros for logging messages

Change-Id: I16bbfd1f6437b106e187633ddd00e65bbe74738f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoIntegrate code from tbstack 44/186144/16
Łukasz Stelmach [Tue, 7 Aug 2018 13:54:30 +0000 (15:54 +0200)]
Integrate code from tbstack

Change-Id: I4f9b523b277fb464e60deaccba316ed94c750df9
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoSupport x86 43/186143/3
Łukasz Stelmach [Tue, 7 Aug 2018 11:46:13 +0000 (13:46 +0200)]
Support x86

Change-Id: I6cb87b61072be11341e6956357b05af63a620646
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoSupport Aarch64 42/186142/3
Mateusz Moscicki [Tue, 7 Aug 2018 10:00:17 +0000 (12:00 +0200)]
Support Aarch64

Change-Id: Iad3979f7e5c73da9a35619c5a8a89f8a5257a780
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoSupport arm 41/186141/3
Łukasz Stelmach [Mon, 30 Jul 2018 12:12:42 +0000 (14:12 +0200)]
Support arm

Change-Id: I406030ffac77791b4cceb633d00c6adc60b72357
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agocrash-stack: import tbstack sources 40/186140/3
Łukasz Stelmach [Fri, 27 Jul 2018 11:46:56 +0000 (13:46 +0200)]
crash-stack: import tbstack sources

Import files from tbstack project (commit 06b996baf444450dea117296f3b04fe5ba753222)

The code allows access to a crashed process via process_vm_readv()
(or reading /porc/PID/mem) instead of ptrace(2), which is not permited
for crashed processes.

Change-Id: I202454d03bdf5da6c419c921db839a0647c0ec2c
Origin: https://github.com/tbricks/tbstack/commit/06b996baf444450dea117296f3b04fe5ba753222
Origin: https://github.com/tbricks/tbstack/pull/31/commits/d0c7acfaa269e9183c41d120073aadca68b6f79d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[ Changed Origin & Commit after code has been merged to upstream repository
  Commit: d0c7acfaa269e9183c41d120073aadca68b6f79d -> 06b996baf444450dea117296f3b04fe5ba753222
  Origin: ihttps://github.com/tbricks/tbstack/pull/31/commits/d0c7acfaa269e9183c41d120073aadca68b6f79d -> https://github.com/tbricks/tbstack/commit/06b996baf444450dea117296f3b04fe5ba753222 ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 years agolog_dump: dbus: Only root can own org.tizen.system.crash name 60/186360/2
Karol Lewandowski [Thu, 9 Aug 2018 07:05:56 +0000 (09:05 +0200)]
log_dump: dbus: Only root can own org.tizen.system.crash name

Change-Id: I5ecf48736cd0f0e4786075b766fc697d1a1e399a

6 years agolog_dump: Rework service file 56/186356/2
Karol Lewandowski [Thu, 9 Aug 2018 06:58:38 +0000 (08:58 +0200)]
log_dump: Rework service file

This commit adjusts log_dump systemd service to
provide normal dbus-type unit.

Additionally, unused and erroneous "ENGINEER_MODE"
is removed.

Change-Id: I049952ab19d1e6a0b8ee8319cedb83226037814f

6 years agoRelease 1.2.1 46/185546/1 accepted/tizen/unified/20180801.080129 submit/tizen/20180731.111110
Karol Lewandowski [Tue, 31 Jul 2018 11:07:20 +0000 (13:07 +0200)]
Release 1.2.1

Bugfix release, includes:

  * Fix off-by-one error in generating the so_info file

Change-Id: I4630757714e45db085980f2e002613df5375d9af

6 years agoFix off-by-one error in generating the so_info file 08/185008/2
Mateusz Moscicki [Wed, 25 Jul 2018 07:18:00 +0000 (09:18 +0200)]
Fix off-by-one error in generating the so_info file

Change-Id: I65dba1b2be1237578df5679586f1449d4fa94023

6 years agoRelease 1.2 16/184716/1 submit/tizen/20180720.100756 submit/tizen/20180723.083040
Karol Lewandowski [Fri, 20 Jul 2018 10:01:28 +0000 (12:01 +0200)]
Release 1.2

This release brings following features:

 * rewritten rpm interface - from using rpm command to direct librpm
   usage - this offers considerable speed improvement

 * waiting for /opt (or generally CRASH_ROOT_PATH) to appear -
   useful for crashes occuring early during bootup

Minor fixes/debugging enchancements are provided.

Change-Id: Idb193bebc56c5f8d86fa360de1787cadb6a75583

6 years agoLog message to dlog when wait_for_child returns non-zero value 83/184383/4
Mateusz Moscicki [Tue, 17 Jul 2018 11:57:41 +0000 (13:57 +0200)]
Log message to dlog when wait_for_child returns non-zero value

Change-Id: Ib2b3df0939a13a553b05cc747e5b17a4e5fe580d

6 years agoAdd own implementation of getting rpm packages info 82/184382/4
Mateusz Moscicki [Tue, 17 Jul 2018 11:43:39 +0000 (13:43 +0200)]
Add own implementation of getting rpm packages info

Calling the external rpm command is too slow, especially for binaries
with many shared object dependencies.

Change-Id: I48a86c0a0067bb2d37b7b7a12abae5d611c8b572

6 years agoCopy /proc/<pid>/maps file to temporary directory 81/184381/3
Mateusz Moscicki [Tue, 17 Jul 2018 08:30:31 +0000 (10:30 +0200)]
Copy /proc/<pid>/maps file to temporary directory

To save as much time as possible, we can parse maps file when coredump
is already saved and process is probably cleaned up.

Change-Id: I136d1c462fe2fe9c204deea09b1d0269cee32530

6 years agoAdd checking if CRASH_ROOT_PATH exists 18/183918/4
Mateusz Moscicki [Thu, 14 Jun 2018 11:18:22 +0000 (13:18 +0200)]
Add checking if CRASH_ROOT_PATH exists

When system booting, /opt may not be mounted yet. In this case if any
program will crash, the crash-manager will wait about 60 seconds for
/opt. After this time the the crash report will be lost.

Change-Id: I97e9541262d1a0f9844aa260ac23972f70e27638

6 years agoReturn exit code of the program invoked by run_command_write_fd_timeout() 17/183917/1
Mateusz Moscicki [Mon, 2 Jul 2018 07:02:31 +0000 (09:02 +0200)]
Return exit code of the program invoked by run_command_write_fd_timeout()

Change-Id: Ib7f046aed8ca352463d6ba7559f947e487ad85b8

6 years agoFix reading /proc/<pid>/maps file 95/182995/2 accepted/tizen/unified/20180703.163701 submit/tizen/20180629.144736
Mateusz Moscicki [Fri, 29 Jun 2018 11:31:38 +0000 (13:31 +0200)]
Fix reading /proc/<pid>/maps file

Macro is expanded by preprocessor, but sizeof() is evaluated at compile time.

Change-Id: I4ca20ff703cf89fba2137ec3eb24550d1013fdff

6 years agopackaging: Fix minicoredumper path 92/181892/1 accepted/tizen/unified/20180619.141919 accepted/tizen/unified/20180622.122638 submit/tizen/20180618.153418 submit/tizen/20180621.090427
Karol Lewandowski [Mon, 18 Jun 2018 14:44:01 +0000 (16:44 +0200)]
packaging: Fix minicoredumper path

Change-Id: I5a57f9a3c0272ebed534aee7edd88d2c2f362b89