RNDGETPOOL ioctl wierdness

Dale Harris (rodmur@maybe.org)
Thu, 14 Oct 1999 21:02:46 -0600


Hi,

I may have stumbled on a small problem. However, I'm not kernel hacker,
but things just don't look right. Appears that the ioctl for RNDGETPOOL
isn't implemented the way <linux/random.h> way you would think. So the
end result is if you use the ioctl in the defined way then your program
SIGSEGV's. Course maybe I'm just reading things right, so I'm coming here.

>From <linux/random.h> we have:

/* Get the contents of the entropy pool. (Superuser only.) */
#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )

Shouldn't that be returning an integer array with two entries?

But drivers/char/random.c for RNDGETPOOL returns to user space:

ent_count = random_state.entropy_count;
if (put_user(ent_count, p++))
return -EFAULT;

and

if (copy_to_user(p, random_state.pool, size*sizeof(__u32)))
return -EFAULT;

The pool is 128 bytes, per POOLWORDS. Why isn't POOLWORDS in <linux/random.h>?
So that I a user could check that, make sure they are getting the correct
size. Is there a problem here? This was for the 2.2.12 kernel.

Linux possible 2.2.12 #3 Fri Oct 8 18:32:46 MDT 1999 i586 unknown

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dale Harris  <rodmur@maybe.org>   GPG key: 372FBD57    http://www.maybe.org/
          M.A.Y.B.E. = Maybe is an Altruistic Yet Bohemian Enigma

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/