Patch Name: PHKL_22589

Patch Description: s700_800 11.00 LOFS, select(), IDS/9000 and umount race fix

Creation Date: 00/10/27

Post Date: 00/10/27

Hardware Platforms - OS Releases:
	s700: 11.00
	s800: 11.00

Products: N/A

Filesets:
	OS-Core.CORE-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP
	ProgSupport.C-INC,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP
	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32,v=HP
	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_64,v=HP

Automatic Reboot?: Yes

Status: General Release

Critical:
	No (superseded patches were critical)
	PHKL_22517: PANIC
	PHKL_21608: PANIC
	PHKL_20315: PANIC HANG
	PHKL_14119: OTHER
		Binary compatibility was not maintained for 32 bit
		applications running on 64 bit systems.

Category Tags:
	defect_repair enhancement general_release critical panic
	halts_system

Path Name: /hp-ux_patches/s700_800/11.X/PHKL_22589

Symptoms:
	PHKL_22589:
	( SR: 8606163603 CR: JAGad32907 )
	After PHKL_18543 is installed, select() will incorrectly
	return 0 when it is interrupted after being called with no
	file descriptors and a timeout.  According to the X/Open
	standard, select() should return -1 for this case.

	PHKL_22517:
	( SR: 8606163287 CR:JAGad32591 )
	Data Page Fault in getmount_entry() system call.  The panic
	stack might look like,

	    panic+0x14
	    report_trap_or_int_and_panic+0x80
	    trap+0xdb8
	    nokgdb+0x8
	    vx_active_common_flush+0xb8
	    vx_getmount+0x4c
	    getmount_entry+0x140
	    syscall+0x480
	    $syscallrtn+0x0

	PHKL_22142:
	( SR: 8606126449 CR:JAGac57014 )
	When using select() with a large number of BSD socket
	file descriptors, performance degradation is observed.

	PHKL_21608:
	( SR: 8606133836 CR:JAGad02977 )
	Users see a PANIC with 'lo_realvfs' message.
	The following stack trace is seen:

	    panic+0x14
	    lo_realvfs+0x9c
	    freelonode+0xdc
	    lo_inactive+0x124
	    locallookuppn+0x4fc
	    lookuppn+0xf8
	    lookupname+0x40
	    vn_open+0x68
	    copen+0xd0
	    open+0x3c
	    syscall+0x480
	    $syscallrtn+0x0

	PHKL_21361:
	( SR: 8606132624 CR: JAGad01773 )
	The Praesidium IDS/9000 product requires this patch in order
	to run.  This patch has no impact on systems without the
	Praesidium IDS/9000 product installed and enabled.

	PHKL_20315:
	( SR: 8606109444 DTS: JAGab82146 )
	A system may panic in lo_realvfs() when using LOFS
	file systems.

	( SR: 4701423798 DTS: JAGab13874 )
	The system may hang using LOFS if the directory being
	mounted and the mount point are the same.
	To reproduce the problem:
	        # mount -F lofs /mnt /mnt
	        # ls /mnt
	This process will loop in the kernel indefinitely.

	( SR: 1653263962 DTS: JAGab12500 )
	There are two types of failures that may be observed with
	this problem.
	1) A stale file handle is returned when mounting an
	   LOFS file system over NFS
	2) Loopback mounts fail for direct map pathname from
	   AUTOFS (automount); this is an enhancement in LOFS
	   to support AUTOFS.

	( SR: 4701393884 CR: JAGaa08709 )
	A directory mounted via the loop-back file system
	(LOFS) can be removed, thus making the mount inaccessible.

	PHKL_15689:
	vfs.o:
	1.  Cannot create AutoFS mount points.
	autosysgen.o:
	1.  32-bit AutoFS commands fail on 64-bit
	    OS.

	PHKL_20349:
	( SR: 8606110852 CR: JAGab83602 )
	Enhancement to provide support for the pread(2) and
	pwrite(2) system calls.

	PHKL_14119:
	( SR: 4701375543 DTS: DSDe440886 )
	The original instance of this patch, PHKL_13290, was not
	marked as a critical patch.  It should have been.

	PHKL_13290:
	( SR: 4701375543 DTS: DSDe440886 )
	System calls with signed integer arguments called from
	32-bit binary programs may behave incorrectly when passed
	negative values, while running on 64 bit systems.  This
	defect only impacts 64 bit systems.

Defect Description:
	PHKL_22589:
	( SR: 8606163603 CR: JAGad32907 )
	The performance update made to select() by PHKL_18543 did
	not correctly handle the case of select() being interrupted
	after being called with no file descriptors and a timeout.

	Resolution:
	The routine select_as_nanosleep() was updated to cause
	select to return -1 with the error of type EINTR when the
	above case occurred.  This conforms to the X/Open standard.

	PHKL_22517:
	( SR: 8606163287 CR:JAGad32591 )
	This is due to a race between two threads, one accessing the
	details of a mounted file system and another unmounting the
	same file system.  getmount_entry() is holding an alpha
	semaphore while retrieving the details of the mounted file
	system.  This semaphore may be released, if the filesystem
	specific getmount_entry routine sleeps.  Due to this another
	thread doing an unmount of the file system would be able to
	get the semaphore and thus could unmount the file system and
	free the related data structures.  Later the
	getmount_entry() thread accesses the freed data structures
	and panics.

	Resolution:
	Instead of relying only on the semaphore, get a hold on the
	file system so that unmount will fail when getmount_entry()
	is in progress.

	PHKL_22142:
	( SR: 8606126449 CR:JAGac57014 )
	In order to improve the network performance, one more piece
	of information is needed to pass from select(2) to its lower
	functions in order to tell the lower functions if the
	select(2) system call is going to sleep.

	Resolution:
	One more argument has been added to its lower function for
	passing sleeping information, which enables performance
	improvements in future Transport and STREAMS patches.  This
	patch alone will have no performance improvement if there
	are no such Transport and STREAMS patches installed.

	PHKL_21608:
	( SR: 8606133836 CR:JAGad02977 )
	This PANIC with 'lo_realvfs' message is because of a race
	condition.

	A race condition is created when one thread tries to create
	an an lfs node and another thread tries to release the same
	'lfs' node.

	Thread 1 tries to free an 'lfs' node while holding a lock.
	Thread 2 tries to make an 'lfs' node.  But, due to the time
	gap in holding and releasing the lock, a race condition is
	created between Thread 1 and Thread 2.

	This can lead to the PANIC with 'lo_realvfs' PANIC.

	Resolution:
	The fix is to increase and decrease the lfs_refct without
	giving up the lock. Also the lfs_refct value checking has
	been changed to refect the new change.

	PHKL_21361:
	( SR: 8606132624 CR: JAGad01773 )
	This patch is one of 16 patches (PHKL_21348-PHKL_21363)
	required by the Praesidium IDS/9000 product.  These patches
	enable the collection and tracking of information from
	various system calls.  Unless all of the enabling patches
	(or their successors) and the product are installed, and the
	product is enabled, this patch has no impact on the system.

	Resolution:
	This patch enables the gathering of information from the
	filesystem system calls.

	PHKL_20315:
	( SR: 8606109444 DTS: JAGab82146 )
	The problem is a race condition caused by not properly
	protecting an entry in a lofs data structure.  The lock that
	is supposed to protect this structure was not held when an
	update was made, and thus simultaneous changes resulted in
	an inconsistency in the data structure, causing the panic.

	Resolution:
	The lock is now held when this entry is updated; this
	is actually just obtaining the lock one line earlier in
	the code.

	( SR: 4701423798 DTS: JAGab13874 )
	The problem is that the system will loop in the routine
	trying to find the root of the file system.

	Resolution:
	The mount of a directory to itself is really an error.  The
	resolution is to change the code so the mount will fail with
	EINVAL, thus avoiding the case where the hang will occur.

	( SR: 1653263962 CR: JAGaa12500 )
	The problem is that LOFS does not implement the VFS_VGET
	operation, and thus does not properly call the underlying
	file system functions.  This functionality is needed for
	AUTOFS to support overlaying of file systems.

	Resolution:
	The solution is to implement the VFS_VGET routine in LOFS,
	so a new function lo_vget() has been added.  This resolves
	both symptoms of the problem.

	( SR: 4701393884 CR: JAGaa08709 )
	The problem is that LOFS does not properly add a reference
	to the vnode of mount point.  This allows 'rmdir' to remove
	the directory because there appear to be no references to
	it any more.

	Resolution:
	Add a new LOFS vnode which will add a reference to the mount
	point vnode preventing the removal of the directory.

	PHKL_15689:
	vfs.o:
	1.  smount2() fails when vnode is of type
	    AutoFS.
	autosysgen.o:
	1.  Data alignment is incorrect between the
	    32-bit automount command and the 64-bit
	    AutoFS system calls.

	PHKL_20349:
	( SR: 8606110852 CR: JAGab83602 )
	Enhancement to add new pread(2), pwrite(2), pread64(2) and
	pwrite64(2) system calls.  These calls perform the same
	action as read(2) and write(2) except that they read/write
	from a given position in the file (specified in the fourth
	argument) without changing the file pointer.

	Resolution:
	Added new system calls.

	PHKL_14119:
	( SR: 4701375543 DTS: DSDe440886 )
	In order to set the critical tag on this file, a new patch
	was required.  This patch makes no other change, and is
	technically equivalent to PHKL_13290.

	PHKL_13290:
	( SR: 4701375543 DTS: DSDe440886 )
	Extract unsigned instruction used where signed extract
	should have been used.

SR:
	1653263962 4701375543 4701393884 4701423798 5003424044
	8606109444 8606110852 8606126449 8606132624 8606133836
	8606163287 8606163603

Patch Files:
	
	OS-Core.CORE-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	/usr/conf/h/unistd.h

	ProgSupport.C-INC,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	/usr/include/sys/unistd.h

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32,v=HP:
	/usr/conf/lib/libhp-ux.a(init_sent.o)
	/usr/conf/lib/libhp-ux.a(lo_subr.o)
	/usr/conf/lib/libhp-ux.a(lo_vfsops.o)
	/usr/conf/lib/libhp-ux.a(lo_vnops.o)
	/usr/conf/lib/libhp-ux.a(scall_stubs.o)
	/usr/conf/lib/libhp-ux.a(sys_gen.o)
	/usr/conf/lib/libhp-ux.a(vfs.o)
	/usr/conf/lib/libhp-ux.a(vfs_vnode.o)
	/usr/conf/lib/libhp-ux.a(autosysgen.o)

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_64,v=HP:
	/usr/conf/lib/libhp-ux.a(init_sent.o)
	/usr/conf/lib/libhp-ux.a(lo_subr.o)
	/usr/conf/lib/libhp-ux.a(lo_vfsops.o)
	/usr/conf/lib/libhp-ux.a(lo_vnops.o)
	/usr/conf/lib/libhp-ux.a(scall_stubs.o)
	/usr/conf/lib/libhp-ux.a(sys_gen.o)
	/usr/conf/lib/libhp-ux.a(vfs.o)
	/usr/conf/lib/libhp-ux.a(vfs_vnode.o)
	/usr/conf/lib/libhp-ux.a(autosysgen.o)

what(1) Output:
	
	OS-Core.CORE-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	/usr/conf/h/unistd.h:
		unistd.h $Date: 1999/12/06 12:15:20 $Revision: r11ro
			s/6 PATCH_11.00 (PHKL_20349)

	ProgSupport.C-INC,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	/usr/include/sys/unistd.h:
		unistd.h $Date: 1999/12/06 12:15:20 $Revision: r11ro
			s/6 PATCH_11.00 (PHKL_20349)

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32,v=HP:
	/usr/conf/lib/libhp-ux.a(lo_subr.o):
		lo_subr.c $Date: 2000/04/28 11:43:18 $Revision: r11r
			os/2 PATCH_11.00 (PHKL_21608)
	/usr/conf/lib/libhp-ux.a(lo_vfsops.o):
		lo_vfsops.c $Date: 1999/12/02 07:19:10 $Revision: r1
			1ros/1 PATCH_11.00 (PHKL_20315)
	/usr/conf/lib/libhp-ux.a(lo_vnops.o):
		lo_vnops.c $Date: 1999/12/02 07:19:10 $Revision: r11
			ros/1 PATCH_11.00 (PHKL_20315)
	/usr/conf/lib/libhp-ux.a(scall_stubs.o):
		scall_stubs.s $Date: 1999/12/06 12:15:20 $Revision: 
			r11ros/3 PATCH_11.00 (PHKL_20349)
	/usr/conf/lib/libhp-ux.a(init_sent.o):
		init_sent.c $Date: 1999/12/06 12:15:20 $Revision: r1
			1ros/1 PATCH_11.00 (PHKL_20349)
	/usr/conf/lib/libhp-ux.a(sys_gen.o):
		sys_gen.c $Date: 2000/10/27 11:30:24 $Revision: r11r
			os/10 PATCH_11.00 (PHKL_22589)
	/usr/conf/lib/libhp-ux.a(vfs.o):
		vfs.c $Date: 2000/10/16 10:32:49 $Revision: r11ros/6
			 PATCH_11.00 (PHKL_22517)
	/usr/conf/lib/libhp-ux.a(vfs_vnode.o):
		vfs_vnode.c $Date: 2000/03/17 11:52:36 $Revision: r1
			1ros/5 PATCH_11.00 (PHKL_21361)
	/usr/conf/lib/libhp-ux.a(autosysgen.o):
		None

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_64,v=HP:
	/usr/conf/lib/libhp-ux.a(lo_subr.o):
		lo_subr.c $Date: 2000/04/28 11:43:18 $Revision: r11r
			os/2 PATCH_11.00 (PHKL_21608)
	/usr/conf/lib/libhp-ux.a(lo_vfsops.o):
		lo_vfsops.c $Date: 1999/12/02 07:19:10 $Revision: r1
			1ros/1 PATCH_11.00 (PHKL_20315)
	/usr/conf/lib/libhp-ux.a(lo_vnops.o):
		lo_vnops.c $Date: 1999/12/02 07:19:10 $Revision: r11
			ros/1 PATCH_11.00 (PHKL_20315)
	/usr/conf/lib/libhp-ux.a(scall_stubs.o):
		scall_stubs.s $Date: 1999/12/06 12:15:20 $Revision: 
			r11ros/3 PATCH_11.00 (PHKL_20349)
	/usr/conf/lib/libhp-ux.a(init_sent.o):
		init_sent.c $Date: 1999/12/06 12:15:20 $Revision: r1
			1ros/1 PATCH_11.00 (PHKL_20349)
	/usr/conf/lib/libhp-ux.a(sys_gen.o):
		sys_gen.c $Date: 2000/10/27 11:30:24 $Revision: r11r
			os/10 PATCH_11.00 (PHKL_22589)
	/usr/conf/lib/libhp-ux.a(vfs.o):
		vfs.c $Date: 2000/10/16 10:32:49 $Revision: r11ros/6
			 PATCH_11.00 (PHKL_22517)
	/usr/conf/lib/libhp-ux.a(vfs_vnode.o):
		vfs_vnode.c $Date: 2000/03/17 11:52:36 $Revision: r1
			1ros/5 PATCH_11.00 (PHKL_21361)
	/usr/conf/lib/libhp-ux.a(autosysgen.o):
		None

cksum(1) Output:
	
	OS-Core.CORE-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	1552822860 40438 /usr/conf/h/unistd.h

	ProgSupport.C-INC,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP:
	1552822860 40438 /usr/include/sys/unistd.h

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_32,v=HP:
	4068335192 25312 /usr/conf/lib/libhp-ux.a(autosysgen.o)
	3472465008 5584 /usr/conf/lib/libhp-ux.a(lo_subr.o)
	523758388 3796 /usr/conf/lib/libhp-ux.a(lo_vfsops.o)
	3884858488 6712 /usr/conf/lib/libhp-ux.a(lo_vnops.o)
	2960587960 1500 /usr/conf/lib/libhp-ux.a(scall_stubs.o)
	1283310373 34596 /usr/conf/lib/libhp-ux.a(init_sent.o)
	1249713400 16508 /usr/conf/lib/libhp-ux.a(sys_gen.o)
	2145393819 25012 /usr/conf/lib/libhp-ux.a(vfs.o)
	200795814 11772 /usr/conf/lib/libhp-ux.a(vfs_vnode.o)

	OS-Core.CORE2-KRN,fr=B.11.00,fa=HP-UX_B.11.00_64,v=HP:
	2552864451 166864 /usr/conf/lib/libhp-ux.a(autosysgen.o)
	1980142860 14688 /usr/conf/lib/libhp-ux.a(lo_subr.o)
	2464395949 8776 /usr/conf/lib/libhp-ux.a(lo_vfsops.o)
	213328873 19184 /usr/conf/lib/libhp-ux.a(lo_vnops.o)
	3024845451 135032 /usr/conf/lib/libhp-ux.a(scall_stubs.o)
	4092195412 134248 /usr/conf/lib/libhp-ux.a(init_sent.o)
	3299011626 36832 /usr/conf/lib/libhp-ux.a(sys_gen.o)
	3042430899 66296 /usr/conf/lib/libhp-ux.a(vfs.o)
	391041071 25232 /usr/conf/lib/libhp-ux.a(vfs_vnode.o)

Patch Conflicts: None

Patch Dependencies:
	s700: 11.00: PHKL_18543
	s800: 11.00: PHKL_18543

Hardware Dependencies: None

Other Dependencies: None

Supersedes:
	PHKL_21608 PHKL_21361 PHKL_20315 PHKL_15689 PHKL_14119 PHKL_13290
	PHKL_22517 PHKL_22142 PHKL_20349

Equivalent Patches: None

Patch Package Size: 680 KBytes

Installation Instructions:
	Please review all instructions and the Hewlett-Packard
	SupportLine User Guide or your Hewlett-Packard support terms
	and conditions for precautions, scope of license,
	restrictions, and, limitation of liability and warranties,
	before installing this patch.
	------------------------------------------------------------
	1. Back up your system before installing a patch.

	2. Login as root.

	3. Copy the patch to the /tmp directory.

	4. Move to the /tmp directory and unshar the patch:

		cd /tmp
		sh PHKL_22589

	5. Run swinstall to install the patch:

		swinstall -x autoreboot=true -x patch_match_target=true \
			  -s /tmp/PHKL_22589.depot

	By default swinstall will archive the original software in 
	/var/adm/sw/save/PHKL_22589.  If you do not wish to retain a
	copy of the original software, use the patch_save_files option:

		swinstall -x autoreboot=true -x patch_match_target=true \
			  -x patch_save_files=false -s /tmp/PHKL_22589.depot

	WARNING: If patch_save_files is false when a patch is installed,
		 the patch cannot be deinstalled.  Please be careful
		 when using this feature.

	For future reference, the contents of the PHKL_22589.text file is 
	available in the product readme:

		swlist -l product -a readme -d @ /tmp/PHKL_22589.depot

	To put this patch on a magnetic tape and install from the
	tape drive, use the command:

		dd if=/tmp/PHKL_22589.depot of=/dev/rmt/0m bs=2k

Special Installation Instructions:
	This patch depends on base patch PHKL_18543.
	For successful installation please insure that PHKL_18543
	is already installed, or that PHKL_18543 is included
	in the same depot with this patch and PHKL_18543
	is selected for installation.

