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
bd228a81
Commit
bd228a81
authored
18 years ago
by
rtm
Browse files
Options
Downloads
Patches
Plain Diff
prevent longjmp / forkret from writing over tf->edi
parent
0dd42537
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pipe.c
+5
-0
5 additions, 0 deletions
pipe.c
proc.c
+1
-1
1 addition, 1 deletion
proc.c
syscall.c
+3
-5
3 additions, 5 deletions
syscall.c
with
9 additions
and
6 deletions
pipe.c
+
5
−
0
View file @
bd228a81
...
...
@@ -61,6 +61,8 @@ pipe_alloc(struct fd **fd1, struct fd **fd2)
void
pipe_close
(
struct
pipe
*
p
,
int
writeable
)
{
acquire
(
&
p
->
lock
);
if
(
writeable
){
p
->
writeopen
=
0
;
wakeup
(
&
p
->
readp
);
...
...
@@ -68,6 +70,9 @@ pipe_close(struct pipe *p, int writeable)
p
->
readopen
=
0
;
wakeup
(
&
p
->
writep
);
}
release
(
&
p
->
lock
);
if
(
p
->
readopen
==
0
&&
p
->
writeopen
==
0
)
kfree
((
char
*
)
p
,
PAGE
);
}
...
...
This diff is collapsed.
Click to expand it.
proc.c
+
1
−
1
View file @
bd228a81
...
...
@@ -109,7 +109,7 @@ copyproc(struct proc* p)
// Set up new jmpbuf to start executing at forkret (see below).
memset
(
&
np
->
jmpbuf
,
0
,
sizeof
np
->
jmpbuf
);
np
->
jmpbuf
.
eip
=
(
uint
)
forkret
;
np
->
jmpbuf
.
esp
=
(
uint
)
np
->
tf
;
np
->
jmpbuf
.
esp
=
(
uint
)
np
->
tf
-
4
;
// Copy file descriptors
for
(
i
=
0
;
i
<
NOFILE
;
i
++
){
...
...
This diff is collapsed.
Click to expand it.
syscall.c
+
3
−
5
View file @
bd228a81
...
...
@@ -13,8 +13,7 @@
* System call number in %eax.
* Arguments on the stack, from the user call to the C
* library system call function. The saved user %esp points
* to a saved frame pointer, a program counter, and then
* the first argument.
* to a saved program counter, and then the first argument.
*
* Return value? Error indication? Errno?
*/
...
...
@@ -56,11 +55,11 @@ fetcharg(int argno, void *ip)
}
int
putint
(
struct
proc
*
p
,
uint
addr
,
int
ip
)
putint
(
struct
proc
*
p
,
uint
addr
,
int
x
)
{
if
(
addr
>
p
->
sz
-
4
)
return
-
1
;
memmove
(
p
->
mem
+
addr
,
&
ip
,
4
);
memmove
(
p
->
mem
+
addr
,
&
x
,
4
);
return
0
;
}
...
...
@@ -269,7 +268,6 @@ syscall(void)
int
num
=
cp
->
tf
->
eax
;
int
ret
=
-
1
;
//cprintf("%x sys %d\n", cp, num);
switch
(
num
){
case
SYS_fork
:
ret
=
sys_fork
();
...
...
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