greenbone / openvas-scanner

This repository contains the scanner component for Greenbone Community Edition.

Home Page:https://greenbone.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong input for sighand_chld()

hmn91 opened this issue · comments

https://github.com/greenbone/openvas/blob/b955373084af612a2d8e7a92067166531df0072f/src/sighand.c#L103

Current

void
sighand_chld (pid_t pid)
{
int status;

waitpid (pid, &status, WNOHANG);
}

Expected

void
sighand_chld (int signal)
{
int status;

while (waitpid (-1, &status, WNOHANG) > 0);
}

Hi @hmn91,
thanks for reporting this.
Could you tell me which openvas version are you using and how did you find this? did you get an error?
I really would appreciate more info about this issue. Thanks in advance.

I'm using gvmd 8.0.2, openvas-scanner 6.0.0.
I found this while I was inspecting another issue, that is in a rarely case, all NVT process of a host scanning process become zombie and that host scanning process will never finish. I was searching for all occurence of SIGCHLD and found this handler function. I put a g_message in this handler function and saw all messages show the same pid=17, that is SIGCHLD signal number. Google around and I found out the code should be as above. But this is not the cause of my issue because the host scanning process does not handle SIGCHLD. So I don't really know the affect of this bug.

Hi @hmn91,
well, as you say, it is a strange case. I know about this issue, about a host process hanging for ever, but I was never able to reproduce it in my own environment. I prepared a patch (PR #427) which will probably solve the issue about the unfinished host process. Once the parent process is able to run, the zombie processes will be released.
It would be really nice if you can test the patch and let me know if this solves the issue-
Anyway, I will give a look to what you found. Thanks again for reporting this.

Thanks for the patch. I will try it for about a month and see if the problem is still happening