GithubHelp home page GithubHelp logo

kmatheussen / das_watchdog Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 1.0 168 KB

A general watchdog for the linux operating system that should run in the background at all times to ensure a realtime process won't hang the machine

Home Page: http://www.notam02.no/arkiv/src/

Makefile 2.72% Shell 6.21% C 91.07%

das_watchdog's Introduction


Das_Watchdog V0.9.0
Released 14.2.2009

Kjetil S. Matheussen, [email protected]


ABOUT
-----
Das_Watchdog is a general watchdog for the linux operating system that
should run in the background at all times to ensure a realtime process
won't hang the machine.

Das_Watchdog is inspired by the rt_watchdog program
made by Florian Schmidt: http://tapas.affenbande.org/?page_id=38

But das_watchdog has some improvements over rt_watchdog:

1. It works with 2.4 kernels as well as 2.6.
2. Instead of permanently setting all realtime processes to run non-realtime, das_watchdog
   only sets them temporary.
3. When the watchdog kicks in, an X window should pop up that tells you what's happening.
   (just close it after reading the message).



REQUIREMENTS
------------
xmessage (should be a part of X11)
libgtop2 (should be included with gnome. No, das_watchdog is not a gnome-program, it
          only uses libgtop2.)



COMPILATION
----------
make


FEDORA INSTALLATION
-------------------
cp das_watchdog /usr/local/sbin/
echo '/usr/local/sbin/das_watchdog >/dev/null &' >>/etc/rc.sysinit
reboot


GENTOO INSTALLATION
-------------------
# from the proaudio overlay:
emerge -va das_watchdog
reboot


DEBIAN INSTALLATION
-------------------
cp das_watchdog /usr/local/sbin/
cp das_watchdog.rc /etc/init.d/das_watchdog
update-rc.d das_watchdog defaults
invoke-rc.d das_watchdog start
reboot


USAGE
-----

Whenever a program locks up the machine, the watchdog temporarily sets all
realtime process to non-realtime for 8 seconds. You will get an xmessage window
up on the screen when that happens.

To test it, run the attached program "test_rt", which immediatley freezes your
machine. However, a window should pop up after about 5-6 seconds telling you
that the watchdog set the process to non-realtime. (If you have two processors,
you must run test_rt two times, and so on.)






CHANGES
-------
0.3.2->0.9.0
* Removed timer process testing. This was only a problem with older 2.6
  kernels. (think it was fixed early 2006 or thereabout). No scary
  messages printed to the screen anymore.
* Tested on Fedora core 10.
* Cleaned up documentation a bit and added instructions for installing on
  Fedora, Gentoo and Debian.

0.3.1->0.3.2
*Fixed manual. Newer linux kernels all seems to have properly working timing, so using
 the --force option should never be necessary anymore.

0.2.5->0.3.1
*Changed scheme for finding correct XAUTHORITY environment variable.
  (Now works with Fedora Core 6)
  Hopefully, these changes should increase the chance of seeing the
  xmessage and avoid seeing multiple ones. (Theres no correct way to do
  this, so please send me the output of "uname -a" in case you don't see
  any window)
*Added syslogging.
*Added the --version argument.

0.2.4->0.2.5
*Let the test thread run with SCHED_FIFO priority as well, using the lowest priority.

0.2.3->0.2.4
*Test if the xmessage program found during the make process is a valid executable.
 If not, search the $PATH instead. This should fix it for Gentoo when the pro-audio
 overlay is updated to at least this version.
*Various modifications for the High Res Timer, which should be used instead of setting the
 timer interrupt process to SCHED_FIFO/99.

0.2.2->0.2.3
*Fixed commandline arguments for increasetime, checktime and waittime.
*Nicified source a bit

0.2.1->0.2.2
*Locked down memory. Don't know if its necessary.

0.2.0->0.2.1
*Cleaned up source a bit.
*Properly find number of timer processes.
*Added shortcuts for optargs and beautified the source a bit.


0.1.2->0.2.0
*Don't do anything if no process priorities are changed, when watchdogging.
*Added the --force option, that sets the priority of all timer processes to FIFO/99.
*Added the das_watchdog /etc/init.d script provided by Stefan Kersten. (das_watchdog.rc)
*Added the --verbose option.
*Check that its the same process when setting back old priority.
*Don't set back to old priority if the priority has been changed in the mean time.
*Added options for setting increasetime, checktime and waittime.
 (--increasetime, --checktime and --waittime)
*Don't change the priority of any timer process when watchdogging.
*Smaller code cleanups.


0.1.1->0.1.2
* Added check for the ksoftrqd/0 process as well as the softirq-timer/0 process.
* Added check for SCHED_OTHER of the timing process as well as priority.
* Removed debug-printing.

0.1.0->0.1.1
* Added extensive checks both when compiling and when running about the priority of the "softirq-timer/0"
  process:
  - ***If "softirq-timer/0" is not set to a very high priority (99), the watchdog most probably will not work.***
  - The default priority for softirq-timer/0 seems to be 1. However, for real time work, it must be
    set higher to get reliable timing. Set it to 99.
  - If softirq-timer/0 is set to less than 99, das_watchdog will refuse to compile unless you force it to by
    editing the makefile. When running das_watchdog, it will only give a warning if the priority is set too low.
* Changed the DISPLAY environment variable to ":0.0" instead of "localhost:0.0". Seems to work for
  everyone now.
* Switched from libgtop to libgtop2.

0.0.2->0.1.0
* Properly setting the DISPLAY and XAUTHORITY environment variables in various ways to make sure
  the message is really shown. (It really works now!)

0.0.1->0.0.2
*Use xmessage instead of wish. (much nicer)
*Run system("xhost +") and setenv("DISPLAY",":0.0",1) before running xmessage.



ACKNOWLEDGEMENT
---------------
The program is mentally based on Florian Schmidts program rt_watcdog. Florian Schmidt
also wrote the test_rt program.

das_watchdog's People

Contributors

atsampson avatar kmatheussen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

atsampson

das_watchdog's Issues

memory leak on realloc

Hi

Due to the original fix for CVE-2015-2831, bd20bb0 a memory leak and a possible "NULL+i" (write) dereference was afterwards.

Proposed patch:

--- a/das_watchdog.c
+++ b/das_watchdog.c
@@ -325,7 +325,14 @@ static char *get_pid_environ_val(pid_t p

     if (i >= temp_size) {
       temp_size *= 2;
-      temp = realloc(temp, temp_size);
+      char *new_temp = realloc(temp, temp_size);
+      if(new_temp==NULL){
+        fclose(fp);
+        free(temp);
+        return NULL;
+      }else{
+        temp=new_temp;
+      }
     }

     if(foundit==1 && (c=='\0' || c==EOF)){

https://sources.debian.net/data/main/d/das-watchdog/0.9.0-3.2/debian/patches/fix-memory-leak-on-realloc.patch

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.