Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c0300913
Commit
c0300913
authored
Feb 17, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Consistently initialize x86-64 signal handlers.
Spotted by Eric Pouech.
parent
2528482a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
22 deletions
+26
-22
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+26
-22
No files found.
dlls/ntdll/unix/signal_x86_64.c
View file @
c0300913
...
...
@@ -812,7 +812,7 @@ static inline void set_sigcontext( const CONTEXT *context, ucontext_t *sigcontex
/***********************************************************************
* init_handler
*/
static
inline
void
init_handler
(
const
ucontext_t
*
sigcontext
)
static
inline
ucontext_t
*
init_handler
(
void
*
sigcontext
)
{
#ifdef __linux__
if
(
fs32_sel
)
...
...
@@ -821,6 +821,7 @@ static inline void init_handler( const ucontext_t *sigcontext )
arch_prctl
(
ARCH_SET_FS
,
((
struct
amd64_thread_data
*
)
thread_data
->
cpu_data
)
->
pthread_teb
);
}
#endif
return
sigcontext
;
}
...
...
@@ -845,8 +846,6 @@ static void save_context( struct xcontext *xcontext, const ucontext_t *sigcontex
{
CONTEXT
*
context
=
&
xcontext
->
c
;
init_handler
(
sigcontext
);
context
->
ContextFlags
=
CONTEXT_CONTROL
|
CONTEXT_INTEGER
|
CONTEXT_SEGMENTS
|
CONTEXT_DEBUG_REGISTERS
;
context
->
Rax
=
RAX_sig
(
sigcontext
);
context
->
Rcx
=
RCX_sig
(
sigcontext
);
...
...
@@ -1969,10 +1968,10 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{
EXCEPTION_RECORD
rec
=
{
0
};
struct
xcontext
context
;
ucontext_t
*
ucontext
=
sigcontext
;
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
)
;
rec
.
ExceptionAddress
=
(
void
*
)
RIP_sig
(
ucontext
);
save_context
(
&
context
,
sig
context
);
save_context
(
&
context
,
u
context
);
switch
(
TRAP_sig
(
ucontext
))
{
...
...
@@ -2008,7 +2007,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
(
void
*
)
RSP_sig
(
ucontext
)
);
if
(
!
rec
.
ExceptionCode
)
{
leave_handler
(
sig
context
);
leave_handler
(
u
context
);
return
;
}
break
;
...
...
@@ -2016,7 +2015,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
if
(
EFL_sig
(
ucontext
)
&
0x00040000
)
{
EFL_sig
(
ucontext
)
&=
~
0x00040000
;
/* reset AC flag */
leave_handler
(
sig
context
);
leave_handler
(
u
context
);
return
;
}
rec
.
ExceptionCode
=
EXCEPTION_DATATYPE_MISALIGNMENT
;
...
...
@@ -2033,8 +2032,8 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec
.
ExceptionCode
=
EXCEPTION_ILLEGAL_INSTRUCTION
;
break
;
}
if
(
handle_syscall_fault
(
sig
context
,
&
rec
,
&
context
.
c
))
return
;
setup_raise_exception
(
sig
context
,
&
rec
,
&
context
);
if
(
handle_syscall_fault
(
u
context
,
&
rec
,
&
context
.
c
))
return
;
setup_raise_exception
(
u
context
,
&
rec
,
&
context
);
}
...
...
@@ -2047,12 +2046,12 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{
EXCEPTION_RECORD
rec
=
{
0
};
struct
xcontext
context
;
ucontext_t
*
ucontext
=
sigcontext
;
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
)
;
if
(
handle_syscall_trap
(
sig
context
))
return
;
if
(
handle_syscall_trap
(
u
context
))
return
;
rec
.
ExceptionAddress
=
(
void
*
)
RIP_sig
(
ucontext
);
save_context
(
&
context
,
sig
context
);
save_context
(
&
context
,
u
context
);
switch
(
TRAP_sig
(
ucontext
))
{
...
...
@@ -2068,7 +2067,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec
.
ExceptionInformation
[
0
]
=
0
;
break
;
}
setup_raise_exception
(
sig
context
,
&
rec
,
&
context
);
setup_raise_exception
(
u
context
,
&
rec
,
&
context
);
}
...
...
@@ -2080,7 +2079,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
static
void
fpe_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
EXCEPTION_RECORD
rec
=
{
0
};
ucontext_t
*
ucontext
=
sigcontext
;
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
)
;
switch
(
siginfo
->
si_code
)
{
...
...
@@ -2121,7 +2120,7 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec
.
ExceptionInformation
[
1
]
=
FPU_sig
(
ucontext
)
?
FPU_sig
(
ucontext
)
->
MxCsr
:
0
;
if
(
CS_sig
(
ucontext
)
!=
cs64_sel
)
rec
.
ExceptionCode
=
STATUS_FLOAT_MULTIPLE_TRAPS
;
}
setup_exception
(
sig
context
,
&
rec
);
setup_exception
(
u
context
,
&
rec
);
}
...
...
@@ -2132,12 +2131,16 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
static
void
int_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
);
HANDLE
handle
;
if
(
!
p__wine_ctrl_routine
)
return
;
if
(
!
NtCreateThreadEx
(
&
handle
,
THREAD_ALL_ACCESS
,
NULL
,
NtCurrentProcess
(),
p__wine_ctrl_routine
,
0
/* CTRL_C_EVENT */
,
0
,
0
,
0
,
0
,
NULL
))
NtClose
(
handle
);
if
(
p__wine_ctrl_routine
)
{
if
(
!
NtCreateThreadEx
(
&
handle
,
THREAD_ALL_ACCESS
,
NULL
,
NtCurrentProcess
(),
p__wine_ctrl_routine
,
0
/* CTRL_C_EVENT */
,
0
,
0
,
0
,
0
,
NULL
))
NtClose
(
handle
);
}
leave_handler
(
ucontext
);
}
...
...
@@ -2148,9 +2151,10 @@ static void int_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
static
void
abrt_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sigcontext
)
{
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
);
EXCEPTION_RECORD
rec
=
{
EXCEPTION_WINE_ASSERTION
,
EH_NONCONTINUABLE
};
setup_exception
(
sig
context
,
&
rec
);
setup_exception
(
u
context
,
&
rec
);
}
...
...
@@ -2171,11 +2175,11 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *ucontext )
*
* Handler for SIGUSR1, used to signal a thread that it got suspended.
*/
static
void
usr1_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
u
context
)
static
void
usr1_handler
(
int
signal
,
siginfo_t
*
siginfo
,
void
*
sig
context
)
{
ucontext_t
*
ucontext
=
init_handler
(
sigcontext
);
struct
xcontext
context
;
init_handler
(
ucontext
);
if
(
is_inside_syscall
(
ucontext
))
{
DECLSPEC_ALIGN
(
64
)
XSTATE
xs
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment