MPS issue job003917

TitleClear x86 direction flag in exception handler
Statusclosed
Priorityoptional
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionWe use vectored exception handling on Windows. According to a "community addition" [1] on the page documenting AddVectoredExceptionHandler, "A handler registered with AddVectoredExceptionHandler on the x86-32 and x86-64 platforms should clear the x86 "direction flag" at its beginning using the "cld" opcode. If an exception occurs while the direction flag is set, such as during a forward overlapping memmove(), the direction flag will remain on at the time the vectored handler is called. C compilers for Windows assume that the direction flag is clear at function call time, and things like inlined memset() calls will corrupt memory if the direction flag is set. Normal exception handlers with __try are not affected because the C runtime library clears the direction flag."
Analysis According to [2] this was fixed in Windows Vista, so maybe we don't care.
How foundunknown
Evidence[1] https://msdn.microsoft.com/en-us/libra...dows/desktop/ms679274%28v=vs.85%29.aspx
[2] https://code.google.com/p/nativeclient/issues/detail?id=1495
Created byNick Barnes
Created on2015-03-19 12:05:17
Last modified byGareth Rees
Last modified on2020-09-08 10:20:14
History2015-03-19 NB Created.

Fixes

Change Effect Date User Description
194409 closed 2018-07-04 16:46:04 Gareth Rees Merge branch 2018-06-27/job004056.