2.22.2-7: fix 928104

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2013-08-01 14:15:12 +02:00
parent e824bc1b44
commit 9242a4b516
2 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,64 @@
Based on upstream patch:
From 8998ad001fdb58ceba4147f8aa4c72203117db25 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 5 Jun 2013 14:31:00 +0200
Subject: [PATCH] login: use TCSANOW to remove HUPCL
login(1) code:
ttt.c_cflag &= ~HUPCL;
tcsetattr(0, TCSAFLUSH, &ttt);
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */
vhangup();
signal(SIGHUP, SIG_DFL);
strace :
ioctl(0, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF, {B9600 opost isig icanon echo ...}) = 0
close(0) = 0
close(1) = 0
close(2) = 0
--- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} ---
+++ killed by SIGTERM +++
It seems we get SIGHUP (and SIGTERM from systemd) before vhangup().
The problem occur sometimes.
I guess it's because TCSAFLUSH is not applied immediately, so it would
be probably better to use TCSANOW to make the code more robust.
References: https://bugzilla.redhat.com/show_bug.cgi?id=962145
Signed-off-by: Karel Zak <kzak@redhat.com>
diff -up util-linux-2.22.2/login-utils/login.c.kzak util-linux-2.22.2/login-utils/login.c
--- util-linux-2.22.2/login-utils/login.c.kzak 2013-08-01 14:03:39.189156123 +0200
+++ util-linux-2.22.2/login-utils/login.c 2013-08-01 14:06:16.942580758 +0200
@@ -407,7 +407,7 @@ static void init_tty(struct login_contex
}
/* Kill processes left on this tty */
- tcsetattr(0, TCSAFLUSH, &ttt);
+ tcsetattr(0, TCSANOW, &ttt);
/*
* Let's close file decriptors before vhangup
@@ -1323,10 +1323,10 @@ int main(int argc, char **argv)
close(cnt);
setpgrp(); /* set pgid to pid this means that setsid() will fail */
+ init_tty(&cxt);
openlog("login", LOG_ODELAY, LOG_AUTHPRIV);
- init_tty(&cxt);
init_loginpam(&cxt);
/* login -f, then the user has already been authenticated */

View File

@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux
Version: 2.22.2
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base
URL: http://en.wikipedia.org/wiki/Util-linux
@ -97,6 +97,8 @@ Patch103: cal-don-t-mix-ncurses-output-functions-and-printf.patch
Patch104: libblkid-remove-optimization-from-verify-function.patch
# 902512 - No boot : Dependency failed for /home (and blkid fails to tell UUID)
Patch105: libblkid-make-backup-superblock-visible-for-wipefs-8.patch
# 928104 - telnet-server will not accept connections from Linux telnet client
Patch106: util-linux-ng-2.22-login-TCSANOW.patch
%description
The util-linux package contains a large variety of low-level system
@ -739,6 +741,9 @@ fi
%{_libdir}/pkgconfig/uuid.pc
%changelog
* Thu Aug 1 2013 Karel Zak <kzak@redhat.com> 2.22.2-7
- fix #928104 - telnet-server will not accept connections from Linux telnet client
* Wed Feb 20 2013 Karel Zak <kzak@redhat.com> 2.22.2-6
- fix patch for #902512