Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
jD91mZM2
kernel
Commits
ff5354b5
Verified
Commit
ff5354b5
authored
4 years ago
by
jD91mZM2
Browse files
Options
Downloads
Patches
Plain Diff
Fix mmap when using out-of-place address
parent
2d63009b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheme/memory.rs
+7
-5
7 additions, 5 deletions
src/scheme/memory.rs
with
7 additions
and
5 deletions
src/scheme/memory.rs
+
7
−
5
View file @
ff5354b5
...
@@ -73,15 +73,16 @@ impl Scheme for MemoryScheme {
...
@@ -73,15 +73,16 @@ impl Scheme for MemoryScheme {
while
i
<
grants
.len
()
{
while
i
<
grants
.len
()
{
let
grant
=
&
mut
grants
[
i
];
let
grant
=
&
mut
grants
[
i
];
let
mut
grant_start
=
grant
.start_address
()
.get
();
let
grant_start
=
grant
.start_address
()
.get
();
let
mut
grant_len
=
((
grant
.size
()
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
)
*
PAGE_SIZE
;
let
grant_len
=
((
grant
.size
()
+
PAGE_SIZE
-
1
)
/
PAGE_SIZE
)
*
PAGE_SIZE
;
let
mut
grant_end
=
grant_start
+
grant_len
;
let
grant_end
=
grant_start
+
grant_len
;
if
grant_end
<=
to_address
{
if
to_address
<
grant_start
||
grant_end
<=
to_address
{
// grant has nothing to do with the memory to map, and thus we can safely just
// grant has nothing to do with the memory to map, and thus we can safely just
// go on to the next one.
// go on to the next one.
if
!
fixed
{
if
grant_start
>=
crate
::
USER_GRANT_OFFSET
&&
!
fixed
{
// don't ignore addresses outside of the automatic grant offset
to_address
=
grant_end
;
to_address
=
grant_end
;
}
}
i
+=
1
;
i
+=
1
;
...
@@ -96,6 +97,7 @@ impl Scheme for MemoryScheme {
...
@@ -96,6 +97,7 @@ impl Scheme for MemoryScheme {
// insert a new grant at the end (if not MapFlags::MAP_FIXED).
// insert a new grant at the end (if not MapFlags::MAP_FIXED).
if
fixed_noreplace
{
if
fixed_noreplace
{
println!
(
"grant: conflicts with: {:#x} - {:#x}"
,
grant_start
,
grant_end
);
return
Err
(
Error
::
new
(
EEXIST
));
return
Err
(
Error
::
new
(
EEXIST
));
}
else
if
fixed
{
}
else
if
fixed
{
/*
/*
...
...
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