Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
85c01202
Commit
85c01202
authored
Aug 13, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the exception fault code to detect write access on ARM64.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
07f37f21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
19 deletions
+8
-19
signal_arm64.c
dlls/ntdll/signal_arm64.c
+8
-19
No files found.
dlls/ntdll/signal_arm64.c
View file @
85c01202
...
...
@@ -97,6 +97,13 @@ static struct fpsimd_context *get_fpsimd_context( ucontext_t *sigcontext )
return
(
struct
fpsimd_context
*
)
get_extended_sigcontext
(
sigcontext
,
FPSIMD_MAGIC
);
}
static
DWORD64
get_fault_esr
(
ucontext_t
*
sigcontext
)
{
struct
esr_context
*
esr
=
(
struct
esr_context
*
)
get_extended_sigcontext
(
sigcontext
,
ESR_MAGIC
);
if
(
esr
)
return
esr
->
esr
;
return
0
;
}
#endif
/* linux */
static
const
size_t
teb_size
=
0x2000
;
/* we reserve two pages for the TEB */
...
...
@@ -649,23 +656,6 @@ static NTSTATUS raise_exception( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL f
return
STATUS_SUCCESS
;
}
static
inline
DWORD
is_write_fault
(
DWORD
*
pc
)
{
DWORD
inst
=
*
pc
;
if
((
inst
&
0xbfff0000
)
==
0x0c000000
/* C3.3.1 */
||
(
inst
&
0xbfe00000
)
==
0x0c800000
/* C3.3.2 */
||
(
inst
&
0xbfdf0000
)
==
0x0d000000
/* C3.3.3 */
||
(
inst
&
0xbfc00000
)
==
0x0d800000
/* C3.3.4 */
||
(
inst
&
0x3f400000
)
==
0x08000000
/* C3.3.6 */
||
(
inst
&
0x3bc00000
)
==
0x38000000
/* C3.3.8-12 */
||
(
inst
&
0x3fe00000
)
==
0x3c800000
/* C3.3.8-12 128bit */
||
(
inst
&
0x3bc00000
)
==
0x39000000
/* C3.3.13 */
||
(
inst
&
0x3fc00000
)
==
0x3d800000
/* C3.3.13 128bit */
||
(
inst
&
0x3a400000
)
==
0x28000000
)
/* C3.3.7,14-16 */
return
EXCEPTION_WRITE_FAULT
;
return
EXCEPTION_READ_FAULT
;
}
/**********************************************************************
* segv_handler
*
...
...
@@ -675,7 +665,6 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
{
EXCEPTION_RECORD
*
rec
;
ucontext_t
*
context
=
ucontext
;
DWORD
*
orig_pc
=
(
DWORD
*
)
PC_sig
(
context
);
/* check for page fault inside the thread stack */
if
(
signal
==
SIGSEGV
&&
...
...
@@ -703,7 +692,7 @@ static void segv_handler( int signal, siginfo_t *info, void *ucontext )
case
SIGSEGV
:
/* Segmentation fault */
rec
->
ExceptionCode
=
EXCEPTION_ACCESS_VIOLATION
;
rec
->
NumberParameters
=
2
;
rec
->
ExceptionInformation
[
0
]
=
is_write_fault
(
orig_pc
)
;
rec
->
ExceptionInformation
[
0
]
=
(
get_fault_esr
(
context
)
&
0x40
)
!=
0
;
rec
->
ExceptionInformation
[
1
]
=
(
ULONG_PTR
)
info
->
si_addr
;
break
;
case
SIGBUS
:
/* Alignment check exception */
...
...
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