Skip to content

Commit

Permalink
Merge pull request #491 from jjnicola/log-mutex-lock
Browse files Browse the repository at this point in the history
Prevent deadlock, ensure that no locks are being held at the time of forking
  • Loading branch information
ArnoStiefvater committed May 4, 2020
2 parents 47ae8f1 + abe4c1f commit 49a87ac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Set status finished and send a message if the port list is invalid. [#453](https://github.com/greenbone/openvas/pull/453)
- Fix format-truncation warning in GCC 8.2 and later. [#461](https://github.com/greenbone/openvas/pull/461)
- Clean the new kb when the scan was stopped and the host has not been started. [#494](https://github.com/greenbone/openvas/pull/494)
- Prevent child deadlock. [#491](https://github.com/greenbone/openvas/pull/491)

[Unreleased]: https://github.com/greenbone/openvas/compare/openvas-7.0...master

Expand Down
6 changes: 6 additions & 0 deletions src/alivedetection.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
#include <sys/wait.h>
#include <unistd.h>

#undef G_LOG_DOMAIN
/**
* @brief GLib log domain.
*/
#define G_LOG_DOMAIN "alive scan"

struct scanner scanner;
struct scan_restrictions scan_restrictions;
struct hosts_data hosts_data;
Expand Down
7 changes: 7 additions & 0 deletions src/openvas_log_conf.cmake_in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ prepend_time_format=%Y-%m-%d %Hh%M.%S %Z
file=${GVM_LOG_DIR}/openvas.log
level=127

[alive scan]
prepend=%t %s %p
separator=:
prepend_time_format=%Y-%m-%d %Hh%M.%S %Z
file=${GVM_LOG_DIR}/openvas.log
level=16

[*]
prepend=%t %s %p
separator=:
Expand Down
7 changes: 5 additions & 2 deletions src/processes.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@

#include "sighand.h"

#include <errno.h> /* for errno() */
#include <glib.h> /* for g_error */
#include <errno.h> /* for errno() */
#include <glib.h> /* for g_error */
#include <gvm/base/logging.h> /* for gvm_log_lock/unlock() */
#include <setjmp.h>
#include <signal.h> /* for kill() */
#include <stdlib.h> /* for exit() */
Expand Down Expand Up @@ -98,7 +99,9 @@ create_process (process_func_t function, void *argument)
{
int pid;

gvm_log_lock ();
pid = fork ();
gvm_log_unlock ();

if (pid == 0)
{
Expand Down

0 comments on commit 49a87ac

Please sign in to comment.