Bug 2024672

Summary: sessions kept open with use_pty and closed pty
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: sudoAssignee: Radovan Sroka <rsroka>
Status: NEW --- QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.4CC: dapospis, qguo, sahay
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paulo Andrade 2021-11-18 16:27:47 UTC
User does run putty to rhel, run sudo on rhel, then ssh from rhel to solaris.

  When there is a vpn timeout or putty window is closed, sessions are listed
as still open with 'w' and 'who' commands. sudo process is still running.

(gdb) bt
#0  0x00007f75f9c32ade in __GI_ppoll (fds=0x5613b0a2f260, nfds=2, timeout=<optimized out>, timeout@entry=0x0, sigmask=sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
#1  0x00007f75fa339654 in ppoll (__ss=0x0, __timeout=0x0, __nfds=<optimized out>, __fds=<optimized out>) at /usr/include/bits/poll2.h:77
#2  sudo_ev_poll (timo=0x0, nfds=<optimized out>, fds=<optimized out>) at ./event_poll.c:148
#3  sudo_ev_scan_impl (base=base@entry=0x5613b0a55730, flags=flags@entry=0) at ./event_poll.c:184
#4  0x00007f75fa331511 in sudo_ev_loop_v1 (base=0x5613b0a55730, flags=flags@entry=0) at ./event.c:644
#5  0x00007f75fa33177b in sudo_ev_dispatch_v1 (base=<optimized out>) at ./event.c:610
#6  0x00005613b02d9f19 in exec_pty (details=details@entry=0x5613b04f11e0 <command_details>, cstat=cstat@entry=0x7fffd31f8d70) at ./exec_pty.c:1580
#7  0x00005613b02d27f3 in sudo_execute (details=0x5613b04f11e0 <command_details>, cstat=0x7fffd31f8d70) at ./exec.c:371
#8  0x00005613b02e133f in run_command (details=0x5613b04f11e0 <command_details>) at ./sudo.c:957
#9  0x00005613b02d0872 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at ./sudo.c:301

(gdb) p {struct pollfd[2]}fds
$1 = {{fd = 12, events = 1, revents = 0}, {fd = 11, events = 1, revents = 0}}

  From sosreport lsof file for the process we see:

sudo      257796        0   11r     FIFO               0,13       0t0    1049819 pipe
sudo      257796        0   12u     unix 0xffff9b2c9f8f8d80       0t0    1049813 type=STREAM

  And the pty is already closed:

sudo      257796        0    0u      CHR              136,4       0t0          7 /dev/pts/4 (deleted)
sudo      257796        0    1u      CHR              136,4       0t0          7 /dev/pts/4 (deleted)
sudo      257796        0    2u      CHR              136,4       0t0          7 /dev/pts/4 (deleted)

  A suggestion was to use the TMOUT shell variable to get the shell to exit,
but still, better to understand the issue, and it would not work if it were
not in the shell prompt.

  At first we though it could be a variant of bz#1582155 but since it is
not waiting on /dev/ptmx, it might be an unrelated issue.

Comment 4 Radovan Sroka 2023-08-16 14:36:12 UTC
This bug is going to be migrated.

Contact point for migration questions or issues: rsroka
Guidance for Bugzilla users to test their Jira account or create one if needed:

https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016394
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016694
https://redhat.service-now.com/help?id=kb_article_view&sysparm_article=KB0016774