Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CSEP551
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Krishna Vinnakota
CSEP551
Commits
371ab7fa
Commit
371ab7fa
authored
13 years ago
by
Robert Morris
Browse files
Options
Downloads
Patches
Plain Diff
inaccessible page under the user stack page, to help exec deal w/ too-large args
parent
62e3b8a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defs.h
+1
-0
1 addition, 0 deletions
defs.h
exec.c
+6
-3
6 additions, 3 deletions
exec.c
usertests.c
+1
-1
1 addition, 1 deletion
usertests.c
vm.c
+13
-0
13 additions, 0 deletions
vm.c
with
21 additions
and
4 deletions
defs.h
+
1
−
0
View file @
371ab7fa
...
...
@@ -176,6 +176,7 @@ pde_t* copyuvm(pde_t*, uint);
void
switchuvm
(
struct
proc
*
);
void
switchkvm
(
void
);
int
copyout
(
pde_t
*
,
uint
,
void
*
,
uint
);
void
clear_pte_u
(
pde_t
*
pgdir
,
char
*
uva
);
// number of elements in fixed-size array
#define NELEM(x) (sizeof(x)/sizeof((x)[0]))
This diff is collapsed.
Click to expand it.
exec.c
+
6
−
3
View file @
371ab7fa
...
...
@@ -49,13 +49,16 @@ exec(char *path, char **argv)
iunlockput
(
ip
);
ip
=
0
;
// Allocate a one-page stack at the next page boundary
// Allocate two pages at the next page boundary.
// Make the first inaccessible.
// Use the second as the user stack.
sz
=
PGROUNDUP
(
sz
);
if
((
sz
=
allocuvm
(
pgdir
,
sz
,
sz
+
PGSIZE
))
==
0
)
if
((
sz
=
allocuvm
(
pgdir
,
sz
,
sz
+
2
*
PGSIZE
))
==
0
)
goto
bad
;
clear_pte_u
(
pgdir
,
(
char
*
)(
sz
-
2
*
PGSIZE
));
sp
=
sz
;
// Push argument strings, prepare rest of stack in ustack.
sp
=
sz
;
for
(
argc
=
0
;
argv
[
argc
];
argc
++
)
{
if
(
argc
>=
MAXARG
)
goto
bad
;
...
...
This diff is collapsed.
Click to expand it.
usertests.c
+
1
−
1
View file @
371ab7fa
...
...
@@ -1525,7 +1525,7 @@ bigargtest(void)
for
(
i
=
0
;
i
<
MAXARG
-
1
;
i
++
)
args
[
i
]
=
"bigargs test: failed
\n
"
;
args
[
MAXARG
-
1
]
=
0
;
printf
(
stdout
,
"bigarg test
%d
\n
"
,
(
MAXARG
-
1
)
*
strlen
(
args
[
0
])
);
printf
(
stdout
,
"bigarg test
\n
"
);
exec
(
"echo"
,
args
);
printf
(
stdout
,
"bigarg test ok
\n
"
);
fd
=
open
(
"bigarg-ok"
,
O_CREATE
);
...
...
This diff is collapsed.
Click to expand it.
vm.c
+
13
−
0
View file @
371ab7fa
...
...
@@ -363,3 +363,16 @@ copyout(pde_t *pgdir, uint va, void *p, uint len)
}
return
0
;
}
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clear_pte_u
(
pde_t
*
pgdir
,
char
*
uva
)
{
pte_t
*
pte
;
pte
=
walkpgdir
(
pgdir
,
uva
,
0
);
if
(
pte
==
0
)
panic
(
"clear_pte_u"
);
*
pte
&=
~
PTE_U
;
}
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