Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lois Gomez
wine
Commits
fcf1bd1e
Commit
fcf1bd1e
authored
3 months ago
by
Marc-Aurel Zent
Committed by
Alexandre Julliard
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
server: Use mach_vm_read_overwrite in get_selector_entry.
parent
7b13ae0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/mach.c
+12
-10
12 additions, 10 deletions
server/mach.c
with
12 additions
and
10 deletions
server/mach.c
+
12
−
10
View file @
fcf1bd1e
...
...
@@ -505,10 +505,9 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base,
{
const
unsigned
int
total_size
=
(
2
*
sizeof
(
int
)
+
1
)
*
8192
;
struct
process
*
process
=
thread
->
process
;
unsigned
int
page_size
=
get_page_size
();
vm_offset_t
data
;
mach_vm_address_t
data
;
kern_return_t
ret
;
mach_
msg_type_number
_t
bytes_read
;
mach_
vm_size
_t
bytes_read
;
mach_port_t
process_port
=
get_process_port
(
thread
->
process
);
if
(
!
process
->
ldt_copy
||
!
process_port
)
...
...
@@ -518,24 +517,27 @@ void get_selector_entry( struct thread *thread, int entry, unsigned int *base,
}
if
(
entry
>=
8192
)
{
set_error
(
STATUS_
INVALID_PARAMETER
);
/* FIXME */
set_error
(
STATUS_
ACCESS_VIOLATION
);
return
;
}
mach_vm_offset_t
offset
=
process
->
ldt_copy
%
page_size
;
mach_vm_address_t
aligned_address
=
(
mach_vm_address_t
)(
process
->
ldt_copy
-
offset
);
mach_vm_size_t
aligned_size
=
(
total_size
+
offset
+
page_size
-
1
)
/
page_size
*
page_size
;
if
(
!
(
data
=
(
mach_vm_address_t
)
malloc
(
total_size
)))
{
set_error
(
STATUS_NO_MEMORY
);
return
;
}
ret
=
mach_vm_read
(
process_port
,
aligned_address
,
aligned
_size
,
&
data
,
&
bytes_read
);
ret
=
mach_vm_read
_overwrite
(
process_port
,
(
mach_vm_address_t
)
process
->
ldt_copy
,
(
mach_vm_size_t
)
total
_size
,
data
,
&
bytes_read
);
if
(
ret
!=
KERN_SUCCESS
)
mach_set_error
(
ret
);
else
{
const
int
*
ldt
=
(
const
int
*
)
((
char
*
)
data
+
offset
)
;
const
int
*
ldt
=
(
const
int
*
)
data
;
memcpy
(
base
,
ldt
+
entry
,
sizeof
(
int
)
);
memcpy
(
limit
,
ldt
+
entry
+
8192
,
sizeof
(
int
)
);
memcpy
(
flags
,
(
char
*
)(
ldt
+
2
*
8192
)
+
entry
,
1
);
mach_vm_deallocate
(
mach_task_self
(),
data
,
bytes_read
);
}
free
(
(
void
*
)
data
);
}
#endif
/* USE_MACH */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment