Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
kernel
Commits
bbe6b465
Verified
Commit
bbe6b465
authored
Jul 08, 2021
by
4lDO2
🖖
Browse files
Futex: check for lower-half addrs manually.
parent
bcfd7b17
Changes
2
Hide whitespace changes
Inline
Side-by-side
rmm
@
6bc59e70
Compare
b75c329a
...
6bc59e70
Subproject commit
b75c329a273d194e313bc36a1ceab5362fd5f8e2
Subproject commit
6bc59e70131135984a41216c45e4dc3a6395a30a
src/syscall/futex.rs
View file @
bbe6b465
...
...
@@ -48,7 +48,13 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> R
let
active_table
=
ActivePageTable
::
new
(
TableKind
::
User
);
let
virtual_address
=
VirtualAddress
::
new
(
addr
);
if
!
crate
::
CurrentRmmArch
::
virt_is_valid
(
virtual_address
)
||
crate
::
CurrentRmmArch
::
virt_kind
(
virtual_address
)
==
TableKind
::
Kernel
{
if
!
crate
::
CurrentRmmArch
::
virt_is_valid
(
virtual_address
)
{
return
Err
(
Error
::
new
(
EFAULT
));
}
// TODO: Use this all over the code, making sure that no user pointers that are higher half
// can get to the page table walking procedure.
#[cfg(any(target_arch
=
"x86_64"
,
target_arch
=
"aarch64"
))]
if
virtual_address
.data
()
&
(
1
<<
63
)
==
(
1
<<
63
)
{
return
Err
(
Error
::
new
(
EFAULT
));
}
...
...
@@ -159,7 +165,13 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> R
let
addr2_physaddr
=
unsafe
{
let
addr2_virt
=
VirtualAddress
::
new
(
addr2
);
if
!
crate
::
CurrentRmmArch
::
virt_is_valid
(
addr2_virt
)
||
crate
::
CurrentRmmArch
::
virt_kind
(
addr2_virt
)
==
TableKind
::
Kernel
{
if
!
crate
::
CurrentRmmArch
::
virt_is_valid
(
addr2_virt
)
{
return
Err
(
Error
::
new
(
EFAULT
));
}
// TODO
#[cfg(any(target_arch
=
"x86_64"
,
target_arch
=
"aarch64"
))]
if
addr2_virt
.data
()
&
(
1
<<
63
)
==
(
1
<<
63
)
{
return
Err
(
Error
::
new
(
EFAULT
));
}
...
...
Write
Preview
Supports
Markdown
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