[openssh-commits] [openssh] 01/01: Ensure SA_SIGNAL test only signals itself.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri May 8 22:01:39 AEST 2020


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 4fa9e048c2af26beb7dc2ee9479ff3323e92a7b5
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Fri May 8 21:50:43 2020 +1000

    Ensure SA_SIGNAL test only signals itself.
    
    When the test's child signals its parent and it exits the result of
    getppid changes.  On Ubuntu 20.04 this results in the ppid being that
    of the GDM session, causing it to exit.  Analysis and testing from pedro
    at ambientworks.net
---
 configure.ac | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3712d55d..003b235e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2534,10 +2534,12 @@ static void sighandler(int sig) { }
 	sa.sa_flags = SA_RESTART;
 	(void)sigaction(SIGTERM, &sa, NULL);
 	if ((pid = fork()) == 0) { /* child */
+		pid = getppid();
 		sleep(1);
-		kill(getppid(), SIGTERM);
+		kill(pid, SIGTERM);
 		sleep(1);
-		kill(getppid(), SIGKILL);
+		if (getppid() == pid) /* if parent did not exit, shoot it */
+			kill(pid, SIGKILL);
 		exit(0);
 	} else { /* parent */
 		r = select(0, NULL, NULL, NULL, NULL);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list