Oops from new WP test + fix

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Wed Oct 25 2000 - 02:26:56 EST


Test10-pre4 (and up) can die on the new WP test as follows:

  Checking if this processor honours the WP bit even in supervisor mode...
  <1>Unable to handle kernel paging request at virtual address c0000000

I examined the new WP code added to pre4 and even checked the exception
table entries stored in vmlinux by it and it all looked fine. Strange.
Well after a few handfuls of hair, it turns out that the new WP test code
is a red herring - it just happens to be the first thing to cause a
fault and a lookup in the exception table.

It turns out that also in pre4 was a patch to use non-continuous
initialization of the elements in kernel_module. And if modules are
enabled, the exception table for the kernel is obtained from the
kernel_module struct instead of directly. Which is a problem as
gcc-2.7.2 (perhaps others too) now munges the loading of the struct
(it miscalculates the offsets), and voila - you have no exception table.

BTW, while looking at the new WP code, I noticed the "jmp 1f; 1:"
before and after are now gone - the comment above them (which lives on)
indicated they were Deep Magic(tm) to avoid some dark and mysterious
CPU bugs. I take it that science has prevailed over magic? ;-)

Paul.

--- 2400-t10-p5/linux/kernel/module.c~ Tue Oct 24 14:04:52 2000
+++ 2400-t10-p5/linux/kernel/module.c Wed Oct 25 02:20:35 2000
@@ -26,15 +26,29 @@
 extern const struct exception_table_entry __start___ex_table[];
 extern const struct exception_table_entry __stop___ex_table[];
 
+/*
+ * Don't do 'pick and choose' initialization of the structure
+ * elements here or gcc-2.7.2 (and others?) can mess it up and
+ * you will wonder where your exception table went... Paul G.
+ */
 static struct module kernel_module =
 {
- size_of_struct: sizeof(struct module),
- name: "",
- uc: {ATOMIC_INIT(1)},
- flags: MOD_RUNNING,
- syms: __start___ksymtab,
- ex_table_start: __start___ex_table,
- ex_table_end: __stop___ex_table
+ sizeof(struct module), /* size_of_struct */
+ NULL, /* next */
+ "", /* name */
+ 0, /* size */
+ {ATOMIC_INIT(1)}, /* usecount */
+ MOD_RUNNING, /* flags */
+ 0, /* nsyms -- to filled in in init_modules */
+ 0, /* ndeps */
+ __start___ksymtab, /* syms */
+ NULL, /* deps */
+ NULL, /* refs */
+ NULL, /* init */
+ NULL, /* cleanup */
+ __start___ex_table, /* ex_table_start */
+ __stop___ex_table, /* ex_table_end */
+ /* Rest are NULL */
 };
 
 struct module *module_list = &kernel_module;

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 31 2000 - 21:00:15 EST