projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed memory leak on error path in copy_in_string
[pintos-anon]
/
solutions
/
p2.patch
diff --git
a/solutions/p2.patch
b/solutions/p2.patch
index 0632ffaeb1ce5856cfc3b81df8db252b1b779472..0940c141ee2d9b97c4c898cf3e8c2c57d1110041 100644
(file)
--- a/
solutions/p2.patch
+++ b/
solutions/p2.patch
@@
-95,9
+95,9
@@
diff -u src/threads/thread.h~ src/threads/thread.h
+ struct semaphore dead; /* 1=child alive, 0=child dead. */
+ };
+
+ struct semaphore dead; /* 1=child alive, 0=child dead. */
+ };
+
- void thread_init (void);
- void thread_start (void);
- void thread_tick (void);
+ /* If false (default), use round-robin scheduler.
+ If true, use multi-level feedback queue scheduler.
+ Controlled by kernel command-line options "-o mlfqs".
Index: src/userprog/exception.c
diff -u src/userprog/exception.c~ src/userprog/exception.c
--- src/userprog/exception.c~
Index: src/userprog/exception.c
diff -u src/userprog/exception.c~ src/userprog/exception.c
--- src/userprog/exception.c~
@@
-493,7
+493,7
@@
Index: src/userprog/syscall.c
diff -u src/userprog/syscall.c~ src/userprog/syscall.c
--- src/userprog/syscall.c~
+++ src/userprog/syscall.c
diff -u src/userprog/syscall.c~ src/userprog/syscall.c
--- src/userprog/syscall.c~
+++ src/userprog/syscall.c
-@@ -1,20 +1,48
3
@@
+@@ -1,20 +1,48
6
@@
#include "userprog/syscall.h"
#include <stdio.h>
+#include <string.h>
#include "userprog/syscall.h"
#include <stdio.h>
+#include <string.h>
@@
-657,7
+657,10
@@
diff -u src/userprog/syscall.c~ src/userprog/syscall.c
+ for (length = 0; length < PGSIZE; length++)
+ {
+ if (us >= (char *) PHYS_BASE || !get_user (ks + length, us++))
+ for (length = 0; length < PGSIZE; length++)
+ {
+ if (us >= (char *) PHYS_BASE || !get_user (ks + length, us++))
-+ thread_exit ();
++ {
++ palloc_free_page (ks);
++ thread_exit ();
++ }
+
+ if (ks[length] == '\0')
+ return ks;
+
+ if (ks[length] == '\0')
+ return ks;