Subject: Re: Regressing testing of system calls
To: None <tech-kern@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-kern
Date: 06/14/1999 12:08:38
[ On Monday, June 14, 1999 at 18:52:29 (+1000), Darren Reed wrote: ]
> Subject: Regressing testing of system calls
>
>       I'm working on a small package to validate the accuracy of the
> implementation of the NetBSD system call interface with that documented
> in the manual pages -  which is what led me to finding this oddity with
> pipe(2).  So far, I've only found one other problem - adjtime(2) didn't
> return an error if the pointer "olddelta" wasn't valid and changed the
> delta to the value pointed to by "delta" regardless.  To do this testing,
> I'm using the list of errors on the man page for each system call and
> attempting to call them (with an appropriate environment) in such a way
> that they do fail as described.

Very cool!

>  Given some of the comments people have
> made about what manual pages are meant to document, I'm pondering whether
> or not this is the `correct' approach.

Well, I guess it depends on your goals.  You'll certainly be able to
find many potential discrepancies between the documentation and the
implemenation, which is a very good thing all on its own.  At some point
it might be good to do a visual walk-through of the code (hopefully with
the help of some good analysis tools) to see if there are any other
errno values that might possibly be returned (and then of course to
figure out what conditions might reveal them and to enhance the
documentation and your testing tools to cover them).

> (i.e. it's important that seteuid(0) doesn't
> work if uid == ruid == euid == 65535).

What's magic about 65535?  (uid_t is u_int32_t)  Don't you mean
(UINT_MAX-1)?

Personally I'd be happier if seteuid(0) never worked unless euid == 0
(the superuser should always be forced to permanently revoke its
privileges!), but that's a whole other can of worms!  ;-)

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>