Re: 2.1.104 kmod/sound problem, 2.1.104pre1 was fine.

David Woodhouse (Dave@imladris.demon.co.uk)
Sun, 07 Jun 1998 13:25:47 +0100


tigran@aivazian.demon.co.uk said:
> In 2.1.104 proper I can't get kmod to autoload char-major-14 I get a
> message from kmod saying that it fails to execute "/sbin/modprobe -s
> -k char-major-14"

It needs root privs to do that. Well that's not strictly true any more - it
needs the right capabilities, and kmod was only setting the uid to zero.

Try this, although being security-related it probably ought to be verified by
someone who knows precisely how it all works...

--- linux/kernel/kmod.c.orig Sat Jun 6 17:49:35 1998
+++ linux/kernel/kmod.c Sat Jun 6 18:32:20 1998
@@ -66,8 +66,12 @@
if (current->files->fd[i]) close(i);
}

- set_fs(KERNEL_DS); /* Allow execve args to be in kernel space. */
current->uid = current->euid = current->fsuid = 0;
+ cap_set_full(current->cap_inheritable);
+ cap_set_full(current->cap_effective);
+
+ set_fs(KERNEL_DS); /* Allow execve args to be in kernel space. */
+
if (execve(modprobe_path, argv, envp) < 0) {
printk(KERN_ERR
"kmod: failed to exec %s -s -k %s, errno = %d\n",

---- ---- ----
David Woodhouse, Robinson College, CB3 9AN, England. (+44) 0976 658355
Dave@imladris.demon.co.uk http://www.imladris.demon.co.uk
finger pgp@dwmw2.robinson.cam.ac.uk for PGP key.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu