Pete's Log: excursions, continued

Entry #815, (Coding, Hacking, & CS stuff)
(posted when I was 22 years old.)

First issue encountered: no libc in the kernel. So to populate our array with random numbers, we'll need to include our own pseudo-random number generator in the module. Woo. Or something. We'll see. Maybe not: in /usr/src/linux/drivers/char/random.c we find the following function available inside the kernel: void get_random_bytes(void *buf, int nbytes); This gives us random data from the kernel entropy pool. Yeah, cuz my experimentation definitely needs truly random data. Haha.

damnit. I suck. I'm glad I ran my module in vmware, cuz it kernel oops'd first time around. Because I was a silly fool and did a kmalloc in init_module and then tried to access that memory in cleanup_module. This don't work because the process in which the module is inserted (and in which init_module is thus called) is no longer live when cleanup_module gets called. I feared as much, but figured I'd try this anyway. So I'll just shove all the code into init_module...

try two: I crash vmware. Only one option remains. Run it on a live system... woooo. So I'll submit this now in case malloc doesn't survive...