Bug 808 - iolog terminate process sent to background
iolog terminate process sent to background
Status: RESOLVED DUPLICATE of bug 502
Product: Sudo
Classification: Unclassified
Component: Sudo
1.8.21
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-21 04:53 MST by Daniele Palumbo
Modified: 2017-12-01 14:08 MST (History)
1 user (show)

See Also:


Attachments
replicator 1/2 (513 bytes, application/octet-stream)
2017-11-21 04:53 MST, Daniele Palumbo
Details
replicator 2/2 (129 bytes, application/octet-stream)
2017-11-21 04:54 MST, Daniele Palumbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniele Palumbo 2017-11-21 04:53:38 MST
Created attachment 502 [details]
replicator 1/2

With log_output set, a process sent to background may fail to start.

I was able to replicate the bug with the latest sudo version available.

Adding a sleep after the background process start, the process does start.

daniele@build-jessie-amd64:~$ ./replicator.sh 
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, log_output, log_output, maxseq=150, iolog_dir=/var/log/sudo-io/%{user}, !requiretty
/usr/bin/iperf3 
running KO test
no sleep
iperf3 KO
iperf3: no process found
running OK test
sleeping 3s
iperf3 KO
iperf3: no process found
daniele@build-jessie-amd64:~$ 

To replicate the problem please just deploy the two script in the same folder and run ./replicator.sh.
Ensure that the user (even root) may run 
sudo ./iperf-daemon.sh
Comment 1 Daniele Palumbo 2017-11-21 04:54:10 MST
Created attachment 503 [details]
replicator 2/2
Comment 2 Daniele Palumbo 2017-11-21 04:55:12 MST
Forgot to mention that i have used the latest bits from sudo.ws.

daniele@build-jessie-amd64:~$ sudo -V
Sudo version 1.8.21p2
Sudoers policy plugin version 1.8.21p2
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.21p2
daniele@build-jessie-amd64:~$
Comment 3 Todd C. Miller 2017-11-21 10:34:37 MST
When I/O logging is enabled, if the process run by sudo exits, the pseudo-tty will be closed.  As a result of this, any process with the tty open will receive SIGHUP.

In your example, when the iperf-daemon.sh scripts exits, iperf3 receives SIGHUP and exits.  If you run iperf3 like this:

    iperf3 -s </dev/null >/dev/null 2>&1 &

or better yet:

    iperf3 -s -D

you will not have this problem.
Comment 4 Todd C. Miller 2017-12-01 14:08:20 MST

*** This bug has been marked as a duplicate of bug 502 ***