When su receives SIGTERM, the parent process is terminated

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6.5
  • coreutils-8.4-31.el6.x86_64

Issue

su terminates its parent process upon receiving SIGTERM.

Resolution

The issue has been resolved in the following advisory:

coreutils bug fix update

Root Cause

  • The issue is a regression introduced in coreutils updated in RHEL 6.5 as a result of backporting an upstream patch fixing another issue. The upstream patch introduced this regression in upstream.

  • su sends the received signal to all processes in its process group, where its parent process is. Therefore, the parent process is terminated.

Diagnostic Steps

  • Let's assume processes listed in this partial output of:

$ ps -Heawww o user,pid,ppid,pgrp,c,stime,tty,time,cmd

root     14874 13214 14874  0 16:49 pts/0    00:00:00         /bin/sh ./quick.sh
root     14875 14874 14874  0 16:49 pts/0    00:00:00           sh /var/tmp/in-between.sh
root     14876 14875 14874  0 16:49 pts/0    00:00:00             su - testuser -c /var/tmp/testsleep.sh
testuser 14878 14876 14878  0 16:49 ?        00:00:00               /bin/sh /var/tmp/testsleep.sh
testuser 14895 14878 14878  0 16:49 ?        00:00:00                 sleep 30
  • When process 14876 receives SIGTERM, the parent process is terminated.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments