| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" | 5 #define SYS_SYSCALL_ENTRYPOINT "playground$syscallEntryPoint" | 
| 6 #include "linux_syscall_support.h" | 6 #include "linux_syscall_support.h" | 
| 7 | 7 | 
| 8 #include "sandbox_impl.h" | 8 #include "sandbox_impl.h" | 
| 9 #include <dirent.h> | 9 #include <dirent.h> | 
| 10 #include <dlfcn.h> | 10 #include <dlfcn.h> | 
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 157   printf("TSC: %llx\n", tsc()); | 157   printf("TSC: %llx\n", tsc()); | 
| 158   printf("TSC: %llx\n", tsc()); | 158   printf("TSC: %llx\n", tsc()); | 
| 159 | 159 | 
| 160   #if defined(__x86_64__) | 160   #if defined(__x86_64__) | 
| 161   asm volatile("mov $2, %%edi\n" | 161   asm volatile("mov $2, %%edi\n" | 
| 162                "lea 100f(%%rip), %%rsi\n" | 162                "lea 100f(%%rip), %%rsi\n" | 
| 163                "mov $101f-100f, %%edx\n" | 163                "mov $101f-100f, %%edx\n" | 
| 164                "mov $1, %%eax\n" | 164                "mov $1, %%eax\n" | 
| 165                "int $0\n" | 165                "int $0\n" | 
| 166                "jmp 101f\n" | 166                "jmp 101f\n" | 
| 167           "100:.ascii \"Hello world (INT $0 worked)\\n\"\n" | 167            "100:.ascii \"Hello world (INT $0 worked)\\n\"\n" | 
| 168           "101:\n" | 168            "101:\n" | 
| 169                : | 169                : | 
| 170                : | 170                : | 
| 171                : "rax", "rdi", "rsi", "rdx"); | 171                : "rax", "rdi", "rsi", "rdx"); | 
| 172   #elif defined(__i386__) | 172   #elif defined(__i386__) | 
| 173   asm volatile("mov $2, %%ebx\n" | 173   asm volatile("push %%ebx\n" | 
|  | 174                "mov $2, %%ebx\n" | 
| 174                "lea 100f, %%ecx\n" | 175                "lea 100f, %%ecx\n" | 
| 175                "mov $101f-100f, %%edx\n" | 176                "mov $101f-100f, %%edx\n" | 
| 176                "mov $4, %%eax\n" | 177                "mov $4, %%eax\n" | 
| 177                "int $0\n" | 178                "int $0\n" | 
| 178                "jmp 101f\n" | 179                "jmp 101f\n" | 
| 179           "100:.ascii \"Hello world (INT $0 worked)\\n\"\n" | 180            "100:.ascii \"Hello world (INT $0 worked)\\n\"\n" | 
| 180           "101:\n" | 181            "101:pop %%ebx\n" | 
| 181                : | 182                : | 
| 182                : | 183                : | 
| 183                : "eax", "ebx", "ecx", "edx"); | 184                : "eax", "ecx", "edx"); | 
| 184   #endif | 185   #endif | 
| 185 | 186 | 
| 186   int pair[2]; | 187   int pair[2]; | 
| 187   socketpair(AF_UNIX, SOCK_STREAM, 0, pair); | 188   socketpair(AF_UNIX, SOCK_STREAM, 0, pair); | 
| 188 | 189 | 
| 189   printf("uid: %d\n", getuid()); | 190   printf("uid: %d\n", getuid()); | 
| 190   dlopen("libncurses.so.5", RTLD_LAZY); | 191   dlopen("libncurses.so.5", RTLD_LAZY); | 
| 191 | 192 | 
| 192   if (gettimeofday(&tv, 0)) { | 193   if (gettimeofday(&tv, 0)) { | 
| 193     printf("gettimeofday() failed\n"); | 194     printf("gettimeofday() failed\n"); | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 230   } | 231   } | 
| 231   if (!pthread_create(&threads[0], NULL, fnc, NULL)) { | 232   if (!pthread_create(&threads[0], NULL, fnc, NULL)) { | 
| 232     pthread_join(threads[0], NULL); | 233     pthread_join(threads[0], NULL); | 
| 233   } | 234   } | 
| 234 #endif | 235 #endif | 
| 235 | 236 | 
| 236   puts("Done"); | 237   puts("Done"); | 
| 237   exit(0); | 238   exit(0); | 
| 238   return 0; | 239   return 0; | 
| 239 } | 240 } | 
| OLD | NEW | 
|---|