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
432d5041
Commit
432d5041
authored
Jul 15, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Pass the stack address to the virtual_handle_fault() function.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5a68254c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
13 deletions
+19
-13
signal_arm.c
dlls/ntdll/unix/signal_arm.c
+1
-1
signal_arm64.c
dlls/ntdll/unix/signal_arm64.c
+1
-1
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+2
-2
signal_x86_64.c
dlls/ntdll/unix/signal_x86_64.c
+2
-2
unix_private.h
dlls/ntdll/unix/unix_private.h
+1
-1
virtual.c
dlls/ntdll/unix/virtual.c
+12
-6
No files found.
dlls/ntdll/unix/signal_arm.c
View file @
432d5041
...
...
@@ -610,7 +610,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
rec
->
ExceptionInformation
[
0
]
=
(
get_error_code
(
context
)
&
0x800
)
!=
0
;
rec
->
ExceptionInformation
[
1
]
=
(
ULONG_PTR
)
info
->
si_addr
;
if
(
!
(
rec
->
ExceptionCode
=
virtual_handle_fault
(
(
void
*
)
rec
->
ExceptionInformation
[
1
],
rec
->
ExceptionInformation
[
0
],
FALSE
)))
rec
->
ExceptionInformation
[
0
],
NULL
)))
return
;
break
;
case
TRAP_ARM_ALIGNFLT
:
/* Alignment check exception */
...
...
dlls/ntdll/unix/signal_arm64.c
View file @
432d5041
...
...
@@ -643,7 +643,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
stack
->
rec
.
ExceptionInformation
[
0
]
=
(
get_fault_esr
(
context
)
&
0x40
)
!=
0
;
stack
->
rec
.
ExceptionInformation
[
1
]
=
(
ULONG_PTR
)
info
->
si_addr
;
if
(
!
(
stack
->
rec
.
ExceptionCode
=
virtual_handle_fault
(
(
void
*
)
stack
->
rec
.
ExceptionInformation
[
1
],
stack
->
rec
.
ExceptionInformation
[
0
],
FALSE
)))
stack
->
rec
.
ExceptionInformation
[
0
],
NULL
)))
return
;
break
;
case
SIGBUS
:
/* Alignment check exception */
...
...
dlls/ntdll/unix/signal_i386.c
View file @
432d5041
...
...
@@ -1668,7 +1668,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
if
(
TRAP_sig
(
context
)
==
TRAP_x86_PAGEFLT
&&
(
char
*
)
stack_ptr
>=
(
char
*
)
get_signal_stack
()
&&
(
char
*
)
stack_ptr
<
(
char
*
)
get_signal_stack
()
+
signal_stack_size
&&
!
virtual_handle_fault
(
siginfo
->
si_addr
,
(
ERROR_sig
(
context
)
>>
1
)
&
0x09
,
TRUE
))
!
virtual_handle_fault
(
siginfo
->
si_addr
,
(
ERROR_sig
(
context
)
>>
1
)
&
0x09
,
stack_ptr
))
{
return
;
}
...
...
@@ -1728,7 +1728,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
stack
->
rec
.
ExceptionInformation
[
0
]
=
(
ERROR_sig
(
context
)
>>
1
)
&
0x09
;
stack
->
rec
.
ExceptionInformation
[
1
]
=
(
ULONG_PTR
)
siginfo
->
si_addr
;
stack
->
rec
.
ExceptionCode
=
virtual_handle_fault
(
(
void
*
)
stack
->
rec
.
ExceptionInformation
[
1
],
stack
->
rec
.
ExceptionInformation
[
0
],
FALSE
);
stack
->
rec
.
ExceptionInformation
[
0
],
NULL
);
if
(
!
stack
->
rec
.
ExceptionCode
)
return
;
if
(
stack
->
rec
.
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
&&
stack
->
rec
.
ExceptionInformation
[
0
]
==
EXCEPTION_EXECUTE_FAULT
)
...
...
dlls/ntdll/unix/signal_x86_64.c
View file @
432d5041
...
...
@@ -2126,7 +2126,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
/* check for exceptions on the signal stack caused by write watches */
if
(
TRAP_sig
(
ucontext
)
==
TRAP_x86_PAGEFLT
&&
is_inside_signal_stack
(
stack
)
&&
!
virtual_handle_fault
(
siginfo
->
si_addr
,
(
ERROR_sig
(
ucontext
)
>>
1
)
&
0x09
,
TRUE
))
!
virtual_handle_fault
(
siginfo
->
si_addr
,
(
ERROR_sig
(
ucontext
)
>>
1
)
&
0x09
,
stack
))
{
return
;
}
...
...
@@ -2179,7 +2179,7 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
stack
->
rec
.
ExceptionInformation
[
0
]
=
(
ERROR_sig
(
ucontext
)
>>
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
)))
stack
->
rec
.
ExceptionInformation
[
0
],
NULL
)))
return
;
break
;
case
TRAP_x86_ALIGNFLT
:
/* Alignment check exception */
...
...
dlls/ntdll/unix/unix_private.h
View file @
432d5041
...
...
@@ -196,7 +196,7 @@ extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN;
extern
void
virtual_free_teb
(
TEB
*
teb
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_clear_tls_index
(
ULONG
index
)
DECLSPEC_HIDDEN
;
extern
void
virtual_map_user_shared_data
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_handle_fault
(
LPCVOID
addr
,
DWORD
err
,
BOOL
on_signal_
stack
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_handle_fault
(
void
*
addr
,
DWORD
err
,
void
*
stack
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
virtual_locked_server_call
(
void
*
req_ptr
)
DECLSPEC_HIDDEN
;
extern
ssize_t
virtual_locked_read
(
int
fd
,
void
*
addr
,
size_t
size
)
DECLSPEC_HIDDEN
;
extern
ssize_t
virtual_locked_pread
(
int
fd
,
void
*
addr
,
size_t
size
,
off_t
offset
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
432d5041
...
...
@@ -203,6 +203,13 @@ static struct range_entry *free_ranges;
static
struct
range_entry
*
free_ranges_end
;
static
inline
BOOL
is_inside_signal_stack
(
void
*
ptr
)
{
return
((
char
*
)
ptr
>=
(
char
*
)
get_signal_stack
()
&&
(
char
*
)
ptr
<
(
char
*
)
get_signal_stack
()
+
signal_stack_size
);
}
static
void
reserve_area
(
void
*
addr
,
void
*
end
)
{
#ifdef __APPLE__
...
...
@@ -2840,16 +2847,15 @@ void virtual_map_user_shared_data(void)
/***********************************************************************
* virtual_handle_fault
*/
NTSTATUS
virtual_handle_fault
(
LPCVOID
addr
,
DWORD
err
,
BOOL
on_signal_
stack
)
NTSTATUS
virtual_handle_fault
(
void
*
addr
,
DWORD
err
,
void
*
stack
)
{
NTSTATUS
ret
=
STATUS_ACCESS_VIOLATION
;
void
*
page
=
ROUND_ADDR
(
addr
,
page_mask
);
sigset_t
sigset
;
char
*
page
=
ROUND_ADDR
(
addr
,
page_mask
);
BYTE
vprot
;
server_enter_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
pthread_mutex_lock
(
&
virtual_mutex
);
/* no need for signal masking inside signal handler */
vprot
=
get_page_vprot
(
page
);
if
(
!
on_signal_stack
&&
(
vprot
&
VPROT_GUARD
))
if
(
!
is_inside_signal_stack
(
stack
)
&&
(
vprot
&
VPROT_GUARD
))
{
set_page_vprot_bits
(
page
,
page_size
,
0
,
VPROT_GUARD
);
mprotect_range
(
page
,
page_size
,
0
,
0
);
...
...
@@ -2869,7 +2875,7 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err, BOOL on_signal_stack )
ret
=
STATUS_SUCCESS
;
}
}
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
pthread_mutex_unlock
(
&
virtual_mutex
);
return
ret
;
}
...
...
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