Re: CVS commit: src/sys/dev

2010-12-04 Thread Christos Zoulas
In article 20101204173951.3ae6e17...@cvs.netbsd.org,
Antti Kantee source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  pooka
Date:  Sat Dec  4 17:39:51 UTC 2010

Modified Files:
   src/sys/dev: rnd.c

Log Message:
Don't allow goes to 11^H^Hhyperspace len field for RNDADDATA.


Should be EINVAL; E2BIG has a very specific meaning (unless we want to change
that).

christos



Re: CVS commit: src/sys/dev

2010-12-04 Thread Michael Graff
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I admit to a certain lack of understanding the twisty maze of pointers
and memory mapping magic at play here, but is simply checking the length
enough?  That is, what happens if I pass in a structure that is smaller
than expected?

That is, is there a way to check the actual size of the data passed into
the ioctl, rather than the field in the structure we expect, or is that
done at a higher level?

- --Michael

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz6t6EACgkQl6Nz7kJWYWYUgwCdHHji8pLUST6OEFF99rSmMaXM
YYUAnjeUp95LWR7JSyYB+3tGBfCZARbD
=2Pxk
-END PGP SIGNATURE-


Re: CVS commit: src/sys/dev

2010-12-04 Thread David Laight
On Sat, Dec 04, 2010 at 03:50:25PM -0600, Michael Graff wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 I admit to a certain lack of understanding the twisty maze of pointers
 and memory mapping magic at play here, but is simply checking the length
 enough?  That is, what happens if I pass in a structure that is smaller
 than expected?
 
 That is, is there a way to check the actual size of the data passed into
 the ioctl, rather than the field in the structure we expect, or is that
 done at a higher level?

The length of the program's buffer is unknown.
The kernel uses the high 16 bits of the ioctl command to indicate
whether to read/write (2 bits) and a length (14 bits).
If either control bit is set, the ioctl syscall stub will do the
copyin/out and pass the actual device driver a pointer to the
in-kernel buffer.
So the device driver can always access the buffer length implied
from the command.

To my mind this is a horrid hack :-)

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/dev

2010-12-04 Thread Warner Losh

On 12/04/2010 15:09, David Laight wrote:

On Sat, Dec 04, 2010 at 03:50:25PM -0600, Michael Graff wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I admit to a certain lack of understanding the twisty maze of pointers
and memory mapping magic at play here, but is simply checking the length
enough?  That is, what happens if I pass in a structure that is smaller
than expected?

That is, is there a way to check the actual size of the data passed into
the ioctl, rather than the field in the structure we expect, or is that
done at a higher level?

The length of the program's buffer is unknown.
The kernel uses the high 16 bits of the ioctl command to indicate
whether to read/write (2 bits) and a length (14 bits).
If either control bit is set, the ioctl syscall stub will do the
copyin/out and pass the actual device driver a pointer to the
in-kernel buffer.
So the device driver can always access the buffer length implied
from the command.

To my mind this is a horrid hack :-)
It does ensure, however, that all the error checking is centralized (and 
therefore more likely ot be correct).  Removing the checks from the 
ioctl layer would break a lot of code...


Warner

David





Re: CVS commit: src/games/boggle/boggle

2010-12-04 Thread Joerg Sonnenberger
On Sun, Dec 05, 2010 at 04:11:52AM +, Paul Goyette wrote:
 Module Name:  src
 Committed By: pgoyette
 Date: Sun Dec  5 04:11:52 UTC 2010
 
 Modified Files:
   src/games/boggle/boggle: bog.c
 
 Log Message:
 Since this game is installed as 'boggle', fix the usage() text to match.

getprogname()?

Joerg


Re: CVS commit: src/games/boggle/boggle

2010-12-04 Thread Paul Goyette
I thought about that, but checked a couple other games, and they all 
hard-code the program name...  So I just make boggle consistent with 
others.


I'd be happy to fix boggle (and tetris and snake) to use getprogname(3) 
but not sure I want to sign up to check everything.   :)




On Sun, 5 Dec 2010, Joerg Sonnenberger wrote:


On Sun, Dec 05, 2010 at 04:11:52AM +, Paul Goyette wrote:

Module Name:src
Committed By:   pgoyette
Date:   Sun Dec  5 04:11:52 UTC 2010

Modified Files:
src/games/boggle/boggle: bog.c

Log Message:
Since this game is installed as 'boggle', fix the usage() text to match.


getprogname()?

Joerg

!DSPAM:4cfb11e82361149613028!





-
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |  | pgoyette at netbsd.org  |
-