Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
eaa5832c
Commit
eaa5832c
authored
Feb 13, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5126d2be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+8
-4
No files found.
wcfs/client/wcfs.cpp
View file @
eaa5832c
...
@@ -385,7 +385,6 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
...
@@ -385,7 +385,6 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: mmap f<%s> [blk%ld +blk%ld)"
,
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: mmap f<%s> [blk%ld +blk%ld)"
,
v
(
f
.
wconn
->
_wc
->
mountpoint
),
v
(
f
.
wconn
->
at
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
v
(
f
.
wconn
->
_wc
->
mountpoint
),
v
(
f
.
wconn
->
at
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
// XXX (blk_start + blk_len) * blk_size overflow
error
err
;
error
err
;
if
(
blk_start
<
0
)
if
(
blk_start
<
0
)
...
@@ -393,20 +392,25 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
...
@@ -393,20 +392,25 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
if
(
blk_len
<
0
)
if
(
blk_len
<
0
)
panic
(
"blk_len < 0"
);
panic
(
"blk_len < 0"
);
int64_t
blk_stop
=
blk_start
+
blk_len
;
// XXX overflow
int64_t
blk_stop
;
// = blk_start + blk_len
if
(
__builtin_add_overflow
(
blk_start
,
blk_len
,
&
blk_stop
))
panic
(
"blk_start + blk_len overflow int64"
);
int64_t
stop
;
// = blk_stop *f.blksize;
if
(
__builtin_mul_overflow
(
blk_stop
,
f
.
blksize
,
&
stop
))
panic
(
"(blk_start + blk_len)*f.blksize overflow int64"
);
int64_t
start
=
blk_start
*
f
.
blksize
;
// XXX f locking?
// XXX f locking?
// create memory with head/f mapping and applied pins
// create memory with head/f mapping and applied pins
// mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
// mmap-in zeros after f.size (else access to memory after file.size will raise SIGBUS)
int64_t
start
=
blk_start
*
f
.
blksize
;
uint8_t
*
mem_start
,
*
mem_stop
;
uint8_t
*
mem_start
,
*
mem_stop
;
tie
(
mem_start
,
err
)
=
mmap_ro
(
f
.
_headf
,
start
,
blk_len
*
f
.
blksize
);
tie
(
mem_start
,
err
)
=
mmap_ro
(
f
.
_headf
,
start
,
blk_len
*
f
.
blksize
);
if
(
err
!=
nil
)
if
(
err
!=
nil
)
return
make_pair
(
nil
,
E
(
err
));
return
make_pair
(
nil
,
E
(
err
));
mem_stop
=
mem_start
+
blk_len
*
f
.
blksize
;
mem_stop
=
mem_start
+
blk_len
*
f
.
blksize
;
int64_t
stop
=
blk_stop
*
f
.
blksize
;
if
(
stop
>
f
.
_headfsize
)
{
if
(
stop
>
f
.
_headfsize
)
{
uint8_t
*
zmem_start
=
mem_start
+
(
max
(
f
.
_headfsize
/*XXX -1 ?*/
,
start
)
-
start
);
uint8_t
*
zmem_start
=
mem_start
+
(
max
(
f
.
_headfsize
/*XXX -1 ?*/
,
start
)
-
start
);
err
=
mmap_zero_into_ro
(
zmem_start
,
mem_stop
-
zmem_start
);
err
=
mmap_zero_into_ro
(
zmem_start
,
mem_stop
-
zmem_start
);
...
...
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