platform/core/system/faultd.git
7 years agoRemove reason's OID checking during serialization 84/145184/2 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20170829.020549 accepted/tizen/unified/20170822.113016 submit/tizen/20170821.133151 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m2_release
Paweł Szewczyk [Mon, 21 Aug 2017 12:49:11 +0000 (14:49 +0200)]
Remove reason's OID checking during serialization

Serialization function should not care about OIDs, because they depend
on database adapter. Reason's OID being zero does not neccessarily mean
the reason is not valid.

Change-Id: Icd792cf20d08099579735edf1362d16256243b44
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoDrop SMACK privilege from System::Privileged to System 56/144956/2 submit/tizen/20170821.012629
Kunhoon Baik [Fri, 18 Aug 2017 12:50:57 +0000 (21:50 +0900)]
Drop SMACK privilege from System::Privileged to System

1) Faultd does not change Smack Label.
2) "System" Privilege has most read/write/access permission for most objects of Tizen.

Thus, Faultd should be executed as "System" Privilege.

Change-Id: I6a8b73995dc71c4181470700462137877eff7182

7 years agoMerge "Fix creating OIDs for database adapters" into tizen accepted/tizen/unified/20170818.000033 submit/tizen/20170817.142242
Karol Lewandowski [Thu, 17 Aug 2017 13:59:33 +0000 (13:59 +0000)]
Merge "Fix creating OIDs for database adapters" into tizen

7 years agoFix creating OIDs for database adapters 18/144718/1
Paweł Szewczyk [Thu, 17 Aug 2017 13:16:31 +0000 (15:16 +0200)]
Fix creating OIDs for database adapters

Different database adapters could have different oid sizes. This commit
fill unused bytes of oid with zeros.

Change-Id: Ida1ec8bd0223c221d12384acbe6bcb0fb78e0018
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd CFLAGS/LDFLAGS for ASLR 92/144392/1 submit/tizen/20170816.231957
Łukasz Stelmach [Wed, 16 Aug 2017 10:45:03 +0000 (12:45 +0200)]
Add CFLAGS/LDFLAGS for ASLR

Change-Id: I215a8c004194973c1b54688a91fa806ad71802d7
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoAdd unit tests for serialization 07/141207/23
Konrad Kuchciak [Thu, 10 Aug 2017 21:48:24 +0000 (23:48 +0200)]
Add unit tests for serialization

Change-Id: I7a3a22f808b9064ab85bfa1742a0e414539a8758
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
[Put actual test func into helper, remove copy-paste code]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd unit tests for ejdb module 19/143619/6
Konrad Kuchciak [Wed, 9 Aug 2017 12:13:53 +0000 (14:13 +0200)]
Add unit tests for ejdb module

Testing conversion between faultd_object and bson.

Change-Id: I8f57f4cf1ad005b7a6596112beee49ffab47815e
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
[Fix found issues]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoImplement conversion between faultd_object and bson 03/142903/9
Konrad Kuchciak [Mon, 7 Aug 2017 14:28:13 +0000 (16:28 +0200)]
Implement conversion between faultd_object and bson

Change-Id: I341da653910f1458b4bb3557b97a2560591b4c28
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agotests: Fix helpers.c 18/143618/1
Konrad Kuchciak [Thu, 10 Aug 2017 13:13:40 +0000 (15:13 +0200)]
tests: Fix helpers.c

Get rid of warnings related to pointer casting in
uuid_equal_display_error().
Clear memory before generating UUID in generate_oid().
Generate random uuid in generate_uuid().

Change-Id: I0646b1a4a31da23dbca5411ab659f67c3fca8333
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agotests: Add assert functions for missing types 40/143340/4
Konrad Kuchciak [Wed, 9 Aug 2017 09:36:52 +0000 (11:36 +0200)]
tests: Add assert functions for missing types

Change-Id: I6072eca75ba12172d7a7effb379c1e9dc9929492
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agotests: Add memory assert in generate_string() 39/143339/3
Konrad Kuchciak [Wed, 9 Aug 2017 09:36:28 +0000 (11:36 +0200)]
tests: Add memory assert in generate_string()

Change-Id: Id95e63e76725e0a09a0689eb049b54236d7f2485
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agoAdd faultd_object_get_oid function 38/143338/1
Konrad Kuchciak [Wed, 9 Aug 2017 09:21:58 +0000 (11:21 +0200)]
Add faultd_object_get_oid function

Change-Id: I371c29be8fc2eff0021e048f811eb8896d394eeb

7 years agoFix serialization/deserialization issues 25/141425/4
Konrad Kuchciak [Mon, 31 Jul 2017 09:22:40 +0000 (11:22 +0200)]
Fix serialization/deserialization issues

Change-Id: Id51a70f7b73c114ae28fbc4740b4275932060569
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agotests: Fix TEST_ENTRY_POINT() macro 06/142906/1
Krzysztof Opasiak [Mon, 7 Aug 2017 18:33:30 +0000 (20:33 +0200)]
tests: Fix TEST_ENTRY_POINT() macro

Fix couple of issues:
- remove ptr variable from release builds
- Fix module name used in macro
- Add other macros to help calling this function from test code

Change-Id: If7b35ed4920e1f25121288146df84f8f2946ffb2
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoFix memory leak in faultd_object_new unit test 75/142575/1
Konrad Kuchciak [Fri, 4 Aug 2017 09:43:36 +0000 (11:43 +0200)]
Fix memory leak in faultd_object_new unit test

Change-Id: Iffb32933e15aedfe6ce943f43e0fcc7e7adeddf8
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agotizen: Disable restarting display-manager.service 91/138991/5
Karol Lewandowski [Mon, 17 Jul 2017 13:52:58 +0000 (15:52 +0200)]
tizen: Disable restarting display-manager.service

display-manager is VIP, meaning its failure has to cause
system reboot.  However, current faultd logic waits for
service to enter failed state before system gets restarted.

Without this patch display-manager never enters failed state
as systemd does not place restartable services in failed state
unless it reaches JobTimeoutSec+StartLimitBurst limits.

This patch disables restart logic in display-manager for above
reason.

Change-Id: I945601caf2b31f0103b09e0d271919b5807e3d6d
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
7 years agopackaging: Disable ejdb module 04/141204/3
Karol Lewandowski [Fri, 28 Jul 2017 12:20:01 +0000 (14:20 +0200)]
packaging: Disable ejdb module

For initial deployment - VIP handling - database support
is not needed.  Compiling-out ejdb support reduces faultd
size by few kb, but more importantly it and drops libejdb.so
library dependency - saving up to 1.3MB of storage.

   text    data     bss     dec     hex filename
  56046    3184     216   59446    e836 db-ejdb/usr/sbin/faultd
  49744    2872     216   52832    ce60 db-nop/usr/sbin/faultd

Change-Id: Ie3bca2f1416b75cd249f138942de92f5632add29
[Rebase onto current HEAD]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoMerge changes Id8957cb4,Iac6be95a into tizen
Krzysztof Opasiak [Thu, 3 Aug 2017 14:53:06 +0000 (14:53 +0000)]
Merge changes Id8957cb4,Iac6be95a into tizen

* changes:
  Drop bson code from core
  Make database backends disableable

7 years agoDisable all modules except for those required for VIP handling 88/141188/2
Karol Lewandowski [Fri, 28 Jul 2017 10:27:57 +0000 (12:27 +0200)]
Disable all modules except for those required for VIP handling

For initial deployment only VIP handling is required, meaning
following modules are left enabled:

 - systemd & startup listeners (for detecting service failures),
 - vip decision maker (triggers system_reboot action)
 - system_reboot action

Disabling rest of modules gives about 20% of .text:

   text    data     bss     dec     hex filename
  63618    5176     208   69002   10d8a before/usr/sbin/faultd
  52423    3248     208   55879    da47 after/usr/sbin/faultd

Change-Id: I49b4d5a0fa605ca0469baef59e7c97078974a550

7 years agoDrop bson code from core 03/141203/2
Karol Lewandowski [Fri, 28 Jul 2017 12:13:09 +0000 (14:13 +0200)]
Drop bson code from core

This commit will cause faultd to be linked to libejdb only
when ejdb module is enabled.

Change-Id: Id8957cb4e95ce7ea48079d53aaad31bceda2cf12
[Rebase to current HEAD]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoMake database backends disableable 02/141202/2
Karol Lewandowski [Fri, 28 Jul 2017 11:53:01 +0000 (13:53 +0200)]
Make database backends disableable

Default to ejdb, if not specified.

Change-Id: Iac6be95a7653ee79802122d80f3c9261ed9ffdfe

7 years agoAdd unit tests for faultd_object type 84/140584/17
Konrad Kuchciak [Tue, 25 Jul 2017 11:54:42 +0000 (13:54 +0200)]
Add unit tests for faultd_object type

Change-Id: I68b144b475979b238dd7f61c2df3dd715506bad6
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
[Update test to changes in implementation]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd helper sources for unit tests 08/140808/11
Konrad Kuchciak [Wed, 26 Jul 2017 11:07:06 +0000 (13:07 +0200)]
Add helper sources for unit tests

Change-Id: Ie9ebf2ae5bae6e33fde763792e26f416d6834f51
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
[Fix string generation]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoMake database abstraction layer not depend on ejdb 35/139335/12
Paweł Szewczyk [Tue, 1 Aug 2017 17:28:52 +0000 (19:28 +0200)]
Make database abstraction layer not depend on ejdb

This commit introduces new abstraction layer for databases. Database
logic is separated into independent modules, leaving in core only
generic code.

Change-Id: I6291628b31f96df8d8acae77d659a9da733f2f36
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Minor fixes]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd new interface for storing json-like objects 34/139334/11
Paweł Szewczyk [Wed, 19 Jul 2017 14:09:41 +0000 (16:09 +0200)]
Add new interface for storing json-like objects

Change-Id: Ia55546087931d537580020fc1ea6cf36e39a08b3
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Use generic functions instead of copy-paste code]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoAdd feature to enable specified modules at build time. 11/139811/6
Konrad Kuchciak [Thu, 20 Jul 2017 12:06:41 +0000 (14:06 +0200)]
Add feature to enable specified modules at build time.

Change-Id: If40c344ef163e4855fa867cd2ed521516630295f

7 years agoAlign faultd_bson_get_timespec function to fit convention used in EJDB. 24/138924/4
Konrad Kuchciak [Thu, 13 Jul 2017 15:24:33 +0000 (17:24 +0200)]
Align faultd_bson_get_timespec function to fit convention used in EJDB.

Change-Id: I20549539cb05d84c67c742a9de3ae678db88c412

7 years agoFIX: build should fail if any of the tests fail, not only last. 22/138922/4
Konrad Kuchciak [Fri, 14 Jul 2017 07:36:02 +0000 (09:36 +0200)]
FIX: build should fail if any of the tests fail, not only last.

Change-Id: Ia7265b29bce8bc1d99837ba0242c081208e2c7f9

7 years agoSome POC of faultd test framework 86/134286/7
Krzysztof Opasiak [Thu, 15 Jun 2017 22:25:10 +0000 (00:25 +0200)]
Some POC of faultd test framework

Change-Id: Ib9b8f8bca49b0dc546287aec1dedecc9e149c4b2
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoImplement basic recovery mechanism 42/136442/5
Paweł Szewczyk [Thu, 29 Jun 2017 12:31:29 +0000 (14:31 +0200)]
Implement basic recovery mechanism

Change-Id: I26faf1621ab8e09b6d756d8131f7e55c21e125d5
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoImplement deserialisation of resource_violation_event 88/132988/6
Łukasz Stelmach [Thu, 8 Jun 2017 12:59:50 +0000 (14:59 +0200)]
Implement deserialisation of resource_violation_event

Change-Id: Iac3cee29e78a1099443e29481a603ef624e5159f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoImplement deserialisation of service_failed_event 70/132970/10
Łukasz Stelmach [Fri, 2 Jun 2017 14:45:35 +0000 (16:45 +0200)]
Implement deserialisation of service_failed_event

Allocate service_failed_event and fill it with data loaded from the
database.

Change-Id: Ib3d82e92e6e3c21cc37859aaef443b9b991c06e5
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[ Remove BSON_BIN_UUID_OLD due to compilation error with new EJDB
version. ]
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
7 years agoSerialise OID of the event being the reason for the decision 93/135293/4
Łukasz Stelmach [Wed, 21 Jun 2017 13:35:52 +0000 (15:35 +0200)]
Serialise OID of the event being the reason for the decision

Change-Id: I12969364083f93b5c164871da50f3ba1f9ccc806
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoAdd command line help 70/135470/9
Paweł Szewczyk [Thu, 22 Jun 2017 11:08:04 +0000 (13:08 +0200)]
Add command line help

Change-Id: I33caa8cd478e7a413ad412a3cf12851944443bb4
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd faultd configuration 30/133530/11
Paweł Szewczyk [Tue, 11 Jul 2017 13:11:28 +0000 (15:11 +0200)]
Add faultd configuration

Includes configuration parsing.

Change-Id: I94ab44a652635ac36a9ada4ddf4e07ba1e712de8
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd action executed event 78/137178/2
Krzysztof Opasiak [Tue, 4 Jul 2017 15:05:52 +0000 (17:05 +0200)]
Add action executed event

This event should be generated after each action execution
this allows to store action log into data base using our
generic framework.

Add also dummy handler for this event type to avoid some logs
about unhandled event.

Change-Id: If18b2bc7692ef136f6e952fd59350940e021fba5
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
7 years agoStart faultd on boot 67/135467/3
Łukasz Stelmach [Thu, 22 Jun 2017 10:36:40 +0000 (12:36 +0200)]
Start faultd on boot

Change-Id: Iacc1b0d70aed33ba21ea130573104ba3f8c4b306
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoSave faultd database under /var/db/faultd 78/135478/3
Łukasz Stelmach [Thu, 22 Jun 2017 12:25:50 +0000 (14:25 +0200)]
Save faultd database under /var/db/faultd

Change-Id: I77fe25d835ee4cf7677a9cde58ac72ed71604453
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoDisable audit-listener module in service file 76/135476/1 accepted/tizen/4.0/unified/20170816.012044 accepted/tizen/unified/20170629.085835 submit/tizen/20170622.134850 submit/tizen_4.0/20170811.094300
Paweł Szewczyk [Thu, 22 Jun 2017 12:12:26 +0000 (14:12 +0200)]
Disable audit-listener module in service file

Change-Id: I3a336341294de2bf511983d318d7bb938e70ceb0
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoDisable action modules 56/135456/1 accepted/tizen/unified/20170629.085808 submit/tizen/20170622.101818
Łukasz Stelmach [Thu, 22 Jun 2017 10:10:43 +0000 (12:10 +0200)]
Disable action modules

Deploy faultd to Mobile and Wearable images with actions disabled to
prevent regressions.

Change-Id: I5ddf26143ad3eb804575e4d0c7eeb3949725075e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoAdd no-action command line option 98/135298/2
Paweł Szewczyk [Wed, 21 Jun 2017 16:01:40 +0000 (18:01 +0200)]
Add no-action command line option

Also adds a possibility to disable any module category.

Change-Id: I82a24f6e4594a0946ce4b796cedbb59da0b722ad
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd disable-module command line option 96/135296/2
Paweł Szewczyk [Wed, 21 Jun 2017 15:35:53 +0000 (17:35 +0200)]
Add disable-module command line option

Change-Id: I396c93df20017f27b305b0eae23e0cfd0c834caf
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoInstall configuration files in Makefile instead of spec 94/135294/2
Łukasz Stelmach [Wed, 21 Jun 2017 14:56:10 +0000 (16:56 +0200)]
Install configuration files in Makefile instead of spec

Change-Id: Ib3c754f692965ab2e8c02eded74f35fb866d709f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
7 years agoUse private bus provided by systemd 27/131527/7
Paweł Szewczyk [Wed, 7 Jun 2017 13:24:55 +0000 (15:24 +0200)]
Use private bus provided by systemd

Change-Id: I74a141d484002054b7a7a4ec72b0bacaa9e5f6f7
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoImplement last boot id retrieval from db 13/130513/7
Paweł Szewczyk [Mon, 22 May 2017 13:51:48 +0000 (15:51 +0200)]
Implement last boot id retrieval from db

Change-Id: I84d8baa64df118855aa74afb54bcf28b4fec3afa
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agodatabase: Add retrieval function 12/130512/7
Paweł Szewczyk [Mon, 22 May 2017 13:51:52 +0000 (15:51 +0200)]
database: Add retrieval function

Change-Id: I701707829c2308fbdb971d1b533ded81a81a07f8
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd 'system booted' event 11/130511/7
Paweł Szewczyk [Mon, 22 May 2017 11:24:14 +0000 (13:24 +0200)]
Add 'system booted' event

Event is generated based on boot id stored in database. This commit is
based on stub implementation of last boot id retrieval from db.

Change-Id: I59c22fbae6eeebda9de83e7905aed478711cc655
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoAdd faultd startup listener and 'faultd started' event 10/130510/5
Paweł Szewczyk [Mon, 22 May 2017 15:07:19 +0000 (17:07 +0200)]
Add faultd startup listener and 'faultd started' event

Change-Id: I7038132bdeb5337dfdd787acc812cce5fa26176b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
7 years agoFix test entry point declaration 22/134422/1
Łukasz Stelmach [Fri, 16 Jun 2017 09:04:57 +0000 (11:04 +0200)]
Fix test entry point declaration

Change-Id: I4930178d3bba1ce70e8afe9ee8333e6078e84c21

8 years agoAdd the option to enable testing code 05/134105/2
Łukasz Stelmach [Wed, 14 Jun 2017 14:30:20 +0000 (16:30 +0200)]
Add the option to enable testing code

Add the option in configure.ac and the macro to define entry points
for testing code.

Change-Id: Icbdc657283b925935861e951123a3b4d4ee55662
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoDerive module module names from file names 04/134104/1
Łukasz Stelmach [Wed, 14 Jun 2017 14:28:09 +0000 (16:28 +0200)]
Derive module module names from file names

Change-Id: I24fa4f6fd69a968b529080f7509926bd0af8b85f
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agocore: service: Add serialisation for service_type and recovery_unit 18/133818/1
Łukasz Stelmach [Mon, 12 Jun 2017 15:14:01 +0000 (17:14 +0200)]
core: service: Add serialisation for service_type and recovery_unit

Change-Id: I174617c69f5a69e3f7bb3f74d8d1a147fdf7565e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agodatabase: implement database_load() 71/131171/12
Łukasz Stelmach [Thu, 25 May 2017 15:38:45 +0000 (17:38 +0200)]
database: implement database_load()

Change-Id: Ieb99efe60e1de90ee2103843dcae0ff14ea96104

8 years agoUse bson instead of void * for passing action data 09/132009/7
Krzysztof Opasiak [Wed, 31 May 2017 17:38:38 +0000 (19:38 +0200)]
Use bson instead of void * for passing action data

Change-Id: I43de8f7d1162a5f6824ca404add341b201bbf2e5
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers to fill bson with data required for given action 08/132008/7
Krzysztof Opasiak [Mon, 5 Jun 2017 17:01:12 +0000 (19:01 +0200)]
Add helpers to fill bson with data required for given action

Change-Id: I9ffd9ff03afa054398b571b18e3694d1f3a093a8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers for bson manipulation 07/132007/7
Krzysztof Opasiak [Wed, 31 May 2017 10:32:10 +0000 (12:32 +0200)]
Add helpers for bson manipulation

Change-Id: Iad2cefd42c3322a7d7d9a4fd66f3f939e88d87c7
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd decision maker to handle all standard services 66/131366/7
Krzysztof Opasiak [Fri, 26 May 2017 15:04:37 +0000 (17:04 +0200)]
Add decision maker to handle all standard services

For now we always cleanup and restart service.
In future we should check the history and reboot platform
after 3 failures of some service.

Change-Id: I76562af73d65ec350f8bd34a8b96545a11e5e1ac
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoMerge "Serialise events to bson format" into tizen
Krzysztof Opasiak [Mon, 5 Jun 2017 16:43:11 +0000 (16:43 +0000)]
Merge "Serialise events to bson format" into tizen

8 years agoMerge "core: Create database adapter module" into tizen
Krzysztof Opasiak [Mon, 5 Jun 2017 16:40:13 +0000 (16:40 +0000)]
Merge "core: Create database adapter module" into tizen

8 years agoAdd VIP service decision maker 36/130536/6
Krzysztof Opasiak [Mon, 22 May 2017 16:49:25 +0000 (18:49 +0200)]
Add VIP service decision maker

Add a decision maker which will reboot the system if VIP
service has entered a failed state

Change-Id: I05bc657bb48b7ba826da922b8d8f6cc1a72a2846
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agodm: rv_dm: Request platform reboot if VIP service has a resource leak 84/130484/8
Krzysztof Opasiak [Fri, 19 May 2017 17:27:36 +0000 (19:27 +0200)]
dm: rv_dm: Request platform reboot if VIP service has a resource leak

Change-Id: Ia6608b7939eadea4a5991f21af5b556277aff0d0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd some helper for service type checking 83/130483/6
Krzysztof Opasiak [Fri, 19 May 2017 17:25:25 +0000 (19:25 +0200)]
Add some helper for service type checking

Change-Id: If11034bedd999d52f0dd0f96627c96109b0d66d8
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd faultd config files for test services 85/130485/7
Krzysztof Opasiak [Mon, 22 May 2017 08:54:24 +0000 (10:54 +0200)]
Add faultd config files for test services

Change-Id: Id5def3bed1bdb8804ffebdfd5f942246663319c7
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoSerialise events to bson format 64/130264/9
Łukasz Stelmach [Fri, 19 May 2017 15:00:16 +0000 (17:00 +0200)]
Serialise events to bson format

Change-Id: Iebe856156ce6e65e3edcaf79952a633d25a1ea6d
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agocore: Create database adapter module 63/130263/8
Łukasz Stelmach [Mon, 22 May 2017 10:57:32 +0000 (12:57 +0200)]
core: Create database adapter module

Change-Id: I5a77674ae87defab22a8925b49f4db7f54d97241
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoAdd configuration for currently customized services 63/131163/3
Paweł Szewczyk [Thu, 25 May 2017 13:47:45 +0000 (15:47 +0200)]
Add configuration for currently customized services

Change-Id: I1bee7131990570dd7dc446c9f86072448b5788b0
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoFix copyright notices 35/130735/3
Łukasz Stelmach [Tue, 23 May 2017 12:16:47 +0000 (14:16 +0200)]
Fix copyright notices

Change-Id: I4b38c66de2d478015b5256294d55ab36cbaf9595
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoDefine _GNU_SOURCE globally in CFLAGS 34/130734/3
Łukasz Stelmach [Tue, 23 May 2017 12:03:25 +0000 (14:03 +0200)]
Define _GNU_SOURCE globally in CFLAGS

Change-Id: I0147ac08c961987e9d1ce49b87091955a5e8a35c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoservice: Add service-related configuration parsing 57/129957/13
Paweł Szewczyk [Fri, 19 May 2017 09:04:25 +0000 (11:04 +0200)]
service: Add service-related configuration parsing

Introduce service configuration files stored in /etc/faultd/config.d.

Config files are stored in json format, so this adds dependency on
json-c library.

Change-Id: Ibec741d67a563e8a1fb4037459e3acc00081c62c
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[Fix memory mngnt and split to smaller functions]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoProvide serialising function for struct timespec 58/130258/2
Łukasz Stelmach [Mon, 15 May 2017 08:44:58 +0000 (10:44 +0200)]
Provide serialising function for struct timespec

Provide serialising function for struct timespec as well as macro for
generating such functions.

Change-Id: Ib27477b2be0ab9e6f38f5d1fede477426acb7e80
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agoZero allocated event structures 65/130265/2
Łukasz Stelmach [Mon, 22 May 2017 10:04:10 +0000 (12:04 +0200)]
Zero allocated event structures

Change-Id: Ic85cf158cb4187400b5ef0a203c36e147ef88de2
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
8 years agotests: update db test programme 61/130261/2
Łukasz Stelmach [Wed, 17 May 2017 13:25:07 +0000 (15:25 +0200)]
tests: update db test programme

Change-Id: I66d7dda70e037651f5edd299c3f108f684ab1021
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agotests: Install the failing test service 59/130259/2
Łukasz Stelmach [Wed, 17 May 2017 13:16:55 +0000 (15:16 +0200)]
tests: Install the failing test service

Rename also leaker test service to faultd-leaker.

Change-Id: I32bb0502e390d5f555d2695ac539cb444e4c9dae
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoReport only failed services in the systemd listener 60/130260/2
Łukasz Stelmach [Wed, 17 May 2017 13:22:27 +0000 (15:22 +0200)]
Report only failed services in the systemd listener

Change-Id: Iec50c0c94e8896eec07cd280bd0cf68c147f6815
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agomodule: Add parameter to pass configuration to modules 62/130262/2
Łukasz Stelmach [Thu, 18 May 2017 14:14:32 +0000 (16:14 +0200)]
module: Add parameter to pass configuration to modules

Change-Id: I728ff341d16bfce9af0b3b3293c8dd1ec6603137
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
[Rebase onto current head]
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoservice: Change service.name to service.dbus_path 56/129956/3
Paweł Szewczyk [Thu, 18 May 2017 12:03:43 +0000 (14:03 +0200)]
service: Change service.name to service.dbus_path

What we called 'name' was actually a dbus path, so 'dbus_path' is a better
name for it.

Change-Id: If85c82e6f9dde703e6c2946e01cdc68e0db5ca7b
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
8 years agocore: service: Use defines instead of hard coded strings 86/129986/1
Krzysztof Opasiak [Thu, 18 May 2017 17:22:25 +0000 (19:22 +0200)]
core: service: Use defines instead of hard coded strings

Change-Id: I5f0726b6d6aa71c17d66dd663819e44e7ddbe807
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: fix: unreference bus and error when it's not needed 85/129985/1
Krzysztof Opasiak [Thu, 18 May 2017 17:21:53 +0000 (19:21 +0200)]
listeners: systemd: fix: unreference bus and error when it's not needed

Change-Id: Ia88f074aa935745f06af695e08c1586a21751b1b
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd default implementation of reboot to recovery action 11/129711/3
Krzysztof Opasiak [Wed, 17 May 2017 20:49:22 +0000 (22:49 +0200)]
Add default implementation of reboot to recovery action

For now it just adds some dummy parameter which has to be
substituted with real parameter name.

Change-Id: Id85abecc785234bac3e916d6139b224ca49e6def
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd default implementation of system reboot action 10/129710/3
Krzysztof Opasiak [Wed, 17 May 2017 20:48:45 +0000 (22:48 +0200)]
Add default implementation of system reboot action

Change-Id: Ib6c0f18dc7037bf1b0bc5259bfad023ec00ea330
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd service recovery action 09/129709/2
Krzysztof Opasiak [Wed, 17 May 2017 20:48:19 +0000 (22:48 +0200)]
Add service recovery action

For now it's only copy-paste of service restart.
Has to be updated in a future.

Change-Id: I5f13b4f6b1b2c9e62752bb598b51bb1d39826055
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoMake tests/leaker a valid systemd service 13/129513/4
Krzysztof Opasiak [Tue, 16 May 2017 15:36:43 +0000 (17:36 +0200)]
Make tests/leaker a valid systemd service

Change-Id: I572e206454a92ff9bcd828f2f9977b5458b2c5c3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd service restart action implementation 12/129512/3
Krzysztof Opasiak [Tue, 16 May 2017 11:08:44 +0000 (13:08 +0200)]
Add service restart action implementation

Change-Id: If82d9d6e4083504493f945a7bc5c309e49cbfac4
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd helpers and defines for action implementation 11/129511/3
Krzysztof Opasiak [Tue, 16 May 2017 11:07:17 +0000 (13:07 +0200)]
Add helpers and defines for action implementation

Change-Id: Ie0fdc5a965ca9973acff67ac6c6db01604d88aa3
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd action execution framework 53/129253/3
Krzysztof Opasiak [Mon, 15 May 2017 18:56:02 +0000 (20:56 +0200)]
Add action execution framework

This framework is implemented as event handler which handles all
decision made events. Currently it just iterates through the list of
registered builtin action looking for a suitable action to execute.
If action has not been found it just simply fails with error log
and drops the event.

Change-Id: Ib7f36b4b5ce523a78f72ad388611ebfdaba6a2ee
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd dedicated module type for action implementations 52/129252/2
Krzysztof Opasiak [Mon, 15 May 2017 18:53:40 +0000 (20:53 +0200)]
Add dedicated module type for action implementations

Action implementations has to be initialized after action
executor but before decision makers. To acheve this let's
add a new module type in between.

Change-Id: I786f88e3bd24c739ee3f8d6b3a32ddb903854346
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agocore: event_processor: Add missing break in list iteration 10/129510/1
Krzysztof Opasiak [Tue, 16 May 2017 17:08:13 +0000 (19:08 +0200)]
core: event_processor: Add missing break in list iteration

When we find handler for particular event we should stop list
iteration. Otherwise we may get a NULL pointer dereference.

Change-Id: I33022ea84d8e9e5b0a71cf53f9ad4adb006afb3e
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: nqueue: Set fd to -1 after closing eventfd 09/129509/1
Krzysztof Opasiak [Tue, 16 May 2017 19:26:46 +0000 (21:26 +0200)]
util: nqueue: Set fd to -1 after closing eventfd

Unexpected closing of eventfd may be very hard to debug as kernel may
reuse just closed fd number. To avoid queuing new element to queue
with closed eventfd let's invalidate fd in nqueue_cleanup().

Change-Id: I3e9328dfd713fc29d2adbed68dd1a1b35770e6a9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: queue: use list_del_init() instead of list_del() for pop() 08/129508/1
Krzysztof Opasiak [Tue, 16 May 2017 18:21:00 +0000 (20:21 +0200)]
util: queue: use list_del_init() instead of list_del() for pop()

Let's use list_del_init() instead of list_del() for queue_pop()
to avoid putting queue element in inconsistent state.

Change-Id: I68f78d6d22315e9f3e716589e70175b471672ebc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoutil: log: fflush() stderr after each log line 07/129507/1
Krzysztof Opasiak [Tue, 16 May 2017 17:36:35 +0000 (19:36 +0200)]
util: log: fflush() stderr after each log line

Change-Id: Ifaff8c9718edaa54db2a5c051404f0b6bc1490b1
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: Fix typo in log message 06/129506/1
Krzysztof Opasiak [Tue, 16 May 2017 11:08:04 +0000 (13:08 +0200)]
listeners: systemd: Fix typo in log message

Change-Id: Ic5cc188d158bc6ef2d967debef8e7cb5b6874efb
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agolisteners: systemd: Fix printf() format for uint64_t 51/129251/1
Krzysztof Opasiak [Mon, 15 May 2017 19:18:30 +0000 (21:18 +0200)]
listeners: systemd: Fix printf() format for uint64_t

Change-Id: I7a9ae8e51ef6a97632bdf43790475c18586b3a7a
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoUse bson as the event serialisation format sandbox/kopasiak/rebased_with_coding_style
Łukasz Stelmach [Tue, 9 May 2017 10:57:04 +0000 (12:57 +0200)]
Use bson as the event serialisation format

As of this commit faultd depends on ejdb package.

8 years agoAdd dummy serialization function for events
Krzysztof Opasiak [Wed, 10 May 2017 18:37:44 +0000 (20:37 +0200)]
Add dummy serialization function for events

8 years agoRecord boot_id in events
Krzysztof Opasiak [Wed, 10 May 2017 18:34:36 +0000 (20:34 +0200)]
Record boot_id in events

8 years agoChange naming convention of internal event function
Krzysztof Opasiak [Wed, 10 May 2017 18:33:38 +0000 (20:33 +0200)]
Change naming convention of internal event function

Change the naming convention by adding "_internal" suffix to functions
called by subclasses.

8 years agoAdd program to compare ejdb and sqlite performance
Łukasz Stelmach [Tue, 9 May 2017 09:50:15 +0000 (11:50 +0200)]
Add program to compare ejdb and sqlite performance

8 years agoAdd listener to collect events propagated by systemd via dbus
Łukasz Stelmach [Tue, 9 May 2017 09:49:46 +0000 (11:49 +0200)]
Add listener to collect events propagated by systemd via dbus

This listener subscribes to DBUS signals generated by systemd
to catch services which entered a failed state.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd entity to represent service failure
Krzysztof Opasiak [Tue, 9 May 2017 09:44:02 +0000 (11:44 +0200)]
Add entity to represent service failure

This type of event should be generated by a listener
when it detects that some service entered a failed state.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
8 years agoAdd a decision maker to restart a service when it leaks resources
Krzysztof Opasiak [Tue, 9 May 2017 09:42:17 +0000 (11:42 +0200)]
Add a decision maker to restart a service when it leaks resources

This is a very simple decision maker which always restarts
a service if it's leaking resources.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>