예제 #1
0
/* Make sure there's at least one syscall enabled. */
int validate_syscall_tables(void)
{
	unsigned int ret;

	if (biarch == TRUE) {
		ret = validate_syscall_table_32();
		ret |= validate_syscall_table_64();
		return ret;
	}

	/* non-biarch case*/
	if (shm->nr_active_syscalls == 0)
		return FALSE;
	else
		return TRUE;
}
예제 #2
0
static void choose_syscall_table(int childno)
{
    if (biarch == FALSE) {
        active_syscalls = shm->active_syscalls;
        nr_active_syscalls = shm->nr_active_syscalls;
    } else {

        /* First, check that we have syscalls enabled in either table. */
        if (validate_syscall_table_64() == FALSE) {
            use_64bit = FALSE;
            /* If no 64bit syscalls enabled, force 32bit. */
            shm->do32bit[childno] = TRUE;
        }

        if (validate_syscall_table_32() == FALSE)
            use_32bit = FALSE;

        /* If both tables enabled, pick randomly. */
        if ((use_64bit == TRUE) && (use_32bit == TRUE)) {
            /*
             * 10% possibility of a 32bit syscall
             */
            shm->do32bit[childno] = FALSE;

            if (rand() % 100 < 10)
                shm->do32bit[childno] = TRUE;
        }

        if (shm->do32bit[childno] == FALSE) {
            syscalls = syscalls_64bit;
            nr_active_syscalls = shm->nr_active_64bit_syscalls;
            active_syscalls = shm->active_syscalls64;
            max_nr_syscalls = max_nr_64bit_syscalls;
        } else {
            syscalls = syscalls_32bit;
            nr_active_syscalls = shm->nr_active_32bit_syscalls;
            active_syscalls = shm->active_syscalls32;
            max_nr_syscalls = max_nr_32bit_syscalls;
        }
    }

    if (no_syscalls_enabled() == TRUE) {
        output(0, "[%d] No more syscalls enabled. Exiting\n", getpid());
        shm->exit_reason = EXIT_NO_SYSCALLS_ENABLED;
    }
}
예제 #3
0
static bool choose_syscall_table(void)
{
	bool do32 = FALSE;

	if (biarch == FALSE) {
		active_syscalls = shm->active_syscalls;
	} else {

		/* First, check that we have syscalls enabled in either table. */
		if (validate_syscall_table_64() == FALSE) {
			use_64bit = FALSE;
			/* If no 64bit syscalls enabled, force 32bit. */
			do32 = TRUE;
		}

		if (validate_syscall_table_32() == FALSE)
			use_32bit = FALSE;

		/* If both tables enabled, pick randomly. */
		if ((use_64bit == TRUE) && (use_32bit == TRUE)) {
			/* 10% possibility of a 32bit syscall */
			if (rand() % 100 < 10)
				do32 = TRUE;
		}

		if (do32 == FALSE) {
			syscalls = syscalls_64bit;
			active_syscalls = shm->active_syscalls64;
			max_nr_syscalls = max_nr_64bit_syscalls;
		} else {
			syscalls = syscalls_32bit;
			active_syscalls = shm->active_syscalls32;
			max_nr_syscalls = max_nr_32bit_syscalls;
		}
	}
	return do32;
}