Description:
added /dev/urandom to file allowed to be accessed, probably needed after ubuntu 9.04 git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@417 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r76:4469d653fe5f - - 1 file changed: 1 inserted, 0 deleted

@@ -166,48 +166,49
166 166 if (remains < 0)
167 167 die("read(mem): %m");
168 168 if (!remains)
169 169 die("Access to file with name out of memory.");
170 170 end += l;
171 171 addr += l;
172 172 }
173 173 }
174 174 while (*p++);
175 175
176 176 log("[%s] ", namebuf);
177 177 if (file_access >= 3)
178 178 return;
179 179 if (!strchr(namebuf, '/') && strcmp(namebuf, ".."))
180 180 return;
181 181 if (file_access >= 2)
182 182 {
183 183 if ((!strncmp(namebuf, "/etc/", 5) ||
184 184 !strncmp(namebuf, "/lib/", 5) ||
185 185 !strncmp(namebuf, "/usr/lib/", 9))
186 186 && !strstr(namebuf, ".."))
187 187 return;
188 188 if (!strcmp(namebuf, "/dev/null") ||
189 189 !strcmp(namebuf, "/dev/zero") ||
190 + !strcmp(namebuf, "/dev/urandom") ||
190 191 !strcmp(namebuf, "/proc/meminfo") ||
191 192 !strcmp(namebuf, "/proc/self/stat") ||
192 193 !strncmp(namebuf, "/usr/share/zoneinfo/", 20))
193 194 return;
194 195 }
195 196 die("Forbidden access to file `%s'.", namebuf);
196 197 }
197 198
198 199 static int
199 200 valid_syscall(struct user *u)
200 201 {
201 202 switch (u->regs.orig_eax)
202 203 {
203 204 case __NR_execve:
204 205 {
205 206 static int exec_counter;
206 207 return !exec_counter++;
207 208 }
208 209 case __NR_open:
209 210 case __NR_creat:
210 211 case __NR_unlink:
211 212 case __NR_oldstat:
212 213 case __NR_access:
213 214 case __NR_oldlstat:
You need to be logged in to leave comments. Login now