platform/upstream/corewatcher.git
10 years agoresetting manifest requested domain to floor 74/4674/1 accepted/tizen/ivi/genivi accepted/tizen/ivi/stable accepted/tizen_3.0.2014.q3_common accepted/tizen_3.0.m14.3_ivi accepted/tizen_generic tizen_3.0.2014.q3_common tizen_3.0.m14.2_ivi tizen_3.0.m14.3_ivi tizen_ivi_genivi accepted/tizen/20130710.220956 accepted/tizen/20130912.141946 accepted/tizen/20130912.192212 accepted/tizen/20130912.200313 accepted/tizen/ivi/genivi/20140131.020201 ivi_oct_m2 submit/tizen/20130710.130001 submit/tizen/20130912.090057 submit/tizen_ivi_genivi/20140131.015914 submit/tizen_mobile/20141120.000000 tizen_3.0.2014.q3_common_release tizen_3.0.m14.2_ivi_release tizen_3.0.m14.3_ivi_release
Alexandru Cornea [Fri, 28 Jun 2013 19:37:33 +0000 (22:37 +0300)]
resetting manifest requested domain to floor

11 years agoSet license using %license accepted/tizen/20130520.095148 submit/tizen/20130511.053734 submit/tizen/20130517.020732
Anas Nashif [Sat, 11 May 2013 05:37:31 +0000 (01:37 -0400)]
Set license using %license

11 years agoSet license according to SPDX list
Anas Nashif [Fri, 10 May 2013 18:02:39 +0000 (14:02 -0400)]
Set license according to SPDX list

11 years agoadd core file limits to the correct directory for systemd accepted/tizen/20130503.223736 accepted/trunk/20130221.003930 submit/tizen/20130503.184513 submit/tizen/20130503.190610 submit/tizen/20130509.173536 submit/trunk/20130213.004407
William Douglas [Wed, 13 Feb 2013 00:03:33 +0000 (16:03 -0800)]
add core file limits to the correct directory for systemd

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoAlways enable .pid core file extension
William Douglas [Tue, 12 Feb 2013 23:09:44 +0000 (15:09 -0800)]
Always enable .pid core file extension

Change-Id: I134d6d06d9cd507ddb25ee40fb48516466c116a7
Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoUpdate hardcoded URL and allow https URLs
William Douglas [Fri, 1 Feb 2013 18:51:22 +0000 (10:51 -0800)]
Update hardcoded URL and allow https URLs

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoModify libcurl options for dealing with SSL and redirects.
William Douglas [Fri, 1 Feb 2013 18:51:09 +0000 (10:51 -0800)]
Modify libcurl options for dealing with SSL and redirects.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoUpdate crash submission URL.
William Douglas [Wed, 23 Jan 2013 17:25:11 +0000 (09:25 -0800)]
Update crash submission URL.

Change submission URL to the produciton crashdb server.

Also add a persistent configuration file for system wide core size limits.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoadd packaging for Tizen accepted/trunk/20130110.014835 submit/trunk/20130110.000443
William Douglas [Wed, 9 Jan 2013 23:48:56 +0000 (15:48 -0800)]
add packaging for Tizen

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agov0.9.11 Tizen rebrand
William Douglas [Tue, 8 Jan 2013 22:36:16 +0000 (14:36 -0800)]
v0.9.11 Tizen rebrand

Add in some Tizen specific changes and catch up on the last of the
nitra updates.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoFix bug with local char variable definition.
William Douglas [Wed, 9 Jan 2013 22:53:03 +0000 (14:53 -0800)]
Fix bug with local char variable definition.

Because we modify path, define a variable so that we get a copy of a
char array rather than a copy of a pointer to a fixed string.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoFix bug with not checking strncmp results.
William Douglas [Wed, 9 Jan 2013 20:14:01 +0000 (12:14 -0800)]
Fix bug with not checking strncmp results.

When not comparing the results of strncmp to 0 we get the opposite of
the expected result, so do the comparison.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoRework how the binary associated with the core file is found.
William Douglas [Tue, 8 Jan 2013 22:25:51 +0000 (14:25 -0800)]
Rework how the binary associated with the core file is found.

Be very simplistic trying to find the application name from the core
file and searching the path for the application.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoUpdate for Tizen-PC
William Douglas [Tue, 8 Jan 2013 22:11:25 +0000 (14:11 -0800)]
Update for Tizen-PC

Switch from nitra based configurations.

Signed-off-by: William Douglas <william.douglas@intel.com>
11 years agoSearch precisely for gdb warnings
Tim Pepper [Tue, 11 Dec 2012 20:57:50 +0000 (12:57 -0800)]
Search precisely for gdb warnings

There are many reasons gdb might print a "warning: " string.  There are two
that I know we care about.  It might additionally make sense to watch for
messages like:

warning: .dynamic section for "/usr/lib64/libsomething.so.42" is not at the
expected address (wrong library or version mismatch?)

warning: Could not load shared library symbols for 2 libraries, e.g.
libsomething.so.42

For those libraries it might make sense to annotate the backtrace so
the crashdb could decrement its quality.  Or in the face of these it
might make sense to simply declare the backtrace as bad.  I'm inclined
to think these traces should be sent, but with as much information as
possible about the apparent quality issues.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAllow Google Chrome cores
Tim Pepper [Thu, 6 Dec 2012 21:00:17 +0000 (13:00 -0800)]
Allow Google Chrome cores

Google Chrome is a shipped software package in Nitra, but it is installed
under /opt/google/chrome/.  This is not in the system path, but should be
allowed.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoCorrect file renaming on skip
Tim Pepper [Thu, 6 Dec 2012 19:12:56 +0000 (11:12 -0800)]
Correct file renaming on skip

With previous commits' refactoring the process_common() function is really
part of just create_report().  Pulling it into one function makes it easier
to handle the skip cases which need to do different renames depending on
whether we're processing or re-processing.  I'd previously used move_core()
for skips, but that really is tailored to the first state transition from
core dumped to core captured by corewatcher to process.  So add a
skip_core() function and use it.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoSkip cores where gdb notes a mismatch between core and executable
Tim Pepper [Thu, 6 Dec 2012 00:44:40 +0000 (16:44 -0800)]
Skip cores where gdb notes a mismatch between core and executable

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd 2012 to copyright statements
Tim Pepper [Wed, 5 Dec 2012 18:55:51 +0000 (10:55 -0800)]
Add 2012 to copyright statements

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove corewatcher.org references from config file
Tim Pepper [Wed, 5 Dec 2012 18:51:00 +0000 (10:51 -0800)]
Remove corewatcher.org references from config file

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRate limited restart
Tim Pepper [Tue, 27 Nov 2012 22:19:08 +0000 (14:19 -0800)]
Rate limited restart

Restart on error, up to 2 times in 5 minutes.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agosimplify/cleanr-up syslog'd messages
Tim Pepper [Tue, 27 Nov 2012 01:13:38 +0000 (17:13 -0800)]
simplify/cleanr-up syslog'd messages

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoClean path searching for binary
Tim Pepper [Tue, 27 Nov 2012 01:06:33 +0000 (17:06 -0800)]
Clean path searching for binary

Gdb needs an executable and a core so we seek out an executable which
may correspond to the crash.  This was done in a loose way and led to
false matches.  This patch makes the search more strict, adds some debug
message output and handles errors better.  As per the earlier commit,
the "path" is hard coded and with only a single member ("/usr/bin"),
but the code remains to allow it to be a colon separated list of
directories.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoQuote filenames
Tim Pepper [Mon, 26 Nov 2012 22:14:20 +0000 (14:14 -0800)]
Quote filenames

Spaces cause problems

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoShorten thread names
Tim Pepper [Mon, 26 Nov 2012 22:04:29 +0000 (14:04 -0800)]
Shorten thread names

Spaces here yield spaces in the corefile name if these threads die, which
isn't friendly.  Plus the little space available for the name should be
used as effectively as possible.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoHard code system path
Tim Pepper [Mon, 26 Nov 2012 21:59:26 +0000 (13:59 -0800)]
Hard code system path

There is little point reading the path from the environment.

First, it will be the path which systemd set for the environment in which
systemd started the corewatcher daemon.  That may or may not match the
system path.  And it is even more likely to not match the path set in
the environment in which a regular user has interactively started an app.

Second, by searching the path, we get false positive matches.  The crashdb
server has shown a variety of examples of crashes where a matching
app name was found in a developer's custom path.  We also have gotten
crashes reports where a developer was working on local dev/test of a
program whose name matched a binary's name from elsewhere in the path
(subsequent patches will deal more with this case).

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove errant doubled line "#0" in example yaml's
Tim Pepper [Tue, 20 Nov 2012 21:25:15 +0000 (13:25 -0800)]
Remove errant doubled line "#0" in example yaml's

This line was doubled due to a bug in processing gdb's output and
that was fixed in commit 1bb4db3254caea2028c0eef68d441f834a9d5893, so
also fix up the example files.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd missing newline in reports
Tim Pepper [Thu, 15 Nov 2012 00:22:50 +0000 (16:22 -0800)]
Add missing newline in reports

In error cases we might not get a backtrace or maps out of gdb.  In that
case the default "Unknown" string is missing a newline.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agov0.9.10 bug fix release
Tim Pepper [Fri, 2 Nov 2012 23:25:02 +0000 (16:25 -0700)]
v0.9.10 bug fix release

This release fixes a math error by which our kernel core_pattern was
probably mostly always disabled everywhere so we would not collect cores.
It also add a few bits of better logging.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoFix core_pattern being unset
Tim Pepper [Fri, 2 Nov 2012 23:21:10 +0000 (16:21 -0700)]
Fix core_pattern being unset

In the commited version I lost a multiply by 100 that'd previously had.
I'd intended for the free metric to be a percentage represented by an
integer with value 0..100.  This error means the core_pattern was unset
just at the first call to scan_folder().  That is corrected here.

Additionally the core_pattern is explicitly set on start now.

And the log messages are a bit more clear.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd journal log message with version on startup
Tim Pepper [Fri, 2 Nov 2012 22:27:24 +0000 (15:27 -0700)]
Add journal log message with version on startup

This journal message should show up on a 'systemctl status' for the
service, aiding in debug by clearly identifying the running version.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoGit ignore src/corewatcher.service
Tim Pepper [Fri, 2 Nov 2012 21:20:01 +0000 (14:20 -0700)]
Git ignore src/corewatcher.service

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoDisable kernel core writing if available disk is < 10%
Tim Pepper [Tue, 16 Oct 2012 16:04:47 +0000 (09:04 -0700)]
Disable kernel core writing if available disk is < 10%

In an attempt to be more system friendly, corewatcher will disable its
kernel core_pattern if the core_folder's available disk drops below 10%.
It will reenable when disk availability comes back up about 12%.

This code runs at corewatcher's start and at the poll interval (currently
15 minutes).

Someday the core_pattern might be namespaced, but currently there is a
single linux kernel / system global core_pattern.  Only one core watching
type program can own it, with the obvious potential for conflict/confusion
if multiple daemons are writing a pattern there and expecting cores in
the denoted location/form.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agov0.9.9 memory management update
Tim Pepper [Thu, 11 Oct 2012 21:29:20 +0000 (14:29 -0700)]
v0.9.9 memory management update

Bugfix update intended to fix glib/pthreads issue with uninitialize
mutexes.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoHandle allocation failures and admit we leak on error exit
Tim Pepper [Thu, 11 Oct 2012 21:22:12 +0000 (14:22 -0700)]
Handle allocation failures and admit we leak on error exit

Now that I'm allocating more GLib things at start I do need to pay
attention to whether those did allocate and fail gracefully.  Since there's
no signal handler to do tidy cleanup and apparently no native GLib way to
kill GLib threads/loops from peer threads, I can't do proper cleanup on
exit...so just drop that code rather than pretend it actually works.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoDynamically allocated GMutex and GCond variables
Tim Pepper [Thu, 11 Oct 2012 20:48:08 +0000 (13:48 -0700)]
Dynamically allocated GMutex and GCond variables

The GLib documentation says statically allocated GMutex and GCond
variables do not need initialized.  This seems to imply magic on
first use.  That magic could be possible, but would be inefficient.
More likely is that they meant statical globals don't need initialization
because they are zero'd, where static locals are on the stack and could
be / are uninitialized?  But even that doesn't mesh with some runtime
behavior I've sometimes seen with my two statically allocated global
GMutex/GCond pairs:

+ Not running as daemon
+ Begin scanning /var/lib/corewatcher/...
GLib (gthread-posix.c): Unexpected error from C library during
'pthread_mutex_lock': Invalid argument.  Aborting.

Converting them to dynamically allocated variables, with the whole slough
of new/init/clear/free calls seems to fix this as expected.  Of course
the clear/free calls are never reached, since the threads only end/exit
via an (currently) unhandled signal and thus add to the list of things
about which valgrind complains at exit.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agov0.9.8 bugfix update
Tim Pepper [Tue, 9 Oct 2012 19:15:03 +0000 (12:15 -0700)]
v0.9.8 bugfix update

Debug poll timer of 60 seconds got committed instead of 15 minute timer.

The per-submit-url good/bad send counts were not being zeroed between
urls, leading to odd log messages.

The submit loop drains the work_list to the first good url.  It then
should break rather than continuing to loop testing the connection to
possibly remaining submission urls in the url array, despite there being
no work to send them.

If none of the urls worked, the loop completes with work_list still
holding data, which becomes the requeue_list.

Thanks to William Douglas <william.douglas@intel.com> for the bug report!

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRework processing queue threading
Tim Pepper [Mon, 8 Oct 2012 23:06:01 +0000 (16:06 -0700)]
Rework processing queue threading

This patch is a large rework to simplify the processing portion
of corewatcher.  The processing queue is represented now simply
in the filesystem by the presence of *.to_process files, or
*.processed files which lack an associated summary report *.txt file.
The scan_processed_folder() function now is a thread which sleeps on a
condition variable, which in turn is set by the event threads.  Previously
that function did an opendir() on processed_folder and spawned a thread
per found corefile to process the cores, with associated complexity in
data structures and locking.  Now that function is the main loop of the
single processing thread.

- removed remaining global state in core_status struct, processing
  queue array of filenames, simplified locking, simplified state machine,
  some function renames for clarity, updated README
- removed spawning of threads per core to process, adding instead a single
  long lived thread which sleeps on a condition variable set in
  queue_backtrace() and the timer event loop
- if a summary crash report has been created already, don't re-run gdb,
  just read in the report and try to submit it
- audited object lifetimes, added some strdup()'s, free()'s, valgrind now
  shows no leaks in corewatcher code (NOTE: a valgrind warning for
  uninitialized bytes is triggered from corewatcher's submission path
  which originates in glibc 2.16.0 resolv/res_send.c, a patch has been
  submitted to the glibc project)
- added lots of additional logging, especially in error paths
- the gdb mutex is removed as it effectively became a NOOP as it would
  now be used only in one call chain that is never called in parallel

The timer thread is still needed as network issues can prevent submission.
A network event thread could now be added to attempt submission when
any network becomes present and also to attempt reprocessing when
high-bandwidth network becomes present to improve report quality in the
case of a debuginfo daemon then being able to dynamically pull in helpful
data for gdb.  Even then the timer thread would still be needed to handle
the cases of the crashdb server being down or intermediate network issues
preventing submission, situations which aren't trivially distinguished
at the client side in order to spawn an event upon their resolution.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRename scan_corefolders() to scan_folders()
Tim Pepper [Thu, 4 Oct 2012 23:09:03 +0000 (16:09 -0700)]
Rename scan_corefolders() to scan_folders()

Simple rename of the function to be more concise, readable.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove remaining mention of queued_mtx
Tim Pepper [Thu, 4 Oct 2012 22:19:08 +0000 (15:19 -0700)]
Remove remaining mention of queued_mtx

This mutex has been removed.  bt_mtx covers src/submit.c's state now
instead of a mix of queued_mtx and queued_bt_mtx covering a mix of global
state and submit.c state.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove unused global state
Tim Pepper [Thu, 4 Oct 2012 22:16:37 +0000 (15:16 -0700)]
Remove unused global state

Previously this global state needed to be global.  It is essentially unused
now and would have needed locking if it were used.  Simply push it down
into the sole function which uses it now.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agov0.9.6 bug fix release
Tim Pepper [Thu, 4 Oct 2012 21:45:48 +0000 (14:45 -0700)]
v0.9.6 bug fix release

A new release including small fixes:
- remove linkage to libproxy (curl knows about proxies already)
- clean up memory management of strings in summary report, simplify and
  insure each report field's string is populated or set once to a default
  "Unknown" placeholder string
- removed no longer needed check for a "wrapped" app/core
- fix valgrind complain about loop which strips 0x1a's
- fix double "#0" line in backtrace
- additional error handling / requeue for failed report submissions

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd README skipped in prior commit
Tim Pepper [Wed, 3 Oct 2012 18:40:02 +0000 (11:40 -0700)]
Add README skipped in prior commit

We finally have a general README describing the software at a high level,
how to configure, build, and run, and giving some basic internal design
information.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoSeparate report submission into its own thread
Tim Pepper [Wed, 3 Oct 2012 18:09:31 +0000 (11:09 -0700)]
Separate report submission into its own thread

The primary motivation of this commit is separated submit.c's submission
queue handling into a separate thread which sleeps on a condition variable
that is asserted in the inotify and timer event loops.  Includes simpler
data structures/locking for the submission queue.

Associated refactoring includes:
- pull inotification out into its own file to keep corewatcher.c simpler
  (subsequent event threads should be similarly separated)
- add many stderr fprintf's to allow better tracking of where the code is
  during runtime when in non-daemon mode
- log both failed and successful server submission counts
- various bits of added error checking/handling
- better document internally the expectations on core file naming, how
  the file name strings are transformed and stored in the internal
  lists/arrays/hashtables, and an audit to insure oops->filename is
  consistently populated and used
- fixed a few possible memory leaks
- updated some variable and function names to be more self documenting,
  added inline documentation in places
- added design documentation covering the basic states, code that runs for
  transitions between states, global state data structures and the
  associated locks

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoVersion 0.9.4
Tim Pepper [Fri, 28 Sep 2012 16:55:41 +0000 (09:55 -0700)]
Version 0.9.4

This release includes unconditionally scanning at start up (previous
version only scanned after an inotify or the long timer firstrang, when not
in test mode), a core based timestamp in the report, and unconditionally
setting the core_folder and processed_folder permissions to what we expect
them to be during start up validation.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoUnconditionally scan at start
Tim Pepper [Fri, 28 Sep 2012 16:53:31 +0000 (09:53 -0700)]
Unconditionally scan at start

Originally there was an unconditional scan on start up followed by an
exit if in test mode.  With the changes I started for making things
more event driven, I moved that initial scan to an 'if test mode, scan
then exit' block.  We do actually want to always scan on start to get
existing reports processed promptly.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAlways chmod our directories.
Tim Pepper [Fri, 28 Sep 2012 00:25:39 +0000 (17:25 -0700)]
Always chmod our directories.

I observed the the modes of corewatcher's directories had changed on one
of my systems.  I don't know what would have caused that, but it led to
cores not being recorded in the filesystem.  To be robust we create the
directories if for some reason they do not exist at start up.  Similarly,
try to always insure they have the correct permissions at start up.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd timestamp from core
Tim Pepper [Fri, 28 Sep 2012 00:22:15 +0000 (17:22 -0700)]
Add timestamp from core

The server has been attributing a timestamp to a crash report based on the
time the report is received.  This may differ greatly from the actual time
of the issue.  This is easily fixed with a stat of the corefile.

Unfortunately, the same can't as easily be done for getting the os-build,
which may also be incorrectly attributed on the client side based on the
/etc/os-release file's contents at the time of a crash's processing by
corewatcher, as opposed to at the actual time of the crash.

Tracking the combination of the reported os_build, core time, and receiving
time should give us more rich reporting and ability to discern problems
between different classes of users (eg: more/less network connectedness,
more/less aggressive adoption of updates).

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd inotify support, remove pthreads dep, bump version
Tim Pepper [Mon, 24 Sep 2012 18:37:22 +0000 (11:37 -0700)]
Add inotify support, remove pthreads dep, bump version

Arjan noted a lot of activity on wake/poll.  This was when the server
was down and cores/reports were present to submit so there was work
to do.  But a lot of effort was generated to no gain.  The client should
be smarter with respect to sending reports on demand and minimizing
resource usage.  We still need additional state, parallelization and event
connectors to allow different threads to prepare reports for submission,
improve current report quality if high speed network (and thus debuginfo)
becomes available, do just report submission if low quality network
becomes available, etc.

This commit adds inotify support so we immediately attempt to process
cores and reduces the poll loop time to 15 minutes.  Lacking more
sophisticated network event driven logic, a slow poll loop can still
lead to reports eventually being submitted if they weren't able to be
fully submitted at inotify time.

In support of this a few functions are split out and GThreads/GMutexes
used instead of pthread.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoUpdate example yaml after gdb update
Tim Pepper [Tue, 18 Sep 2012 15:32:27 +0000 (08:32 -0700)]
Update example yaml after gdb update

William hacked gdb to list the path to the binary from which the symbols
came in addition to the file name and line number.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove extra unlink
Tim Pepper [Tue, 18 Sep 2012 15:17:14 +0000 (08:17 -0700)]
Remove extra unlink

This was the unlink of the actually processed file.  The primary duplicate
detection is in move_core().  Due to the two phases of processing in
scan_corefolder() it is a fully normal path for a core to get added
to the work queue and then a second add attempt likely happens at
reprocess_corefile().

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd some tentative duplicate handling
Tim Pepper [Sat, 15 Sep 2012 00:07:02 +0000 (17:07 -0700)]
Add some tentative duplicate handling

The corewatcher needs to be ratelimited a bit for extremely crashy
applications.  For example mate's marco will respawn as much as a hundred
times in a second.  In the case of two cores within the same second the
existing code collides in the hash table, so simply note that and unlink
the core file which is under processing currently instead of erroring
back up the stack to the main loop.  Do similarly for core files which
match within two characters at the end of the filename (ie: same time
mod 100 seconds).

This does have a bug though as the sent core is also being unlinked instead
of persisting, but it's a crude start anyway.  Still needs refining and
also the space needs tmp watched.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoFix apparent possible memory overrun in processing_queue
Tim Pepper [Fri, 14 Sep 2012 20:33:55 +0000 (13:33 -0700)]
Fix apparent possible memory overrun in processing_queue

The queue is a simple array of strings of size defined by:
  #define MAX_PROCESSING_OOPS 10
but the add_to / remove_from functions were hard coded to wrap the tail and
head array indices at 100.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoVersion bump and change name in autotools
Tim Pepper [Thu, 13 Sep 2012 20:41:51 +0000 (13:41 -0700)]
Version bump and change name in autotools

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoUpdate version number
Tim Pepper [Thu, 13 Sep 2012 20:37:55 +0000 (13:37 -0700)]
Update version number

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd systemd unit file
Tim Pepper [Thu, 13 Sep 2012 18:52:42 +0000 (11:52 -0700)]
Add systemd unit file

This should be a correct way to add a systemd unit file in autotools.  This
unit file simply allows systemd to run the corewatcher daemon.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd COPYING file to Makefile.am
Tim Pepper [Thu, 13 Sep 2012 16:11:14 +0000 (09:11 -0700)]
Add COPYING file to Makefile.am

The COPYING file should be included in "the package".

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove valgrind suppressions
Tim Pepper [Thu, 13 Sep 2012 16:10:35 +0000 (09:10 -0700)]
Remove valgrind suppressions

We should either see the errors or fix them, imho.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove unused/unneeded corewatcher-config bits
Tim Pepper [Tue, 11 Sep 2012 21:42:28 +0000 (14:42 -0700)]
Remove unused/unneeded corewatcher-config bits

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRequire allow-submit=yes and allow-pass-on=yes
Tim Pepper [Tue, 11 Sep 2012 21:33:18 +0000 (14:33 -0700)]
Require allow-submit=yes and allow-pass-on=yes

Refuse to run if allow-submit=yes and allow-pass-on=yes are not set in the
config file.  These will be set by a prompt at first boot.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoCope with oddities around umask and permission bits
Tim Pepper [Tue, 11 Sep 2012 21:23:43 +0000 (14:23 -0700)]
Cope with oddities around umask and permission bits

For some reason the mask passed to mkdir() isn't (always?) honored, but the
directory starts with safe enough perm's and I can subsequently add the
ones I'd just asked for and not been given.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove unused build_release
Tim Pepper [Tue, 11 Sep 2012 20:56:24 +0000 (13:56 -0700)]
Remove unused build_release

This is used in one place and simply hard coded there to be /etc/os-release
which is the new/current standard everywhere.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoChange from /tmp to /var/lib/corewatcher
Tim Pepper [Tue, 11 Sep 2012 20:53:14 +0000 (13:53 -0700)]
Change from /tmp to /var/lib/corewatcher

We want dumps to be persistent across reboots, so tmpfs isn't the best
place for them.  Plus /tmp is a wild west of writability.  We'll allow full
writing of /var/lib/corewatcher, but not /var/lib/corewatcher/processed.
Still need a tmp watcher on this area to prune files.

Also this directory is an editorial choice by the distro maker, not a user
configurable option...remove user configurability.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove release-info option
Tim Pepper [Tue, 11 Sep 2012 19:42:08 +0000 (12:42 -0700)]
Remove release-info option

This is distribution creator editorial choice, not a user choice.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove unlink option
Tim Pepper [Tue, 11 Sep 2012 19:38:44 +0000 (12:38 -0700)]
Remove unlink option

This will be handled for us by tmpwatch

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove system config files
Tim Pepper [Tue, 11 Sep 2012 19:22:44 +0000 (12:22 -0700)]
Remove system config files

In Nitra these are owned by a system configuration files "package".

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoOpen /var/lib/corewatcher correctly after creation
Tim Pepper [Tue, 11 Sep 2012 16:35:53 +0000 (09:35 -0700)]
Open /var/lib/corewatcher correctly after creation

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoShift files from /tmp to /var/lib/corewatcher
Tim Pepper [Tue, 11 Sep 2012 15:46:39 +0000 (08:46 -0700)]
Shift files from /tmp to /var/lib/corewatcher

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoRemove two old meego-isms
Tim Pepper [Tue, 11 Sep 2012 01:02:35 +0000 (18:02 -0700)]
Remove two old meego-isms

The /etc/os-release file is now standard and we have our own default server
for now and it isn't the meego one.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoSearch for core_* instead of core.*
Tim Pepper [Tue, 11 Sep 2012 00:56:00 +0000 (17:56 -0700)]
Search for core_* instead of core.*

This is pretty arbitrary, but that happens to be what's checked into
nitra's config files currently.  Eventually we'll be called dynamically
by systemd probably when it receives things regarding which we've asked
to be notified.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoFix autotools paths
Tim Pepper [Tue, 11 Sep 2012 00:47:28 +0000 (17:47 -0700)]
Fix autotools paths

I don't fully understand how/where autotools gets its default values, but
these don't seem to be set correctly if I don't explicitly set them.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoA little more cleaning pre-production
Tim Pepper [Mon, 10 Sep 2012 23:17:19 +0000 (16:17 -0700)]
A little more cleaning pre-production

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoA little more cleaning
Tim Pepper [Mon, 10 Sep 2012 23:15:17 +0000 (16:15 -0700)]
A little more cleaning

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoCorrect memory management around os-release/version
Tim Pepper [Thu, 6 Sep 2012 21:56:30 +0000 (14:56 -0700)]
Correct memory management around os-release/version

Valgrind reminded me I should correctly dup the substring and free the
original full string.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoAdd an example yaml file
Tim Pepper [Thu, 6 Sep 2012 17:59:48 +0000 (10:59 -0700)]
Add an example yaml file

This is an example of a low quality (no debuginfo present) core that was
processed/submitted.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoClean out meego/tizen specific things and quiet compile warnings
Tim Pepper [Thu, 6 Sep 2012 17:52:12 +0000 (10:52 -0700)]
Clean out meego/tizen specific things and quiet compile warnings

Updated code to match nitra needs in terms of paths, config, info sent to
server.  Also removed a lot of code unused as a result of the code
updating, which was causing compile warnings due to our pedantic nitra
settings.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoFix config file path
Tim Pepper [Mon, 27 Aug 2012 19:57:14 +0000 (12:57 -0700)]
Fix config file path

For me 'make prefix=/usr libdir=/usr/lib64 sysconfdir=/etc install' put the
configuration files in /etc/corewatcher/, but these files weren't looking
in that subdirectory.

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
11 years agoDe-brand config file
Tim Pepper [Mon, 27 Aug 2012 19:55:41 +0000 (12:55 -0700)]
De-brand config file

Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>
12 years agotestmode wasn't getting set when it should have been, fix
William Douglas [Thu, 24 May 2012 21:59:39 +0000 (14:59 -0700)]
testmode wasn't getting set when it should have been, fix

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoremove incorrect comments
William Douglas [Thu, 24 May 2012 21:50:56 +0000 (14:50 -0700)]
remove incorrect comments

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRemove useless check.
William Douglas [Thu, 24 May 2012 21:50:23 +0000 (14:50 -0700)]
Remove useless check.

Since the crash submission/opt in was removed this check was changed
to only testmode, making test mode useless. Since we always send we
need to modify what testmode does now.

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoadd short option check for test mode
William Douglas [Thu, 24 May 2012 21:46:18 +0000 (14:46 -0700)]
add short option check for test mode

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agofix compiler failure do to taking out crash submission code
William Douglas [Thu, 24 May 2012 21:40:10 +0000 (14:40 -0700)]
fix compiler failure do to taking out crash submission code

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoadd test that generates a core for corewatcher
William Douglas [Thu, 24 May 2012 21:31:35 +0000 (14:31 -0700)]
add test that generates a core for corewatcher

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRemove options to not submit crash info
William Douglas [Thu, 24 May 2012 21:25:15 +0000 (14:25 -0700)]
Remove options to not submit crash info

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoUse CFLAGS for the configuration file as well
William Douglas [Mon, 21 May 2012 22:32:27 +0000 (15:32 -0700)]
Use CFLAGS for the configuration file as well

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoupdate gitignore for autoconf
William Douglas [Mon, 21 May 2012 22:15:04 +0000 (15:15 -0700)]
update gitignore for autoconf

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRemove opt out check.
William Douglas [Mon, 21 May 2012 22:12:25 +0000 (15:12 -0700)]
Remove opt out check.

Always submit so remove check for opt out. Still need to remove the
configuration bits for this.

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoUpdate CFLAGS from old Makefile
William Douglas [Mon, 21 May 2012 22:02:42 +0000 (15:02 -0700)]
Update CFLAGS from old Makefile

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRemove dbus interface to UI
William Douglas [Mon, 21 May 2012 21:32:32 +0000 (14:32 -0700)]
Remove dbus interface to UI

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoAdd check for malloc failing
William Douglas [Mon, 21 May 2012 17:58:32 +0000 (10:58 -0700)]
Add check for malloc failing

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoFix double free possibility
William Douglas [Mon, 21 May 2012 17:57:37 +0000 (10:57 -0700)]
Fix double free possibility

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoUpdate ioprio defines
William Douglas [Thu, 4 Aug 2011 17:06:17 +0000 (10:06 -0700)]
Update ioprio defines

We don't use RT priority so remove that.  Also 7 seemed like a
magic number so try and explain it and reference the kernel
docs where everything came from.
Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoTake out Debian Etch work around.
William Douglas [Wed, 3 Aug 2011 23:48:43 +0000 (16:48 -0700)]
Take out Debian Etch work around.

Etch is old, move on.
Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRename coredump scan function.
William Douglas [Wed, 3 Aug 2011 23:05:11 +0000 (16:05 -0700)]
Rename coredump scan function.

Doing this rename for clarity since scan_dmesg doesn't scan
dmesg and the kernel oops code actually does so it will take
that name.
Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoReorganize header, move objects under the appropriate source file
William Douglas [Wed, 3 Aug 2011 21:23:38 +0000 (14:23 -0700)]
Reorganize header, move objects under the appropriate source file

Part of kernel oops integration to corewatcher.
Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoUpdate corewatcher to use autotools.
William Douglas [Wed, 27 Jul 2011 00:04:42 +0000 (17:04 -0700)]
Update corewatcher to use autotools.

This involves major source restructuring and in the process
some files have been renamed as well as moved.  This was
done to ease the use of autotooling the package though
it shouldn't impair clarity of purpose for the files.

At this point there are further opportunities to improve
the packaging such as introducing #defines for some
file locations in the code.

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRemove old define that was duplicating asm/unistd.h information.
William Douglas [Tue, 26 Jul 2011 18:11:27 +0000 (11:11 -0700)]
Remove old define that was duplicating asm/unistd.h information.

This was for __NR_ioprio_set which is a syscall without a glibc
interface.  Since the define is already done in asm/unistd.h
for our architectures we no longer need to have it in corewatcher.
Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoinitial removal of corewatcher-applet
William Douglas [Fri, 22 Jul 2011 21:22:09 +0000 (14:22 -0700)]
initial removal of corewatcher-applet

Signed-off-by: William Douglas <william.douglas@intel.com>
12 years agoRework corewatcher, clean valgrind warnings.
William Douglas [Sat, 9 Jul 2011 00:21:06 +0000 (17:21 -0700)]
Rework corewatcher, clean valgrind warnings.

Major rework of corewatcher.  Corewatcher is now multithreaded
and will spawn a thread to process each corefile and will now
send a crash notification as soon it scans the /tmp/ folder.

There should be no more than one thread running gdb at a time
so we have a global lock to prevent that.

Corewatcher was also cleaned up to have 0 valgrind errors
(that are not suppressed, we have added a valgrind suppression
file for that purpose).

From here on any changes to corewatcher which cause a valgrind
error need to be discussed before being commited and ack'd
by a maintainer (and have its error added to the suppression
file).  Right now all suppressions are either glibc not doing
things that are not ansi c compliant or are in a library
corewatcher depends on (likely also running into glibc compliance
issues but I was unable to verify for all of the errors).

To test corewatcher for valgrind errors it should be run in
with no internet connection and with an internet connection
with multiple core files available to scan.

The following command should be used to test corewatcher with
valgrind (run from the source build directory):
G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind \
 --partial-loads-ok=yes --read-var-info=yes --leak-check=full \
 --track-origins=yes --malloc-fill=AD --free-fill=DA \
 --suppressions=./corewatcher.supp --gen-suppressions=yes \
 ./corewatcher -d -n

Signed-off-by: William Douglas <william.douglas@intel.com>