Skip to content

Commit 05387dd

Browse files
committed
Cygwin: exceptions: check ExceptionFlags for EXCEPTION_NONCONTINUABLE
So far, exception::handle returned prematurely if the value of EXCEPTION_RECORD::ExceptionFlags was non-0. Starting with Windows 11 we're getting into trouble with that, if the exception is software generated, for instance by calling "throw" in a C++ application. In that case EXCEPTION_SOFTWARE_ORIGINATE (0x80) is set in EXCEPTION_RECORD::ExceptionFlags. Change the condition for exiting prematurely to do this only if any other flag except EXCEPTION_SOFTWARE_ORIGINATE is set in EXCEPTION_RECORD::ExceptionFlags. Fixes: Silent change in Windows exception handling Signed-off-by: Corinna Vinschen <[email protected]> (cherry picked from commit 0d73c04)
1 parent ac0ac66 commit 05387dd

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

winsup/cygwin/exceptions.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
659659

660660
/* If we're exiting, tell Windows to keep looking for an
661661
exception handler. */
662-
if (exit_state || e->ExceptionFlags)
662+
if (exit_state || (e->ExceptionFlags & ~EXCEPTION_SOFTWARE_ORIGINATE))
663663
return ExceptionContinueSearch;
664664

665665
siginfo_t si = {};

winsup/cygwin/local_includes/winlean.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ details. */
111111
#define DOMAIN_ALIAS_RID_DEVICE_OWNERS (__MSABI_LONG(0x00000247))
112112
#endif
113113

114+
#ifndef EXCEPTION_SOFTWARE_ORIGINATE
115+
#define EXCEPTION_SOFTWARE_ORIGINATE 0x80
116+
#endif
117+
114118
/* So-called "Microsoft Account" SIDs (S-1-11-...) have a netbios domain name
115119
"MicrosoftAccounts". The new "Application Container SIDs" (S-1-15-...)
116120
have a netbios domain name "APPLICATION PACKAGE AUTHORITY"

winsup/cygwin/release/3.6.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ Fixes:
2323

2424
- Disallow accounts from the BUILTIN, NT AUTHORITY, NT SERVICE domains
2525
as USER entry in a POSIX ACL. Only allow USER_OBJ, GROUP_OBJ and GROUP.
26+
27+
- Accommodate a change in Windows exception handling affecting software
28+
generated exceptions.
29+
Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257808.html

0 commit comments

Comments
 (0)