I have a Kernel module program which executes an userspace app named binary as shown below.
struct subprocess_info *info;
static char *envp[] = {
"HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
NULL
};
static char *binary_path = "/usr/bin/binary";
char **argv = kmalloc(sizeof(char *[2]), GFP_KERNEL);
if (!argv)
return -ENOMEM;
argv[0] = binary_path;
argv[1] = NULL;
info = call_usermodehelper_setup(binary_path, argv, envp, GFP_KERNEL,
NULL, <some_free_function>, NULL);
if (info) {
return call_usermodehelper_exec(info, (UMH_WAIT_PROC | UMH_KILLABLE));
}
This type of design is must for me executing binary as it depends on some /dev/* files.
This is working very fine in normal environment but when I am trying to insmod this binary from a docker then binary is not starting at all.
Binary and its dependent libraries are not in host's rootfs. They are in docker's.
When I moved this binary and dependent libraries to host then every thing is fine.
How can I execute this from docker without any fail.