On Wed, Jan 6, 2016 at 4:33 AM, Borislav Petkov <bp(a)alien8.de> wrote:
On Wed, Dec 30, 2015 at 09:59:29AM -0800, Tony Luck wrote:
> Starting with a patch from Andy Lutomirski <luto(a)amacapital.net>
> that used linker relocation trickery to free up a couple of bits
> in the "fixup" field of the exception table (and generalized the
> uaccess_err hack to use one of the classes).
So I still think that the other idea Andy gave with putting the handler
in the exception table is much cleaner and straightforward.
Here's a totally untested patch which at least builds here. I think this
approach is much more extensible and simpler for the price of a couple
of KBs of __ex_table size.
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 189679aba703..43b509c88b13 100644
@@ -44,18 +44,20 @@
/* Exception table entry */
-# define _ASM_EXTABLE(from,to) \
+# define _ASM_EXTABLE(from,to) \
.pushsection "__ex_table","a" ; \
.balign 8 ; \
.long (from) - . ; \
.long (to) - . ; \
+ .long 0 - .; \
I assume that this zero is to save the couple of bytes for the
relocation entry on relocatable kernels?
If so, ...
+inline ex_handler_t ex_fixup_handler(const struct
+ return (ex_handler_t)&x->handler + x->handler;
I would check for zero here, because...
+ new_ip = ex_fixup_addr(e);
+ handler = ex_fixup_handler(e);
+ if (!handler)
+ handler = ex_handler_default;
the !handler condition here will never trigger because the offset was
Otherwise this looks generally sane.