| 3340 | |
| 3341 | == stackmod seems to work as expected == |
| 3342 | * s0711489@ubuntu-lucid64:~$ sudo insmod stackmod.ko entry=4 |
| 3343 | * s0711489@ubuntu-lucid64:~$ sudo mknod /dev/stack c 251 0 |
| 3344 | * s0711489@ubuntu-lucid64:~$ sudo chmod 666 /dev/stack |
| 3345 | |
| 3346 | * s0711489@ubuntu-lucid64:~$ echo 0 > /dev/stack |
| 3347 | * s0711489@ubuntu-lucid64:~$ echo 1 > /dev/stack |
| 3348 | * s0711489@ubuntu-lucid64:~$ echo 2 > /dev/stack |
| 3349 | * s0711489@ubuntu-lucid64:~$ echo 3 > /dev/stack |
| 3350 | * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod |
| 3351 | {{{ |
| 3352 | stack: 4 |
| 3353 | }}} |
| 3354 | * s0711489@ubuntu-lucid64:~$ echo 4 > /dev/stack |
| 3355 | {{{ |
| 3356 | -bash: echo: write error: No space left on device |
| 3357 | }}} |
| 3358 | * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod |
| 3359 | {{{ |
| 3360 | stack: 4 |
| 3361 | }}} |
| 3362 | * s0711489@ubuntu-lucid64:~$ cat /dev/stack |
| 3363 | {{{ |
| 3364 | 3 |
| 3365 | 2 |
| 3366 | 1 |
| 3367 | 0 |
| 3368 | }}} |
| 3369 | * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod |
| 3370 | {{{ |
| 3371 | stack: 0 |
| 3372 | }}} |
| 3373 | |
| 3374 | * s0711489@ubuntu-lucid64:~$ tailf /var/log/kern.log |
| 3375 | {{{ |
| 3376 | Nov 23 20:03:55 ubuntu-lucid64 kernel: [ 34.772987] stackmod is loaded |
| 3377 | Nov 23 20:03:55 ubuntu-lucid64 kernel: [ 34.772992] stackmod: 4 entry, major is 251, minor is 0 |
| 3378 | Nov 23 20:03:55 ubuntu-lucid64 kernel: [ 34.773002] stackmod: create /proc/stackmod |
| 3379 | Nov 23 20:03:55 ubuntu-lucid64 kernel: [ 34.773004] stackmod is added successfully |
| 3380 | Nov 23 20:05:02 ubuntu-lucid64 kernel: [ 101.487336] stackmod is opened |
| 3381 | Nov 23 20:05:02 ubuntu-lucid64 kernel: [ 101.487361] stackmod is written (2) |
| 3382 | Nov 23 20:05:02 ubuntu-lucid64 kernel: [ 101.487367] stackmod is released |
| 3383 | Nov 23 20:05:05 ubuntu-lucid64 kernel: [ 104.420526] stackmod is opened |
| 3384 | Nov 23 20:05:05 ubuntu-lucid64 kernel: [ 104.420537] stackmod is written (2) |
| 3385 | Nov 23 20:05:05 ubuntu-lucid64 kernel: [ 104.420542] stackmod is released |
| 3386 | Nov 23 20:05:08 ubuntu-lucid64 kernel: [ 107.535829] stackmod is opened |
| 3387 | Nov 23 20:05:08 ubuntu-lucid64 kernel: [ 107.535844] stackmod is written (2) |
| 3388 | Nov 23 20:05:08 ubuntu-lucid64 kernel: [ 107.535849] stackmod is released |
| 3389 | Nov 23 20:05:11 ubuntu-lucid64 kernel: [ 110.279177] stackmod is opened |
| 3390 | Nov 23 20:05:11 ubuntu-lucid64 kernel: [ 110.279192] stackmod is written (2) |
| 3391 | Nov 23 20:05:11 ubuntu-lucid64 kernel: [ 110.279198] stackmod is released |
| 3392 | Nov 23 20:05:16 ubuntu-lucid64 kernel: [ 115.426012] /proc/stackmod is read |
| 3393 | Nov 23 20:05:16 ubuntu-lucid64 kernel: [ 115.426026] /proc/stackmod is read |
| 3394 | Nov 23 20:05:21 ubuntu-lucid64 kernel: [ 120.354789] stackmod is opened |
| 3395 | Nov 23 20:05:21 ubuntu-lucid64 kernel: [ 120.354804] stackmod is written (2) |
| 3396 | Nov 23 20:05:21 ubuntu-lucid64 kernel: [ 120.354989] stackmod is released |
| 3397 | Nov 23 20:05:25 ubuntu-lucid64 kernel: [ 124.989666] /proc/stackmod is read |
| 3398 | Nov 23 20:05:25 ubuntu-lucid64 kernel: [ 124.989681] /proc/stackmod is read |
| 3399 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278525] stackmod is opened |
| 3400 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278792] stackmod is read (32768) |
| 3401 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278802] stackmod is read (32768) |
| 3402 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278806] stackmod is read (32768) |
| 3403 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278810] stackmod is read (32768) |
| 3404 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278813] stackmod is read (32768) |
| 3405 | Nov 23 20:05:34 ubuntu-lucid64 kernel: [ 133.278817] stackmod is released |
| 3406 | Nov 23 20:05:37 ubuntu-lucid64 kernel: [ 136.451935] /proc/stackmod is read |
| 3407 | Nov 23 20:05:37 ubuntu-lucid64 kernel: [ 136.451949] /proc/stackmod is read |
| 3408 | }}} |
| 3409 | |
| 3410 | === test with binary data === |
| 3411 | ==== within 1 stack ==== |
| 3412 | * s0711489@ubuntu-lucid64:~$ dd if=/dev/urandom of=10kb count=10 bs=1024 |
| 3413 | * s0711489@ubuntu-lucid64:~$ cat 10kb > /dev/stack |
| 3414 | * s0711489@ubuntu-lucid64:~$ cat /dev/stack > 10kb.st |
| 3415 | * s0711489@ubuntu-lucid64:~$ ls -l |
| 3416 | {{{ |
| 3417 | total 156 |
| 3418 | -rw-r--r-- 1 s0711489 s0711489 10240 2011-11-23 20:13 10kb |
| 3419 | -rw-r--r-- 1 s0711489 s0711489 10240 2011-11-23 20:15 10kb.st |
| 3420 | -rw-r--r-- 1 s0711489 s0711489 128105 2011-11-23 20:03 stackmod.ko |
| 3421 | }}} |
| 3422 | * s0711489@ubuntu-lucid64:~$ sha1sum -b 10kb* |
| 3423 | {{{ |
| 3424 | 8cc43464af331cd5d56f1db7d44b59530e038ec8 *10kb |
| 3425 | 8cc43464af331cd5d56f1db7d44b59530e038ec8 *10kb.st |
| 3426 | }}} |
| 3427 | |
| 3428 | * s0711489@ubuntu-lucid64:~$ tailf /var/log/kern.log |
| 3429 | {{{ |
| 3430 | Nov 23 20:14:18 ubuntu-lucid64 kernel: [ 657.018652] stackmod is opened |
| 3431 | Nov 23 20:14:18 ubuntu-lucid64 kernel: [ 657.020744] stackmod is written (10240) |
| 3432 | Nov 23 20:14:18 ubuntu-lucid64 kernel: [ 657.020767] stackmod is released |
| 3433 | Nov 23 20:15:05 ubuntu-lucid64 kernel: [ 704.792196] stackmod is opened |
| 3434 | Nov 23 20:15:05 ubuntu-lucid64 kernel: [ 704.792212] stackmod is read (32768) |
| 3435 | Nov 23 20:15:05 ubuntu-lucid64 kernel: [ 704.792275] stackmod is read (32768) |
| 3436 | Nov 23 20:15:05 ubuntu-lucid64 kernel: [ 704.792279] stackmod is released |
| 3437 | }}} |
| 3438 | |
| 3439 | ==== more than one stack ==== |
| 3440 | * s0711489@ubuntu-lucid64:~$ dd if=/dev/urandom of=blob count=10 bs=32768 |
| 3441 | * s0711489@ubuntu-lucid64:~$ sudo insmod stackmod.ko entry=10 |
| 3442 | * s0711489@ubuntu-lucid64:~$ cat blob > /dev/stack |
| 3443 | * s0711489@ubuntu-lucid64:~$ cat /dev/stack > blob.rev |
| 3444 | * s0711489@ubuntu-lucid64:~$ cat blob.rev > /dev/stack |
| 3445 | * s0711489@ubuntu-lucid64:~$ cat /dev/stack > blob.st |
| 3446 | * s0711489@ubuntu-lucid64:~$ sha1sum -b blob* |
| 3447 | {{{ |
| 3448 | d72eb4053f12de4c3c436663dd61679b20c156ac *blob |
| 3449 | 2366d2d5b3c62a647c7eb28ae6708caf064470f4 *blob.rev |
| 3450 | d72eb4053f12de4c3c436663dd61679b20c156ac *blob.st |
| 3451 | }}} |