From nobody@FreeBSD.org  Fri Dec 14 03:40:18 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 464EA37B417
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Dec 2001 03:40:18 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fBEBeIx24089;
	Fri, 14 Dec 2001 03:40:18 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112141140.fBEBeIx24089@freefall.freebsd.org>
Date: Fri, 14 Dec 2001 03:40:18 -0800 (PST)
From: Rocco Lucia <rlucia@iscanet.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: w incorrectly handles stale utmp slots with jail
X-Send-Pr-Version: www-1.0

>Number:         32828
>Category:       bin
>Synopsis:       [jail] w(1) incorrectly handles stale utmp slots with jail
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-jail
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 14 03:50:07 PST 2001
>Closed-Date:    Sat Nov 17 14:12:44 CET 2012
>Last-Modified:  Sat Nov 17 14:12:44 CET 2012
>Originator:     Rocco Lucia
>Release:        4.4
>Organization:
>Environment:
FreeBSD signonssh.cs.tin.it 4.4-STABLE FreeBSD 4.4-STABLE #1: Mon Dec  3 10:11:14 CET 2001     root@signonssh.cs.tin.it:/usr/obj/usr/src/sys/SIGNONSSH  i386

>Description:
While using jail, w command on host machine erroneously handles 'current
process' for a stale utmp slot.

It will show as 'current process' that one who is actually run in the jail
and whose controlling terminal line is the same as it was used in the host machine.
>How-To-Repeat:
1. log into the jail and allocate different ttys (screen could help)
2. log into the host machine and have the process killed or disconnected
   (create a stale utmp record)

Manage steps 1 and 2 so that you have at least a session on host machine
and a session in the prison that share same tty name (/dev/ttyp1 on host,
and ${JAIL}/dev/ttyp1 in the prison).

3. now issue the w command on the host system and you'll see the 'current
   process' for the stale utmp record being a process running in the jail
   but that has same tty (though on two different environments).
>Fix:

>Release-Note:
>Audit-Trail:

From: Rocco Lucia <rlucia@iscanet.com>
To: freebsd-gnats-submit@FreeBSD.org, rlucia@iscanet.com
Cc:  
Subject: Re: bin/32828: w incorrectly handles stale utmp slots with jail
Date: Sat, 15 Dec 2001 03:10:32 +0100

 I was wrong about assumptions and I didn't doublecheck before
 posting the PR. shame on me :)
 
 anwyay here's the corrected thing:
 
 How-to-Repeat
   1. log into the host machine and have your shell killed or disconnected
      (create a stale utmp record)
   2. log into the jail and manage to get allocated to you the tty just
      freed but who appears in the stale utmp record
   3. now issue the w command on the host system and you'll see the
      'current process' for the stale utmp record being a process running
      in the jail.
 
 -- 
 Rocco Lucia - rlucia@iscanet.com      Iscanet Internet Services
 http://elisa.utopianet.net/~rlucia    System and Network Admin
 C6E6 AC9A 1361 FB38 B47A  2792 9FC4 C52F 7A68 4468
 
 Free unices for a free world. Support *BSD.
Responsible-Changed-From-To: freebsd-bugs->phk 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Sun Dec 30 05:05:01 PST 2001 
Responsible-Changed-Why:  
This is more a problem with w(1) than with jails, but perhaps you 
could take a look anyway? 
:-) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32828 
Responsible-Changed-From-To: phk->bugs 
Responsible-Changed-By: phk 
Responsible-Changed-When: Tue Jul 29 03:32:30 PDT 2003 
Responsible-Changed-Why:  
This is indeed a problem with the way utmp and w(1) works, but 
admittedly, jails probably add to the confusion. 

I have no simple fix to offer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32828 
Responsible-Changed-From-To: bugs->freebsd-bugs 
Responsible-Changed-By: arved 
Responsible-Changed-When: Mon Aug 4 11:19:46 PDT 2003 
Responsible-Changed-Why:  
fix responsible 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32828 
Responsible-Changed-From-To: freebsd-bugs->freebsd-jail 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Jan 25 22:05:56 UTC 2008 
Responsible-Changed-Why:  
Reassign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32828 
State-Changed-From-To: open->closed 
State-Changed-By: ed 
State-Changed-When: Sat Nov 17 14:12:43 CET 2012 
State-Changed-Why:  
Closing, as this is no longer an issue on FreeBSD -CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=32828 
>Unformatted:
