void deactivate_disabled_syscalls_biarch(void) { struct syscallentry *entry; unsigned int i; for_each_64bit_syscall(i) { entry = syscalls_64bit[i].entry; if (entry == NULL) continue; if (entry->flags & TO_BE_DEACTIVATED) { entry->flags &= ~(ACTIVE|TO_BE_DEACTIVATED); deactivate_syscall64(i); output(0, "Marked 64-bit syscall %s (%d) as deactivated.\n", entry->name, entry->number); } } for_each_32bit_syscall(i) { entry = syscalls_32bit[i].entry; if (entry == NULL) continue; if (entry->flags & TO_BE_DEACTIVATED) { entry->flags &= ~(ACTIVE|TO_BE_DEACTIVATED); deactivate_syscall32(i); output(0, "Marked 32-bit syscall %s (%d) as deactivated.\n", entry->name, entry->number); } } }
int child_random_syscalls(int childno) { int ret; unsigned int syscallnr; ret = sigsetjmp(ret_jump, 1); if (ret != 0) { if (handle_sigreturn(childno) == 0) return 0; ret = 0; } while (shm->exit_reason == STILL_RUNNING) { check_parent_pid(); while (shm->regenerating == TRUE) sleep(1); /* If the parent reseeded, we should reflect the latest seed too. */ if (shm->seed != shm->seeds[childno]) set_seed(childno); choose_syscall_table(childno); if (nr_active_syscalls == 0) { shm->exit_reason = EXIT_NO_SYSCALLS_ENABLED; goto out; } if (shm->exit_reason != STILL_RUNNING) goto out; syscallnr = rand() % nr_active_syscalls; /* If we got a syscallnr which is not actvie repeat the attempt, since another child has switched that syscall off already.*/ if (active_syscalls[syscallnr] == 0) continue; syscallnr = active_syscalls[syscallnr] - 1; if (validate_specific_syscall_silent(syscalls, syscallnr) == FALSE) { if (biarch == FALSE) { deactivate_syscall(syscallnr); } else { if (shm->do32bit[childno] == TRUE) deactivate_syscall32(syscallnr); else deactivate_syscall64(syscallnr); } continue; } shm->syscallno[childno] = syscallnr; if (syscalls_todo) { if (shm->total_syscalls_done >= syscalls_todo) { output(0, "Reached maximum syscall count (todo = %d, done = %d), exiting...\n", syscalls_todo, shm->total_syscalls_done); shm->exit_reason = EXIT_REACHED_COUNT; } } ret = mkcall(childno); } out: return ret; }