Don't allow MICROCODE built as a modul
PATCH 1/1 Don't allow MICROCODE built as a modul
Hi;
Attached patch [against xen-3.0.3-testing.hg]
fixes "/lib/modules/2.6.12.6-xen/kernel/arch/xen/i386/kernel/microcode.ko needs unknown symbol sys_munlock" problem by not allowing microcode as a module.
Cheers
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
linux-2.6-xen-sparse/arch/i386/Kconfig +1 -1
@@ -387,7 +387,7 @@ config X86_REBOOTFIXUPS Say N otherwise. config MICROCODE - tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support" + bool "/dev/cpu/microcode - Intel IA32 CPU microcode support" depends on !XEN_UNPRIVILEGED_GUEST ---help--- If you say Y here and also to "/dev file system support" in the
linux-2.6-xen-sparse/arch/x86_64/Kconfig +1 -1
@@ -158,7 +158,7 @@ config X86_GOOD_APIC default y config MICROCODE - tristate "/dev/cpu/microcode - Intel CPU microcode support" + bool "/dev/cpu/microcode - Intel CPU microcode support" ---help--- If you say Y here the 'File systems' section, you will be able to update the microcode on Intel processors. You will
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · S.Çağlar Onur
Hi;
Attached patch [against xen-3.0.3-testing.hg]
fixes "/lib/modules/2.6.12.6-xen/kernel/arch/xen/i386/kernel/microcode.koneeds unknown symbolsys_munlock" problem by not allowing microcode as a module.
That's not fixing the underlying problem. Why would the microcode driver require sys_munlock()? I'm sure one of the distros would have provided a patch already if they were seeing this problem.
-- Keir
17 Eki 2006 Sal 22:54 tarihinde, Keir Fraser şunları yazmıştı:
Quoted 3 lines
That's not fixing the underlying problem. Why would the microcode driver require
sys_munlock()? I'm sure one of the distros would have provided a patch already if they were seeing this problem.
Hmm, a little google search shows SUSE already has [1], im not sure original author submits or not but here it is [2]
[1] http://lists.opensuse.org/opensuse-commit/2006-04/msg00962.html
[2] http://cekirdek.pardus.org.tr/~caglar/xen-microcode-modular
Signature · 4 lines
S.Çağlar Onur <[email protected]> http://cekirdek.pardus.org.tr/~caglar/ Linux is like living in a teepee. No Windows, no Gates and an Apache in house!
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 10 lines · S.Çağlar Onur
17 Eki 2006 Sal 22:54 tarihinde, Keir Fraser şunları yazmıştı:
Quoted 3 lines
That's not fixing the underlying problem. Why would the microcode driver require
sys_munlock()? I'm sure one of the distros would have provided a patch already if they were seeing this problem.Hmm, a little google search shows SUSE already has [1], im not sure original author submits or not but here it is [2]
[1] http://lists.opensuse.org/opensuse-commit/2006-04/msg00962.html
[2] http://cekirdek.pardus.org.tr/~caglar/xen-microcode-modular
Ah yes, that looks sensible. Perhaps if we ask nicely Jan will post it to the list with a signed-off-by attribution. :-)
-- Keir
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 17.10.06 22:19 >>>
Quoted 5 lines · S.Ça*lar Onur
17 Eki 2006 Sal 22:54 tarihinde, Keir Fraser *unlar* yazm**t*:
Quoted 3 lines
That's not fixing the underlying problem. Why would the microcode driver require
sys_munlock()? I'm sure one of the distros would have provided a patch already if they were seeing this problem.
Quoted 8 lines
Quoted 5 lines
Hmm, a little google search shows SUSE already has [1], im not sure original author submits or not but here it is [2]
[1] http://lists.opensuse.org/opensuse-commit/2006-04/msg00962.html
[2] http://cekirdek.pardus.org.tr/~caglar/xen-microcode-modularAh yes, that looks sensible. Perhaps if we ask nicely Jan will post it to the list with a signed-off-by attribution. :-)
Eliminating the dependency on sys_m{,un}lock as well as the needless use of static variables.
arch/i386/kernel/microcode-xen.c +17 -23
@@ -50,9 +50,6 @@ MODULE_LICENSE("GPL");/* no concurrent ->write()s are allowed on /dev/cpu/microcode */ static DECLARE_MUTEX (microcode_sem); - -static void __user *user_buffer;/* user area microcode data buffer */ -static unsigned int user_buffer_size;/* it's size */ static int microcode_open (struct inode *unused1,struct file *unused2) {
@@ -60,21 +57,26 @@ static int microcode_open (struct inode } -static int do_microcode_update (void ) +static int do_microcode_update (const void __user *ubuf,size_t len) {int err; -dom0_op_t op; +void *kbuf; - err =sys_mlock ((unsigned long )user_buffer, user_buffer_size); -if (err !=0 ) -return err; - - op.cmd =DOM0_MICROCODE ; -set_xen_guest_handle (op.u.microcode.data, user_buffer); - op.u.microcode.length = user_buffer_size; - err =HYPERVISOR_dom0_op (&op); + kbuf =vmalloc (len); +if (!kbuf) +return -ENOMEM ; + +if (copy_from_user (kbuf, ubuf, len) ==0 ) { +dom0_op_t op; + + op.cmd =DOM0_MICROCODE ; +set_xen_guest_handle (op.u.microcode.data, kbuf); + op.u.microcode.length = len; + err =HYPERVISOR_dom0_op (&op); + }else + err = -EFAULT ; - (void )sys_munlock ((unsigned long )user_buffer, user_buffer_size); +vfree (kbuf);return err; }
@@ -88,17 +90,9 @@ static ssize_t microcode_write (struct freturn -EINVAL ; } -if ((len >>PAGE_SHIFT ) > num_physpages) { -printk (KERN_ERR "microcode: too much data (max %ld pages)\n" , num_physpages); -return -EINVAL ; - } -down (µcode_sem); - user_buffer = (void __user *) buf; - user_buffer_size = (int ) len; - - ret =do_microcode_update (); + ret =do_microcode_update (buf, len);if (!ret) ret = (ssize_t )len;