0

我可以在软件 irq 中调用 usermodehelper API 吗?

例如,我想在内核执行时在用户空间执行“pstack”程序watchdog_fire()。我试图调用它,但它总是导致内核崩溃。

watchdog_fire+0xf4/0x138
run_timer_softirq+0x168/0x248
_do_softirq+0x114/0x158
do_softirq+0x68/0x70
plat_irq_dispatch+0xc0/0x180
ret_from_irq+0x0/0x4
4

1 回答 1

1

查看 linux 3.4.4 内核树 (kernel/kmod.c) 中的此注释。这在最近的内核版本中可能会或可能不会改变。注意wait标志。

/**
 * call_usermodehelper_exec - start a usermode application
 * @sub_info: information about the subprocessa
 * @wait: wait for the application to finish and return status.
 *        when -1 don't wait at all, but you get no useful error back when
 *        the program couldn't be exec'ed. This makes it safe to call
 *        from interrupt context.
 *
 * Runs a user-space application.  The application is started
 * asynchronously if wait is not set, and runs as a child of keventd.
 * (ie. it runs with full root capabilities).
 */
int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait)
于 2014-08-22T17:22:25.260 回答