[comp.unix.i386] RDUBLK bug in INTERACTIVE 386/ix

tzung@cadovax.UUCP (Tzung Liu) (10/25/89)

We have found a generic bug in INTERACTIVE 386/ix(AT&T V.32) for 386 PC/AT.
The RDUBLK sysi86() system call, i.e. ReaD User BLocK, will fail if the user
block requested is not in core but in swap device.  This affect the "ps" and
"crash" commands such that:
	1. the "ps -aef" command will NOT show a process if it's swapped
	   out at the time the "ps" command is running.
	2. the "crash" command will show misleading information, especially
	   in the "COMMAND" field if a process is swapped out.
This bug doesn't exist in V.31 because the V.31 "ps" and "crash" commands
do not use sysi86(RDUBLK, ...) to read a user blocks if a process is not
in core. (Note: RDUBLK is a new member of sysi86() system call).

The problem is that the RDUBLK routine in kernel calls the SWAP device
read entry point(the raw i/o entry point) directly, if the requested
user block is not in core, while passing the original
byte count requested from user to the device driver.  Both the "ps" and "crash"
request sizeof(u) bytes, where u is the user block structure, which is NOT a
multiple of the sector size.
The SWAP raw i/o routines will reject any request if the byte count is not
multiple of the sector size, 512 for 386 AT.  Thus the sysi86(RDUBLK, ...)
system call will fail and return -1.

To recreate the problem:
	run a couple of big programs, or run multiple copies of the following
	program until your see the LED on your SWAP disk is ON most of the
	time.

	#define MAX 1024*2048		/* 2 MB */
	char buffer[MAX]

	main()
	{
		int i;
		for (;;)
			for (i=0; i<MAX; buffer[i++] = 0xff)
			;
	}

Then use the "ps" and "crash" command to see the processes in the system.
You will notice that "ps" will report less processes than it should be.

There is no easy way to get around the problem unless your can modify
the kernel source or the source codes of "ps" and "crash".

May be INTERACTIVE will come up with a bug fix later.

Tzung Liu.

jackv@turnkey.gryphon.COM (Jack F. Vogel) (10/26/89)

In article <2455@cadovax.UUCP> tzung@cadovax.UUCP () writes:
>We have found a generic bug in INTERACTIVE 386/ix(AT&T V.32) for 386 PC/AT.
>The RDUBLK sysi86() system call, i.e. ReaD User BLocK, will fail if the user
>block requested is not in core but in swap device.  This affect the "ps" and
>"crash" commands such that:
>	1. the "ps -aef" command will NOT show a process if it's swapped
>	   out at the time the "ps" command is running.
>	2. the "crash" command will show misleading information, especially
>	   in the "COMMAND" field if a process is swapped out.

You never specify what version of 386/ix you are running, but if I am not
mistaken this is one of the most significant bug fixes (in my opinion) in
2.02. At least it was the real motivating reason to install the upgrade
from 2.01 for me.

In any case, this bug is old news, if you had called ISC they would have
informed you of the fix (at least Santa Monica would've, not sure about
that east coast office :-).

--
Jack F. Vogel			jackv@seas.ucla.edu
AIX Technical Support	              - or -
Locus Computing Corp.		jackv@ifs.umich.edu