x86: MPX and signal handlers

From: Dave Hansen
Date: Tue Mar 03 2015 - 18:28:14 EST


In handle_signal(), while we are setting up to call a signal handler, we do:
/*
* Ensure the signal handler starts with the new fpustate.
*/
if (used_math())
drop_init_fpu(current);

Where drop_init_fpu() actually restores us to the 'init' FPU state
where, of course, MPX will be turned off.

I guess userspace can still just re-enable MPX first thing in its signal
handlers if it really cares, but that definitely breaks the idea that
MPX support can be added with a simple recompilation.

The alternative would be to jam the original configuration register
value (BNDCFGU) in to the signal handler's FPU state from inside the
kernel before calling out to the signal handler.

I _think_ we can just leave it alone and document that you don't get MPX
protections by default in signal handlers. Does anybody disagree?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/