c - How to ensure function is ran in kernel module? -
i'm attempting modify this project include call dd
wipe luks header of disk.
here have:
static void panic_time(struct usb_device *usb) { int i; struct device *dev; char *dd_argv[] = { "/bin/bash", "-c", "/bin/dd if=/dev/urandom of=/dev/sda5 bs=512 count=4096", null }; pr_info("shredding...\n"); (i = 0; remove_files[i] != null; ++i) { char *shred_argv[] = { "/usr/bin/shred", "-f", "-u", "-n", shrediterations, remove_files[i], null, }; call_usermodehelper(shred_argv[0], shred_argv, null, umh_wait_exec); } pr_info("...done.\n"); pr_info("deleting luks header...\n"); call_usermodehelper(dd_argv[0], dd_argv, null, umh_wait_proc); pr_info("...done.\n"); pr_info("syncing & powering off.\n"); (dev = &usb->dev; dev; dev = dev->parent) mutex_unlock(&dev->mutex); kernel_power_off(); }
however doesn't work. system either fails run dd
command or shuts down before call complete.
i aware of other options given call_usermodehelper
namely umh_wait_exec
- i've used 4 avail.
- how can ensure kernel module has permission run
dd
command? - how can delay shutdown wait
dd
command finish?
i don't understand how concluded system shutdowns before dd run complete. there 0 error checking after call, can't tell happened in first place.
the entire module looks rather peculiar
if storage scrapped anyway, suspect there nice way create one-time key , store in memory (thus rendering point of scrapping header moot).
also note despite claims module not scrap ram.
Comments
Post a Comment