[comp.unix.wizards] SVVS

aegl@root.co.uk (Tony Luck) (06/17/88)

One area in which a system may not pass SVVS if the code is not taken
directly from the gospel according to AT&T is error returns from system
calls. SVVS (2.0 maybe 3.0) gives bogus arguments to system calls and
checks that 'errno' is set to the 'correct' value. This can cause problems
if your kernel doesn't check the arguments in the same order that an AT&T
kernel does. E.g. what should be the error caused by this call to read(2)?

	close(0);
	read(0, (char *)NULL, -23);

Should you get 'EBADF' because the file descriptor is invalid, or 'EFAULT'
because the buffer pointer is bogus, or 'EINVAL' because the number of
characters to be read is silly?

There are some tests in SVVS 2.0 that require certain error returns even
though more than one seems possible.

-Tony Luck

geoff@eagle_snax.UUCP ( R.H. coast near the top) (06/23/88)

In article <595@root44.co.uk>, aegl@root.co.uk (Tony Luck) writes:
> One area in which a system may not pass SVVS if the code is not taken
> directly from the gospel according to AT&T is error returns from system
> calls. SVVS (2.0 maybe 3.0) gives bogus arguments to system calls and
> checks that 'errno' is set to the 'correct' value. This can cause problems
> if your kernel doesn't check the arguments in the same order that an AT&T
> kernel does. E.g. what should be the error caused by this call to read(2)?
 
> 	close(0);
> 	read(0, (char *)NULL, -23);
 
> Should you get 'EBADF' because the file descriptor is invalid, or 'EFAULT'
> because the buffer pointer is bogus, or 'EINVAL' because the number of
> characters to be read is silly?

Being interested in the portability of Un*x applications
to other OS environments (including MS-DOS) I decided to try
this little test program on a few compilers. SunOS gave EBADF.
Microsoft C 4.0 under DOS also gave EBADF. Turbo C under DOS
left errno as 0.....


-- 
Geoff Arnold, Sun Microsystems     | "...And is the Tao in the DOS for a
TOPS at ECD (home of PC-NFS)       | personal computer?" The master coughed and
UUCP:{ihnp4,decwrl...}!sun!garnold | shifted his position slightly. "The
ARPA:garnold@sun.com               | lesson is over for today," he said.

allbery@ncoast.UUCP (Brandon S. Allbery) (06/26/88)

As quoted from <595@root44.co.uk> by aegl@root.co.uk (Tony Luck):
+---------------
| calls. SVVS (2.0 maybe 3.0) gives bogus arguments to system calls and
| checks that 'errno' is set to the 'correct' value. This can cause problems
| if your kernel doesn't check the arguments in the same order that an AT&T
| kernel does. E.g. what should be the error caused by this call to read(2)?
| 
| 	close(0);
| 	read(0, (char *)NULL, -23);
| 
| There are some tests in SVVS 2.0 that require certain error returns even
| though more than one seems possible.
+---------------

This sounds like a bug in SVVS or an incomplete SVID.  Either case should be
fixed:  either AT&T should define the argument checking in the SVID or they
should accept any of the error returns possible from the call.

Before you flame AT&T to death about this, remember that they're fairly new
to this kind of thing; it'll take some time to work the glitches out of both
SVID and SVVS, and the only way it'll get done is if you tell AT&T that the
glitches exist and give examples.
-- 
Brandon S. Allbery			  | "Given its constituency, the only
uunet!marque,sun!mandrill}!ncoast!allbery | thing I expect to be "open" about
Delphi: ALLBERY	       MCI Mail: BALLBERY | [the Open Software Foundation] is
comp.sources.misc: ncoast!sources-misc    | its mouth."  --John Gilmore