Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CRIO_BYTES
ME_VMEM
Commits
290c6eb5
Commit
290c6eb5
authored
5 years ago
by
Nabhan Abdullah
💬
Browse files
Options
Download
Email Patches
Plain Diff
Add program for Milestone 3
parent
81e997e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
WriteVMemory2.cc
WriteVMemory2.cc
+25
-0
No files found.
WriteVMemory2.cc
0 → 100644
View file @
290c6eb5
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstring>
using
namespace
std
;
int
main
()
{
size_t
pagesize
=
getpagesize
();
long
int
addr
=
(
pagesize
*
(
1
<<
20
));
char
*
region
=
(
char
*
)
mmap
((
void
*
)
addr
,
pagesize
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_ANON
|
MAP_PRIVATE
,
0
,
0
);
if
(
region
==
MAP_FAILED
)
{
perror
(
"Could not mmap"
);
return
1
;
}
printf
(
"Writing to %p
\n
"
,
(
void
*
)
region
);
strcpy
(
region
,
"hmmm"
);
while
(
1
){};
return
0
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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