winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
629 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Handle trap exception in signal handler on ARM64.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: a7459d0c99677be0df238236e0c5d555fe8d9dc1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a7459d0c99677be0df238236…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 21:23:15 2019 +0200 ntdll: Handle trap exception in signal handler on ARM64. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_arm64.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index a029960ba4..40ef517d22 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -540,17 +540,6 @@ done: set_cpu_context( context ); } -/********************************************************************** - * raise_trap_exception - */ -static void WINAPI raise_trap_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) -{ - NTSTATUS status; - if (rec->ExceptionCode == EXCEPTION_BREAKPOINT) context->Pc += 4; - status = NtRaiseException( rec, context, TRUE ); - raise_status( status, rec ); -} - /********************************************************************** * raise_generic_exception */ @@ -1110,9 +1099,10 @@ static void trap_handler( int signal, siginfo_t *info, void *ucontext ) case TRAP_BRKPT: default: stack->rec.ExceptionCode = EXCEPTION_BREAKPOINT; + stack->context.Pc += 4; break; } - setup_raise_exception( context, stack, raise_trap_exception ); + setup_raise_exception( context, stack, raise_generic_exception ); } /**********************************************************************
1
0
0
0
Alexandre Julliard : ntdll: Factor out setup_raise_exception() on ARM64.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 769c333c6c67721d9f78edc7c7efd70d8700de22 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=769c333c6c67721d9f78edc7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 21:15:49 2019 +0200 ntdll: Factor out setup_raise_exception() on ARM64. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_arm64.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 3194cc82b6..a029960ba4 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -484,7 +484,7 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) * * Setup the exception record and context on the thread stack. */ -static struct stack_layout *setup_exception( ucontext_t *sigcontext, raise_func func ) +static struct stack_layout *setup_exception( ucontext_t *sigcontext ) { struct stack_layout *stack; DWORD exception_code = 0; @@ -500,14 +500,20 @@ static struct stack_layout *setup_exception( ucontext_t *sigcontext, raise_func save_context( &stack->context, sigcontext ); save_fpu( &stack->context, sigcontext ); + return stack; +} - /* now modify the sigcontext to return to the raise function */ +/*********************************************************************** + * setup_raise_exception + * + * Modify the signal context to call the exception raise function. + */ +static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *stack, raise_func func ) +{ SP_sig(sigcontext) = (ULONG_PTR)stack; PC_sig(sigcontext) = (ULONG_PTR)func; REGn_sig(0, sigcontext) = (ULONG_PTR)&stack->rec; /* first arg for raise_func */ REGn_sig(1, sigcontext) = (ULONG_PTR)&stack->context; /* second arg for raise_func */ - - return stack; } /********************************************************************** @@ -1054,14 +1060,14 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) case 1: /* handled */ return; case -1: /* overflow */ - stack = setup_exception( context, raise_segv_exception ); + stack = setup_exception( context ); stack->rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW; - return; + goto done; } } - stack = setup_exception( context, raise_segv_exception ); - if (stack->rec.ExceptionCode == EXCEPTION_STACK_OVERFLOW) return; + stack = setup_exception( context ); + if (stack->rec.ExceptionCode == EXCEPTION_STACK_OVERFLOW) goto done; switch(signal) { @@ -1082,6 +1088,8 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) stack->rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; break; } +done: + setup_raise_exception( context, stack, raise_segv_exception ); } /********************************************************************** @@ -1092,7 +1100,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) static void trap_handler( int signal, siginfo_t *info, void *ucontext ) { ucontext_t *context = ucontext; - struct stack_layout *stack = setup_exception( context, raise_trap_exception ); + struct stack_layout *stack = setup_exception( context ); switch (info->si_code) { @@ -1104,6 +1112,7 @@ static void trap_handler( int signal, siginfo_t *info, void *ucontext ) stack->rec.ExceptionCode = EXCEPTION_BREAKPOINT; break; } + setup_raise_exception( context, stack, raise_trap_exception ); } /********************************************************************** @@ -1113,7 +1122,7 @@ static void trap_handler( int signal, siginfo_t *info, void *ucontext ) */ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { - struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext ); switch (siginfo->si_code & 0xffff ) { @@ -1159,6 +1168,7 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) stack->rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION; break; } + setup_raise_exception( sigcontext, stack, raise_generic_exception ); } /********************************************************************** @@ -1170,9 +1180,10 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { if (!dispatch_signal(SIGINT)) { - struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext ); stack->rec.ExceptionCode = CONTROL_C_EXIT; + setup_raise_exception( sigcontext, stack, raise_generic_exception ); } } @@ -1184,10 +1195,11 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ static void abrt_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { - struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext ); stack->rec.ExceptionCode = EXCEPTION_WINE_ASSERTION; stack->rec.ExceptionFlags = EH_NONCONTINUABLE; + setup_raise_exception( sigcontext, stack, raise_generic_exception ); }
1
0
0
0
Alexandre Julliard : ntdll: Use a stack_layout structure to build exception data on ARM64.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 7736f3837e4b22606ffff590cfa99c2f58dc8a0f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7736f3837e4b22606ffff590…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 21:07:14 2019 +0200 ntdll: Use a stack_layout structure to build exception data on ARM64. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_arm64.c | 80 +++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index ebba8e9cae..3194cc82b6 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -114,6 +114,15 @@ static const size_t teb_size = 0x2000; /* we reserve two pages for the TEB */ static const size_t signal_stack_size = max( MINSIGSTKSZ, 8192 ); typedef void (WINAPI *raise_func)( EXCEPTION_RECORD *rec, CONTEXT *context ); + +/* stack layout when calling an exception raise function */ +struct stack_layout +{ + CONTEXT context; + EXCEPTION_RECORD rec; + void *redzone[2]; +}; + typedef int (*wine_signal_handler)(unsigned int sig); static wine_signal_handler handlers[256]; @@ -471,18 +480,13 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context ) /*********************************************************************** - * setup_exception_record + * setup_exception * * Setup the exception record and context on the thread stack. */ -static EXCEPTION_RECORD *setup_exception( ucontext_t *sigcontext, raise_func func ) +static struct stack_layout *setup_exception( ucontext_t *sigcontext, raise_func func ) { - struct stack_layout - { - CONTEXT context; - EXCEPTION_RECORD rec; - void *redzone[2]; - } *stack; + struct stack_layout *stack; DWORD exception_code = 0; /* push the stack_layout structure */ @@ -503,7 +507,7 @@ static EXCEPTION_RECORD *setup_exception( ucontext_t *sigcontext, raise_func fun REGn_sig(0, sigcontext) = (ULONG_PTR)&stack->rec; /* first arg for raise_func */ REGn_sig(1, sigcontext) = (ULONG_PTR)&stack->context; /* second arg for raise_func */ - return &stack->rec; + return stack; } /********************************************************************** @@ -1039,7 +1043,7 @@ static NTSTATUS raise_exception( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL f */ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) { - EXCEPTION_RECORD *rec; + struct stack_layout *stack; ucontext_t *context = ucontext; /* check for page fault inside the thread stack */ @@ -1050,32 +1054,32 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) case 1: /* handled */ return; case -1: /* overflow */ - rec = setup_exception( context, raise_segv_exception ); - rec->ExceptionCode = EXCEPTION_STACK_OVERFLOW; + stack = setup_exception( context, raise_segv_exception ); + stack->rec.ExceptionCode = EXCEPTION_STACK_OVERFLOW; return; } } - rec = setup_exception( context, raise_segv_exception ); - if (rec->ExceptionCode == EXCEPTION_STACK_OVERFLOW) return; + stack = setup_exception( context, raise_segv_exception ); + if (stack->rec.ExceptionCode == EXCEPTION_STACK_OVERFLOW) return; switch(signal) { case SIGILL: /* Invalid opcode exception */ - rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; + stack->rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; break; case SIGSEGV: /* Segmentation fault */ - rec->ExceptionCode = EXCEPTION_ACCESS_VIOLATION; - rec->NumberParameters = 2; - rec->ExceptionInformation[0] = (get_fault_esr( context ) & 0x40) != 0; - rec->ExceptionInformation[1] = (ULONG_PTR)info->si_addr; + stack->rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION; + stack->rec.NumberParameters = 2; + stack->rec.ExceptionInformation[0] = (get_fault_esr( context ) & 0x40) != 0; + stack->rec.ExceptionInformation[1] = (ULONG_PTR)info->si_addr; break; case SIGBUS: /* Alignment check exception */ - rec->ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT; + stack->rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT; break; default: ERR("Got unexpected signal %i\n", signal); - rec->ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; + stack->rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; break; } } @@ -1088,16 +1092,16 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext ) static void trap_handler( int signal, siginfo_t *info, void *ucontext ) { ucontext_t *context = ucontext; - EXCEPTION_RECORD *rec = setup_exception( context, raise_trap_exception ); + struct stack_layout *stack = setup_exception( context, raise_trap_exception ); switch (info->si_code) { case TRAP_TRACE: - rec->ExceptionCode = EXCEPTION_SINGLE_STEP; + stack->rec.ExceptionCode = EXCEPTION_SINGLE_STEP; break; case TRAP_BRKPT: default: - rec->ExceptionCode = EXCEPTION_BREAKPOINT; + stack->rec.ExceptionCode = EXCEPTION_BREAKPOINT; break; } } @@ -1109,50 +1113,50 @@ static void trap_handler( int signal, siginfo_t *info, void *ucontext ) */ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { - EXCEPTION_RECORD *rec = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); switch (siginfo->si_code & 0xffff ) { #ifdef FPE_FLTSUB case FPE_FLTSUB: - rec->ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED; + stack->rec.ExceptionCode = EXCEPTION_ARRAY_BOUNDS_EXCEEDED; break; #endif #ifdef FPE_INTDIV case FPE_INTDIV: - rec->ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO; + stack->rec.ExceptionCode = EXCEPTION_INT_DIVIDE_BY_ZERO; break; #endif #ifdef FPE_INTOVF case FPE_INTOVF: - rec->ExceptionCode = EXCEPTION_INT_OVERFLOW; + stack->rec.ExceptionCode = EXCEPTION_INT_OVERFLOW; break; #endif #ifdef FPE_FLTDIV case FPE_FLTDIV: - rec->ExceptionCode = EXCEPTION_FLT_DIVIDE_BY_ZERO; + stack->rec.ExceptionCode = EXCEPTION_FLT_DIVIDE_BY_ZERO; break; #endif #ifdef FPE_FLTOVF case FPE_FLTOVF: - rec->ExceptionCode = EXCEPTION_FLT_OVERFLOW; + stack->rec.ExceptionCode = EXCEPTION_FLT_OVERFLOW; break; #endif #ifdef FPE_FLTUND case FPE_FLTUND: - rec->ExceptionCode = EXCEPTION_FLT_UNDERFLOW; + stack->rec.ExceptionCode = EXCEPTION_FLT_UNDERFLOW; break; #endif #ifdef FPE_FLTRES case FPE_FLTRES: - rec->ExceptionCode = EXCEPTION_FLT_INEXACT_RESULT; + stack->rec.ExceptionCode = EXCEPTION_FLT_INEXACT_RESULT; break; #endif #ifdef FPE_FLTINV case FPE_FLTINV: #endif default: - rec->ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION; + stack->rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION; break; } } @@ -1166,9 +1170,9 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { if (!dispatch_signal(SIGINT)) { - EXCEPTION_RECORD *rec = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); - rec->ExceptionCode = CONTROL_C_EXIT; + stack->rec.ExceptionCode = CONTROL_C_EXIT; } } @@ -1180,10 +1184,10 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) */ static void abrt_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { - EXCEPTION_RECORD *rec = setup_exception( sigcontext, raise_generic_exception ); + struct stack_layout *stack = setup_exception( sigcontext, raise_generic_exception ); - rec->ExceptionCode = EXCEPTION_WINE_ASSERTION; - rec->ExceptionFlags = EH_NONCONTINUABLE; + stack->rec.ExceptionCode = EXCEPTION_WINE_ASSERTION; + stack->rec.ExceptionFlags = EH_NONCONTINUABLE; }
1
0
0
0
Alexandre Julliard : ntdll: Remove no longer needed function argument from setup_raise_exception() on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: d9ec920fd9234a1cc257264bae5a5a41d3a760b2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d9ec920fd9234a1cc257264b…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 21:02:29 2019 +0200 ntdll: Remove no longer needed function argument from setup_raise_exception() on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 56 +++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 11ef7c393a..8876790195 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -422,9 +422,9 @@ typedef struct trapframe ucontext_t; /* stack layout when calling an exception raise function */ struct stack_layout { - void *ret_addr; /* return address from raise_func */ - EXCEPTION_RECORD *rec_ptr; /* first arg for raise_func */ - CONTEXT *context_ptr; /* second arg for raise_func */ + void *ret_addr; /* return address from raise_generic_exception */ + EXCEPTION_RECORD *rec_ptr; /* first arg for raise_generic_exception */ + CONTEXT *context_ptr; /* second arg for raise_generic_exception */ CONTEXT context; EXCEPTION_RECORD rec; DWORD ebp; @@ -804,8 +804,6 @@ static int solaris_sigaction( int sig, const struct sigaction *new, struct sigac #endif -typedef void (WINAPI *raise_func)( EXCEPTION_RECORD *rec, CONTEXT *context ); - extern void clear_alignment_flag(void); __ASM_GLOBAL_FUNC( clear_alignment_flag, "pushfl\n\t" @@ -1852,15 +1850,29 @@ static struct stack_layout *setup_exception( ucontext_t *sigcontext ) } +/********************************************************************** + * raise_generic_exception + * + * Generic raise function for exceptions that don't need special treatment. + */ +static void WINAPI raise_generic_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) +{ + NTSTATUS status; + + status = NtRaiseException( rec, context, TRUE ); + raise_status( status, rec ); +} + + /*********************************************************************** * setup_raise_exception * * Change context to setup a call to a raise exception function. */ -static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *stack, raise_func func ) +static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout *stack ) { ESP_sig(sigcontext) = (DWORD)stack; - EIP_sig(sigcontext) = (DWORD)func; + EIP_sig(sigcontext) = (DWORD)raise_generic_exception; /* clear single-step, direction, and align check flag */ EFL_sig(sigcontext) &= ~(0x100|0x400|0x40000); CS_sig(sigcontext) = wine_get_cs(); @@ -1869,8 +1881,8 @@ static void setup_raise_exception( ucontext_t *sigcontext, struct stack_layout * FS_sig(sigcontext) = wine_get_fs(); GS_sig(sigcontext) = wine_get_gs(); SS_sig(sigcontext) = wine_get_ss(); - stack->ret_addr = (void *)0xdeadbabe; /* raise_func must not return */ - stack->rec_ptr = &stack->rec; /* arguments for raise_func */ + stack->ret_addr = (void *)0xdeadbabe; /* raise_generic_exception must not return */ + stack->rec_ptr = &stack->rec; /* arguments for raise_generic_exception */ stack->context_ptr = &stack->context; } @@ -1900,20 +1912,6 @@ static inline DWORD get_fpu_code( const CONTEXT *context ) } -/********************************************************************** - * raise_generic_exception - * - * Generic raise function for exceptions that don't need special treatment. - */ -static void WINAPI raise_generic_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) -{ - NTSTATUS status; - - status = NtRaiseException( rec, context, TRUE ); - raise_status( status, rec ); -} - - /*********************************************************************** * handle_interrupt * @@ -1945,7 +1943,7 @@ static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, st stack->rec.ExceptionInformation[0] = stack->context.Eax; stack->rec.ExceptionInformation[1] = stack->context.Ecx; stack->rec.ExceptionInformation[2] = stack->context.Edx; - setup_raise_exception( sigcontext, stack, raise_generic_exception ); + setup_raise_exception( sigcontext, stack ); return TRUE; default: return FALSE; @@ -2068,7 +2066,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) break; } done: - setup_raise_exception( context, stack, raise_generic_exception ); + setup_raise_exception( context, stack ); } @@ -2110,7 +2108,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext ) stack->rec.ExceptionInformation[2] = 0; /* FIXME */ break; } - setup_raise_exception( context, stack, raise_generic_exception ); + setup_raise_exception( context, stack ); } @@ -2156,7 +2154,7 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext ) break; } - setup_raise_exception( context, stack, raise_generic_exception ); + setup_raise_exception( context, stack ); } @@ -2175,7 +2173,7 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { struct stack_layout *stack = setup_exception( sigcontext ); stack->rec.ExceptionCode = CONTROL_C_EXIT; - setup_raise_exception( sigcontext, stack, raise_generic_exception ); + setup_raise_exception( sigcontext, stack ); } } @@ -2189,7 +2187,7 @@ static void abrt_handler( int signal, siginfo_t *siginfo, void *sigcontext ) struct stack_layout *stack = setup_exception( sigcontext ); stack->rec.ExceptionCode = EXCEPTION_WINE_ASSERTION; stack->rec.ExceptionFlags = EH_NONCONTINUABLE; - setup_raise_exception( sigcontext, stack, raise_generic_exception ); + setup_raise_exception( sigcontext, stack ); }
1
0
0
0
Alexandre Julliard : ntdll: Handle ATL thunk emulation in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 5501055ed585a9f0045d387a69ab5049af5797d6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5501055ed585a9f0045d387a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 20:50:16 2019 +0200 ntdll: Handle ATL thunk emulation in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 109 +++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 66 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 587940c032..11ef7c393a 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1682,9 +1682,9 @@ union atl_thunk * * Check if code destination is an ATL thunk, and emulate it if so. */ -static BOOL check_atl_thunk( EXCEPTION_RECORD *rec, CONTEXT *context ) +static BOOL check_atl_thunk( ucontext_t *sigcontext, struct stack_layout *stack ) { - const union atl_thunk *thunk = (const union atl_thunk *)rec->ExceptionInformation[1]; + const union atl_thunk *thunk = (const union atl_thunk *)stack->rec.ExceptionInformation[1]; union atl_thunk thunk_copy; SIZE_T thunk_len; @@ -1694,62 +1694,61 @@ static BOOL check_atl_thunk( EXCEPTION_RECORD *rec, CONTEXT *context ) if (thunk_len >= sizeof(thunk_copy.t1) && thunk_copy.t1.movl == 0x042444c7 && thunk_copy.t1.jmp == 0xe9) { - if (!virtual_uninterrupted_write_memory( (DWORD *)context->Esp + 1, + if (!virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1, &thunk_copy.t1.this, sizeof(DWORD) )) { - context->Eip = (DWORD_PTR)(&thunk->t1.func + 1) + thunk_copy.t1.func; + EIP_sig(sigcontext) = (DWORD_PTR)(&thunk->t1.func + 1) + thunk_copy.t1.func; TRACE( "emulating ATL thunk type 1 at %p, func=%08x arg=%08x\n", - thunk, context->Eip, thunk_copy.t1.this ); + thunk, EIP_sig(sigcontext), thunk_copy.t1.this ); return TRUE; } } else if (thunk_len >= sizeof(thunk_copy.t2) && thunk_copy.t2.movl == 0xb9 && thunk_copy.t2.jmp == 0xe9) { - context->Ecx = thunk_copy.t2.this; - context->Eip = (DWORD_PTR)(&thunk->t2.func + 1) + thunk_copy.t2.func; + ECX_sig(sigcontext) = thunk_copy.t2.this; + EIP_sig(sigcontext) = (DWORD_PTR)(&thunk->t2.func + 1) + thunk_copy.t2.func; TRACE( "emulating ATL thunk type 2 at %p, func=%08x ecx=%08x\n", - thunk, context->Eip, context->Ecx ); + thunk, EIP_sig(sigcontext), ECX_sig(sigcontext) ); return TRUE; } else if (thunk_len >= sizeof(thunk_copy.t3) && thunk_copy.t3.movl1 == 0xba && thunk_copy.t3.movl2 == 0xb9 && thunk_copy.t3.jmp == 0xe1ff) { - context->Edx = thunk_copy.t3.this; - context->Ecx = thunk_copy.t3.func; - context->Eip = thunk_copy.t3.func; + EDX_sig(sigcontext) = thunk_copy.t3.this; + ECX_sig(sigcontext) = thunk_copy.t3.func; + EIP_sig(sigcontext) = thunk_copy.t3.func; TRACE( "emulating ATL thunk type 3 at %p, func=%08x ecx=%08x edx=%08x\n", - thunk, context->Eip, context->Ecx, context->Edx ); + thunk, EIP_sig(sigcontext), ECX_sig(sigcontext), EDX_sig(sigcontext) ); return TRUE; } else if (thunk_len >= sizeof(thunk_copy.t4) && thunk_copy.t4.movl1 == 0xb9 && thunk_copy.t4.movl2 == 0xb8 && thunk_copy.t4.jmp == 0xe0ff) { - context->Ecx = thunk_copy.t4.this; - context->Eax = thunk_copy.t4.func; - context->Eip = thunk_copy.t4.func; + ECX_sig(sigcontext) = thunk_copy.t4.this; + EAX_sig(sigcontext) = thunk_copy.t4.func; + EIP_sig(sigcontext) = thunk_copy.t4.func; TRACE( "emulating ATL thunk type 4 at %p, func=%08x eax=%08x ecx=%08x\n", - thunk, context->Eip, context->Eax, context->Ecx ); + thunk, EIP_sig(sigcontext), EAX_sig(sigcontext), ECX_sig(sigcontext) ); return TRUE; } else if (thunk_len >= sizeof(thunk_copy.t5) && thunk_copy.t5.inst1 == 0xff515859 && thunk_copy.t5.inst2 == 0x0460) { - DWORD func, stack[2]; - if (virtual_uninterrupted_read_memory( (DWORD *)context->Esp, - stack, sizeof(stack) ) == sizeof(stack) && - virtual_uninterrupted_read_memory( (DWORD *)stack[1] + 1, - &func, sizeof(DWORD) ) == sizeof(DWORD) && - !virtual_uninterrupted_write_memory( (DWORD *)context->Esp + 1, &stack[0], sizeof(stack[0]) )) + DWORD func, sp[2]; + if (virtual_uninterrupted_read_memory( (DWORD *)stack->context.Esp, sp, sizeof(sp) ) == sizeof(sp) && + virtual_uninterrupted_read_memory( (DWORD *)sp[1] + 1, &func, sizeof(DWORD) ) == sizeof(DWORD) && + !virtual_uninterrupted_write_memory( (DWORD *)stack->context.Esp + 1, &sp[0], sizeof(sp[0]) )) { - context->Ecx = stack[0]; - context->Eax = stack[1]; - context->Esp = context->Esp + sizeof(DWORD); - context->Eip = func; + ECX_sig(sigcontext) = sp[0]; + EAX_sig(sigcontext) = sp[1]; + ESP_sig(sigcontext) += sizeof(DWORD); + EIP_sig(sigcontext) = func; TRACE( "emulating ATL thunk type 5 at %p, func=%08x eax=%08x ecx=%08x esp=%08x\n", - thunk, context->Eip, context->Eax, context->Ecx, context->Esp ); + thunk, EIP_sig(sigcontext), EAX_sig(sigcontext), + ECX_sig(sigcontext), ESP_sig(sigcontext) ); return TRUE; } } @@ -1901,41 +1900,6 @@ static inline DWORD get_fpu_code( const CONTEXT *context ) } -/********************************************************************** - * raise_segv_exception - */ -static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) -{ - NTSTATUS status; - - switch(rec->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - if (rec->NumberParameters == 2) - { - if (rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT) - { - ULONG flags; - NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, - &flags, sizeof(flags), NULL ); - - if (!(flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION) && check_atl_thunk( rec, context )) - goto done; - - /* send EXCEPTION_EXECUTE_FAULT only if data execution prevention is enabled */ - if (!(flags & MEM_EXECUTE_OPTION_DISABLE)) - rec->ExceptionInformation[0] = EXCEPTION_READ_FAULT; - } - } - break; - } - status = NtRaiseException( rec, context, TRUE ); - raise_status( status, rec ); -done: - set_cpu_context( context ); -} - - /********************************************************************** * raise_generic_exception * @@ -2065,9 +2029,22 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) stack->rec.NumberParameters = 2; stack->rec.ExceptionInformation[0] = (get_error_code(context) >> 1) & 0x09; stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr; - if (!(stack->rec.ExceptionCode = virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1], - stack->rec.ExceptionInformation[0], FALSE ))) - return; + stack->rec.ExceptionCode = virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1], + stack->rec.ExceptionInformation[0], FALSE ); + if (!stack->rec.ExceptionCode) return; + if (stack->rec.ExceptionCode == EXCEPTION_ACCESS_VIOLATION && + stack->rec.ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT) + { + ULONG flags; + NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, + &flags, sizeof(flags), NULL ); + if (!(flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION) && check_atl_thunk( context, stack )) + return; + + /* send EXCEPTION_EXECUTE_FAULT only if data execution prevention is enabled */ + if (!(flags & MEM_EXECUTE_OPTION_DISABLE)) + stack->rec.ExceptionInformation[0] = EXCEPTION_READ_FAULT; + } break; case TRAP_x86_ALIGNFLT: /* Alignment check exception */ /* FIXME: pass through exception handler first? */ @@ -2091,7 +2068,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) break; } done: - setup_raise_exception( context, stack, raise_segv_exception ); + setup_raise_exception( context, stack, raise_generic_exception ); }
1
0
0
0
Alexandre Julliard : ntdll: Handle page faults in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: df3fad6383e79d1485413ad549c55240843d2418 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=df3fad6383e79d1485413ad5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 20:36:50 2019 +0200 ntdll: Handle page faults in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 9511255754..587940c032 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1913,11 +1913,7 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context case EXCEPTION_ACCESS_VIOLATION: if (rec->NumberParameters == 2) { - if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1], - rec->ExceptionInformation[0], FALSE ))) - goto done; - if (rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && - rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT) + if (rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT) { ULONG flags; NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, @@ -2066,10 +2062,12 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) } break; case TRAP_x86_PAGEFLT: /* Page fault */ - stack->rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION; stack->rec.NumberParameters = 2; stack->rec.ExceptionInformation[0] = (get_error_code(context) >> 1) & 0x09; stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr; + if (!(stack->rec.ExceptionCode = virtual_handle_fault( (void *)stack->rec.ExceptionInformation[1], + stack->rec.ExceptionInformation[0], FALSE ))) + return; break; case TRAP_x86_ALIGNFLT: /* Alignment check exception */ /* FIXME: pass through exception handler first? */
1
0
0
0
Alexandre Julliard : ntdll: Handle invalid %gs fault in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 58139dcb125390b9a2bcd79869d571337d8ab3d8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=58139dcb125390b9a2bcd798…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 20:00:48 2019 +0200 ntdll: Handle invalid %gs fault in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 9ce318c27d..9511255754 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1594,18 +1594,19 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) * * Check for fault caused by invalid %gs value (some copy protection schemes mess with it). */ -static inline BOOL check_invalid_gs( CONTEXT *context ) +static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context ) { - unsigned int prefix_count = 0; - const BYTE *instr = (BYTE *)context->Eip; + BYTE instr[14]; + unsigned int i, len; WORD system_gs = x86_thread_data()->gs; if (context->SegGs == system_gs) return FALSE; if (!wine_ldt_is_system( context->SegCs )) return FALSE; /* only handle faults in system libraries */ - if (virtual_is_valid_code_address( instr, 1 )) return FALSE; + if (virtual_is_valid_code_address( (BYTE *)context->Eip, 1 )) return FALSE; - for (;;) switch(*instr) + len = virtual_uninterrupted_read_memory( (BYTE *)context->Eip, instr, sizeof(instr) ); + for (i = 0; i < len; i++) switch (instr[i]) { /* instruction prefixes */ case 0x2e: /* %cs: */ @@ -1618,16 +1619,17 @@ static inline BOOL check_invalid_gs( CONTEXT *context ) case 0xf0: /* lock */ case 0xf2: /* repne */ case 0xf3: /* repe */ - if (++prefix_count >= 15) return FALSE; - instr++; continue; case 0x65: /* %gs: */ TRACE( "%04x/%04x at %p, fixing up\n", context->SegGs, system_gs, instr ); - context->SegGs = system_gs; +#ifdef GS_sig + GS_sig(sigcontext) = system_gs; +#endif return TRUE; default: return FALSE; } + return FALSE; } @@ -1911,8 +1913,6 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context case EXCEPTION_ACCESS_VIOLATION: if (rec->NumberParameters == 2) { - if (rec->ExceptionInformation[1] == 0xffffffff && check_invalid_gs( context )) - goto done; if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1], rec->ExceptionInformation[0], FALSE ))) goto done; @@ -2059,7 +2059,10 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) if ((err & 7) == 4 && !wine_ldt_is_system( err | 7 )) stack->rec.ExceptionInformation[1] = err & ~7; else + { stack->rec.ExceptionInformation[1] = 0xffffffff; + if (check_invalid_gs( context, &stack->context )) return; + } } break; case TRAP_x86_PAGEFLT: /* Page fault */
1
0
0
0
Alexandre Julliard : ntdll: Handle breakpoint interrupt in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 0bd24653266dd4cb3c232748f2b0ad115af60092 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0bd24653266dd4cb3c232748…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 19:48:48 2019 +0200 ntdll: Handle breakpoint interrupt in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 80 ++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 4087b9b0c1..9ce318c27d 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1589,30 +1589,6 @@ static inline DWORD is_privileged_instr( CONTEXT *context ) } -/*********************************************************************** - * handle_interrupt - * - * Handle an interrupt. - */ -static inline BOOL handle_interrupt( unsigned int interrupt, EXCEPTION_RECORD *rec, CONTEXT *context ) -{ - switch(interrupt) - { - case 0x2d: - context->Eip += 3; - rec->ExceptionCode = EXCEPTION_BREAKPOINT; - rec->ExceptionAddress = (void *)context->Eip; - rec->NumberParameters = is_wow64 ? 1 : 3; - rec->ExceptionInformation[0] = context->Eax; - rec->ExceptionInformation[1] = context->Ecx; - rec->ExceptionInformation[2] = context->Edx; - return TRUE; - default: - return FALSE; - } -} - - /*********************************************************************** * check_invalid_gs * @@ -1956,21 +1932,6 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context } } break; - case EXCEPTION_BREAKPOINT: - if (!is_wow64) - { - /* On Wow64, the upper DWORD of Rax contains garbage, and the debug - * service is usually not recognized when called from usermode. */ - switch (rec->ExceptionInformation[0]) - { - case 1: /* BREAKPOINT_PRINT */ - case 3: /* BREAKPOINT_LOAD_SYMBOLS */ - case 4: /* BREAKPOINT_UNLOAD_SYMBOLS */ - case 5: /* BREAKPOINT_COMMAND_STRING (>= Win2003) */ - goto done; - } - } - break; } status = NtRaiseException( rec, context, TRUE ); raise_status( status, rec ); @@ -1993,6 +1954,45 @@ static void WINAPI raise_generic_exception( EXCEPTION_RECORD *rec, CONTEXT *cont } +/*********************************************************************** + * handle_interrupt + * + * Handle an interrupt. + */ +static BOOL handle_interrupt( unsigned int interrupt, ucontext_t *sigcontext, struct stack_layout *stack ) +{ + switch(interrupt) + { + case 0x2d: + if (!is_wow64) + { + /* On Wow64, the upper DWORD of Rax contains garbage, and the debug + * service is usually not recognized when called from usermode. */ + switch (stack->context.Eax) + { + case 1: /* BREAKPOINT_PRINT */ + case 3: /* BREAKPOINT_LOAD_SYMBOLS */ + case 4: /* BREAKPOINT_UNLOAD_SYMBOLS */ + case 5: /* BREAKPOINT_COMMAND_STRING (>= Win2003) */ + EIP_sig(sigcontext) += 3; + return TRUE; + } + } + stack->context.Eip += 3; + stack->rec.ExceptionCode = EXCEPTION_BREAKPOINT; + stack->rec.ExceptionAddress = (void *)stack->context.Eip; + stack->rec.NumberParameters = is_wow64 ? 1 : 3; + stack->rec.ExceptionInformation[0] = stack->context.Eax; + stack->rec.ExceptionInformation[1] = stack->context.Ecx; + stack->rec.ExceptionInformation[2] = stack->context.Edx; + setup_raise_exception( sigcontext, stack, raise_generic_exception ); + return TRUE; + default: + return FALSE; + } +} + + /********************************************************************** * segv_handler * @@ -2051,7 +2051,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { WORD err = get_error_code(context); if (!err && (stack->rec.ExceptionCode = is_privileged_instr( &stack->context ))) break; - if ((err & 7) == 2 && handle_interrupt( err >> 3, &stack->rec, &stack->context )) break; + if ((err & 7) == 2 && handle_interrupt( err >> 3, context, stack )) return; stack->rec.ExceptionCode = EXCEPTION_ACCESS_VIOLATION; stack->rec.NumberParameters = 2; stack->rec.ExceptionInformation[0] = 0;
1
0
0
0
Alexandre Julliard : ntdll: Handle alignment fault in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 846de4aef8bebcd165223d5f0d1ad6363cab739c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=846de4aef8bebcd165223d5f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 19:34:04 2019 +0200 ntdll: Handle alignment fault in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 580bfb2d5c..4087b9b0c1 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1956,15 +1956,6 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context } } break; - case EXCEPTION_DATATYPE_MISALIGNMENT: - /* FIXME: pass through exception handler first? */ - if (context->EFlags & 0x00040000) - { - /* Disable AC flag, return */ - context->EFlags &= ~0x00040000; - goto done; - } - break; case EXCEPTION_BREAKPOINT: if (!is_wow64) { @@ -2078,6 +2069,12 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext ) stack->rec.ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr; break; case TRAP_x86_ALIGNFLT: /* Alignment check exception */ + /* FIXME: pass through exception handler first? */ + if (stack->context.EFlags & 0x00040000) + { + EFL_sig(context) &= ~0x00040000; /* disable AC flag */ + return; + } stack->rec.ExceptionCode = EXCEPTION_DATATYPE_MISALIGNMENT; break; default:
1
0
0
0
Alexandre Julliard : ntdll: Handle single step exception in signal handler on i386.
by Alexandre Julliard
12 Sep '19
12 Sep '19
Module: wine Branch: master Commit: 5e2b0585cd4f39fdc916d4afcd19f2d1fa4fd21c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5e2b0585cd4f39fdc916d4af…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Sep 12 19:27:05 2019 +0200 ntdll: Handle single step exception in signal handler on i386. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/signal_i386.c | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 5699a99932..580bfb2d5c 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1988,36 +1988,6 @@ done: } -/********************************************************************** - * raise_trap_exception - */ -static void WINAPI raise_trap_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) -{ - NTSTATUS status; - - if (rec->ExceptionCode == EXCEPTION_SINGLE_STEP) - { - /* when single stepping can't tell whether this is a hw bp or a - * single step interrupt. try to avoid as much overhead as possible - * and only do a server call if there is any hw bp enabled. */ - - if( !(context->EFlags & 0x100) || (x86_thread_data()->dr7 & 0xff) ) - { - /* (possible) hardware breakpoint, fetch the debug registers */ - DWORD saved_flags = context->ContextFlags; - context->ContextFlags = CONTEXT_DEBUG_REGISTERS; - NtGetContextThread(GetCurrentThread(), context); - context->ContextFlags |= saved_flags; /* restore flags */ - } - - context->EFlags &= ~0x100; /* clear single-step flag */ - } - - status = NtRaiseException( rec, context, TRUE ); - raise_status( status, rec ); -} - - /********************************************************************** * raise_generic_exception * @@ -2141,6 +2111,18 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext ) { case TRAP_x86_TRCTRAP: /* Single-step exception */ stack->rec.ExceptionCode = EXCEPTION_SINGLE_STEP; + /* when single stepping can't tell whether this is a hw bp or a + * single step interrupt. try to avoid as much overhead as possible + * and only do a server call if there is any hw bp enabled. */ + if (!(stack->context.EFlags & 0x100) || (stack->context.Dr7 & 0xff)) + { + /* (possible) hardware breakpoint, fetch the debug registers */ + DWORD saved_flags = stack->context.ContextFlags; + stack->context.ContextFlags = CONTEXT_DEBUG_REGISTERS; + NtGetContextThread( GetCurrentThread(), &stack->context ); + stack->context.ContextFlags |= saved_flags; /* restore flags */ + } + stack->context.EFlags &= ~0x100; /* clear single-step flag */ break; case TRAP_x86_BPTFLT: /* Breakpoint exception */ stack->rec.ExceptionAddress = (char *)stack->rec.ExceptionAddress - 1; /* back up over the int3 instruction */ @@ -2153,7 +2135,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext ) stack->rec.ExceptionInformation[2] = 0; /* FIXME */ break; } - setup_raise_exception( context, stack, raise_trap_exception ); + setup_raise_exception( context, stack, raise_generic_exception ); }
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
63
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Results per page:
10
25
50
100
200