Re:Why isn't memset() async-signal-safe?
by JoshTriplett on Tuesday January 03, 2017 @05:39PM
(#13313868)
They do, now. On current Intel CPUs, you can use xsave and xrstor to save and load the complete state, including all new state information. Ring 0 code can ask the CPU for the size of that state (via CPUID leaf 0xd), and allocate the appropriate amount of space per task.
[ Parent
| on HN ]
Re:Why isn't memset() async-signal-safe?
by wfunction on Tuesday January 03, 2017 @05:44PM
(#13313924)
Oh wow. When did this change? I vaguely seem to remember that as recently as Windows 7 (or was it 8.0?) there was trouble with AVX2 or something, but I can't find the info anywhere at the moment.
Re:Why isn't memset() async-signal-safe?
by MaulingMonkey on Tuesday January 03, 2017 @06:09PM
(#13314143)
Perhaps you're thinking of this debugger issue?
https://randomascii.wordpress.com/2013/03/11/should-this-win...
Re:Why isn't memset() async-signal-safe?
by wfunction on Tuesday January 03, 2017 @06:18PM
(#13314217)
Ah yes, good find, I believe this was one of them! I don't remember if there were more though, there might have been.
Re:Why isn't memset() async-signal-safe?
by JoshTriplett on Tuesday January 03, 2017 @06:00PM
(#13314065)
An OS can still use xsave incorrectly, such as by hardcoding the expected size rather than detecting it at runtime, or by getting some aspect of the CPUID leaf 0xd enumeration wrong. I wouldn't find it surprising if an initial implementation got one of the details wrong, resulting in a bug that wouldn't manifest until the next time the xsave layout changed.
Re:Why isn't memset() async-signal-safe?
by amelius on Tuesday January 03, 2017 @06:26PM
(#13314269)
The CPU designers could have protected against this by randomly fluctuating the size of the xsave'd data.
Re:Why isn't memset() async-signal-safe?
by monocasa on Wednesday January 04, 2017 @12:41AM
(#13315937)
At the cost of extra bandwidth and interrupt latency.