diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2025-03-31 12:24:34 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2025-03-31 12:24:34 +0200 |
commit | 0d73c040676a44829a9a3614b4013fa50fdc56e8 (patch) | |
tree | 5f55d8622fef23584d8551f369aed4fcc2bc47bc | |
parent | 3955b88056995bcaf9abe96eed6eaae12435c650 (diff) | |
download | newlib-0d73c040676a44829a9a3614b4013fa50fdc56e8.zip newlib-0d73c040676a44829a9a3614b4013fa50fdc56e8.tar.gz newlib-0d73c040676a44829a9a3614b4013fa50fdc56e8.tar.bz2 |
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 <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/exceptions.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/local_includes/winlean.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/release/3.6.1 | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index a3aae2c..49fc166 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -659,7 +659,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, /* If we're exiting, tell Windows to keep looking for an exception handler. */ - if (exit_state || e->ExceptionFlags) + if (exit_state || (e->ExceptionFlags & ~EXCEPTION_SOFTWARE_ORIGINATE)) return ExceptionContinueSearch; siginfo_t si = {}; diff --git a/winsup/cygwin/local_includes/winlean.h b/winsup/cygwin/local_includes/winlean.h index 62b651b..500f569 100644 --- a/winsup/cygwin/local_includes/winlean.h +++ b/winsup/cygwin/local_includes/winlean.h @@ -111,6 +111,10 @@ details. */ #define DOMAIN_ALIAS_RID_DEVICE_OWNERS (__MSABI_LONG(0x00000247)) #endif +#ifndef EXCEPTION_SOFTWARE_ORIGINATE +#define EXCEPTION_SOFTWARE_ORIGINATE 0x80 +#endif + /* So-called "Microsoft Account" SIDs (S-1-11-...) have a netbios domain name "MicrosoftAccounts". The new "Application Container SIDs" (S-1-15-...) have a netbios domain name "APPLICATION PACKAGE AUTHORITY" diff --git a/winsup/cygwin/release/3.6.1 b/winsup/cygwin/release/3.6.1 index 7a6afe6..254cfdd 100644 --- a/winsup/cygwin/release/3.6.1 +++ b/winsup/cygwin/release/3.6.1 @@ -23,3 +23,7 @@ Fixes: - Disallow accounts from the BUILTIN, NT AUTHORITY, NT SERVICE domains as USER entry in a POSIX ACL. Only allow USER_OBJ, GROUP_OBJ and GROUP. + +- Accommodate a change in Windows exception handling affecting software + generated exceptions. + Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257808.html |