Skip to content

setsid is never called on the child process after a fork in main_noinetd since version 2020.79 #180

Closed

Description

@m5jt

The main dropbear process is terminated if we send a TERM signal to the process group of a dropbear session process to terminate a specific session.

The problem seems to be that the setsid is never called on the child process after a fork in main_noinetd since version 2020.79.

The setsid is presently called in main_noinetd only if DEBUG_NOFORK is not defined and DEBUG_NOFORK is defined in debug.h.

The problem seems to have been introduced in commit 2a81289 when the usage of the DEBUG_NOFORK was reworked.

Activity

  1. davidbernard04 commented on Jul 7, 2022

    @davidbernard04

    @mkj I've talked with my colleague @m5jt because I myself did not understood well the above description.

    So the regression issue caused by 2a81289 is because the DEBUG_NOFORK rework was incomplete and a #ifndef DEBUG_NOFORK was forgotten a little later in the file. See: https://github.com/mkj/dropbear/blob/DROPBEAR_2020.79/svr-main.c#L306

    On our side, for some use-cases we are calling getgid() on the dropbear child to cleanup any potential children, and since the above issue is preventing the child to have his own "process group", our software ended up killing the server.

    BTW we can see the issue with a simple "ps" on a stock Ubuntu 22.04:

    vagrant@ubuntu2204:~$ ps xao pid,ppid,pgid,sid,tty,comm
        PID    PPID    PGID     SID TT       COMMAND
       3152       1    3152    3152 ?        dropbear
       3154    3152    3152    3152 ?        dropbear
       3155    3154    3155    3155 pts/1    bash
    vagrant@ubuntu2204:~$ 
    

    Note the PGID of the dropbear child (second line), which is identical to the PID of the parent (first line).

  2. added a commit that references this issue on Jul 18, 2022
    7de29c2
  3. mkj commented on Jul 18, 2022

    @mkj
    Owner

    Thanks for tracking that down

  4. added a commit that references this issue on May 11, 2026
  5. added a commit that references this issue on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions