Compare commits

...
6 Commits
25 changed files with 184 additions and 81 deletions
+1
View File
@@ -6,3 +6,4 @@
/db.conf
/fail/bin/resultbrowser/app/__pycache__
/fail/bin/VisualFAIL/CONFIGURATION.php
/qemu.log
+1
View File
@@ -284,6 +284,7 @@ rec {
wamrc
fail-bin
php
qemu_kvm
# perl
-1
View File
@@ -219,7 +219,6 @@ if ( grep { $_ eq "fail" } @selected_targets ) {
# Build everything
# ========================================================================================= #
# TODO: linux-baremetal target is broken
system( "mkdir", "-p", "$local_builds_dir" );
foreach my $experiment (@selected_experiments) {
foreach my $target (@selected_targets) {
+38 -18
View File
@@ -123,8 +123,7 @@ my @cross_ldflags_base = (
my @linux_ldflags_base = ( '-Wl,--build-id=none', '-m32', '-lm' );
my @baremetal_ldflags_base = (
'-Wl,--build-id=none', '-static', '-nostdlib', '-m32',
'-lc', '-lgcc', '-lm', '--entry',
'main'
'-lc', '-lgcc', '-lm'
);
my @cross_ldflags_nowasm = (
'-Wl,--build-id=none', '-static', '-nostdlib', '-m32',
@@ -192,13 +191,15 @@ sub build {
compile_c_module( $module, $bd, $target );
compile_c_host( $module, $bd, $target );
compile_startup( $module, $bd, $target );
compile_syscalls( $module, $bd, $target );
link_c( $module, $bd, $target );
}
else {
die "Unknown mode '$mode'; expected: aot, interp, c\n";
}
build_iso( $module, $bd );
build_iso( $module, $bd )
if $target eq 'fail' || $target eq 'linux-baremetal';
}
# ========================================================================================= #
@@ -265,14 +266,15 @@ sub compile_wasm_module {
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
Util::run(
"$wasi_root/bin/clang", @wasi_cflags,
"-Dmain=tacle_main_bullshit", "-I$inc",
"targets/wasm-module/$module.cpp", @$srcs,
'-o', "$bd/wasm_module.wasm"
"-Dmain=tacle_main_bullshit", "-DTARGET_WASM",
"-I$inc", "targets/wasm-module/$module.cpp",
@$srcs, '-o',
"$bd/wasm_module.wasm"
);
}
else {
Util::run( "$wasi_root/bin/clang", @wasi_cflags,
"targets/wasm-module/$module.cpp",
"-DTARGET_WASM", "targets/wasm-module/$module.cpp",
'-o', "$bd/wasm_module.wasm" );
}
@@ -371,9 +373,10 @@ sub compile_wasm_host {
sub compile_c_module {
my ( $module, $bd, $target ) = @_;
my ( $cc, @flags ) =
( $target eq 'linux' )
? ( $linux_cc, @linux_cflags )
: ( $cross_cc, @cross_cflags );
( $target eq 'linux' ) ? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
: ( $target eq 'linux-baremetal' )
? ( $cross_cc, @linux_baremetal_cflags, '-DTARGET_LINUX_BAREMETAL' )
: ( $cross_cc, @cross_cflags, '-DTARGET_FAIL' );
if ( Util::module_is_tacle($module) ) {
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
@@ -402,8 +405,9 @@ sub compile_c_module {
sub compile_c_host {
my ( $module, $bd, $target ) = @_;
my ( $cc, @flags ) =
( $target eq 'linux' )
? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
( $target eq 'linux' ) ? ( $linux_cc, @linux_cflags, '-DTARGET_LINUX' )
: ( $target eq 'linux-baremetal' )
? ( $cross_cc, @linux_baremetal_cflags, '-DTARGET_LINUX_BAREMETAL' )
: ( $cross_cc, @cross_cflags, '-DTARGET_FAIL' );
Util::run( $cc, @flags, '-c', 'targets/c-host/c_host.c', '-o',
"$bd/c_host.o" );
@@ -412,7 +416,7 @@ sub compile_c_host {
sub compile_startup {
my ( $module, $bd, $target ) = @_;
return unless $target eq 'fail';
return unless $target eq 'fail' || $target eq 'linux-baremetal';
Util::run( $cross_cc, 'targets/startup.s', '-I./targets/wasm-host',
@cross_cflags, '-c', '-o', "$bd/startup.o" );
}
@@ -448,8 +452,13 @@ sub link_wasm {
@linux_ldflags_base, '-o', "$bd/system.elf" );
}
elsif ( $target eq 'linux-baremetal' ) {
Util::run( $cross_cc, "$bd/system.o", "$bd/syscalls.o",
"$bd/libiwasm.a", @baremetal_ldflags_base, '-o', "$bd/system.elf" );
Util::run(
$cross_cc, '-Wl,-T',
'targets/linker.ld', "$bd/system.o",
"$bd/startup.o", "$bd/syscalls.o",
"$bd/libiwasm.a", @baremetal_ldflags_base,
'-o', "$bd/system.elf"
);
}
else {
die "Unknown target '$target'\n";
@@ -464,15 +473,26 @@ sub link_c {
Util::run(
$cross_cc, '-Wl,-T',
'targets/linker.ld', "$bd/c_host.o",
"$bd/startup.o", "$bd/c_module.o",
@tacle_objs, @cross_ldflags_nowasm,
'-o', "$bd/system.elf"
"$bd/startup.o", "$bd/syscalls.o",
"$bd/c_module.o", @tacle_objs,
@cross_ldflags_nowasm, '-o',
"$bd/system.elf"
);
}
elsif ( $target eq 'linux' ) {
Util::run( $linux_cc, "$bd/c_host.o", "$bd/c_module.o", @tacle_objs,
@linux_ldflags_nowasm, '-o', "$bd/system.elf" );
}
elsif ( $target eq 'linux-baremetal' ) {
Util::run(
$cross_cc, '-Wl,-T',
'targets/linker.ld', "$bd/c_host.o",
"$bd/startup.o", "$bd/syscalls.o",
"$bd/c_module.o", @tacle_objs,
@baremetal_ldflags_base, '-o',
"$bd/system.elf"
);
}
else {
die "C mode is not supported for target '$target'\n";
}
+81 -24
View File
@@ -33,6 +33,7 @@ my $local_db_conf = "$local_root/db.conf";
my $resultbrowser_port = '5000';
my $resultbrowser = 'resultbrowser.py';
my $qemu_gdb_port = '9000';
my $remote_root = '/home/lab/smchurla/Documents/failnix';
my $remote_builds_dir = "$remote_root/builds";
@@ -523,11 +524,44 @@ my %handlers = (
my $build_dir = "$local_builds_dir/$selected_build";
my $build_name = $selected_build =~ s/.*?_.*?_(.*?)_.*$/$1/r;
my $is_baremetal = $selected_build =~ /linux-baremetal$/;
my $is_wasm = $build_name eq 'aot' || $build_name eq 'interp';
say "$build_name";
system(
'gdb',
# Baremetal builds boot the iso in qemu and attach gdb
my $qemu_pid;
if ($is_baremetal) {
say "Forking...";
$qemu_pid = fork();
die "fork failed: $!\n" unless defined $qemu_pid;
if ( $qemu_pid == 0 ) {
# child -> qemu.
exec(
'qemu-system-i386',
'-drive',
"file=$build_dir/system.iso,media=cdrom",
'-boot',
'd',
'-m',
'32',
'-D',
"$local_root/qemu.log",
'-d',
"int,cpu_reset",
'-no-reboot',
'-no-shutdown',
'-S',
'-gdb',
"tcp::$qemu_gdb_port",
) or die "failed to exec qemu: $!\n";
}
}
# Shared gdb args
my @gdb_args = (
'--tui',
'-q',
"$build_dir/system.elf",
@@ -537,29 +571,52 @@ my %handlers = (
"set substitute-path 'build-$build_name' '$build_dir'",
'-ex',
"set substitute-path '/build/source/core' '$local_wamr/core'",
'-ex',
'break main',
'-ex',
'break fail_start_trace',
'-ex',
'break fail_stop_trace',
'-ex',
'break fail_marker_positive',
'-ex',
'break fail_marker_detected',
'-ex',
'break fail_marker_negative',
'-ex',
'break fail_marker_group1',
'-ex',
'break os_mmap',
'-ex',
'break wamr_malloc',
'-ex',
'break wamr_realloc',
'-ex',
'break wamr_free',
);
# Specific gdb args
if ($is_baremetal) {
push @gdb_args,
'-ex', "target remote localhost:$qemu_gdb_port",
'-ex', 'break os_main';
}
else {
push @gdb_args, '-ex', 'break main';
}
# Shared breakpoints
my @shared_breakpoints = (
'fail_start_trace', 'fail_stop_trace',
'fail_marker_positive', 'fail_marker_detected',
'fail_marker_negative',
);
# Breakpoints for native C
my @c_breakpoints = ();
# Breakpoints for Wasm
my @wasm_breakpoints = (
'fail_marker_group1',
# 'os_mmap',
# 'wamr_malloc',
# 'wamr_realloc',
# 'wamr_free',
);
my @breakpoints = (
@shared_breakpoints, $is_wasm ? @wasm_breakpoints : @c_breakpoints,
);
push @gdb_args, '-ex', "break $_" for @breakpoints;
# Autostart execution
push @gdb_args, '-ex', ( $is_baremetal ? 'continue' : 'run' );
system( 'gdb', @gdb_args );
if ($is_baremetal) {
say "Killing qemu with pid $qemu_pid...";
kill 'TERM', $qemu_pid;
waitpid( $qemu_pid, 0 );
}
},
'30. Plot Results' => sub {
+11 -6
View File
@@ -10,30 +10,36 @@
#define IMPORT(fnct) __attribute__((import_module("env"), import_name(fnct)))
#if !defined(TARGET_FAIL) && !defined(TARGET_LINUX_BAREMETAL) && \
!defined(TARGET_LINUX)
!defined(TARGET_LINUX) && !defined(TARGET_WASM)
// Set to linux while editing to prevent lsp errors
#define TARGET_LINUX
#endif
// Both the wasm wrapper and the wasm module use lib.h
// TARGET_WASM is for the wasm module...
#ifdef TARGET_WASM
#define PRINT(fmt, ...) print(fmt)
#endif
// ...the rest is for the wasm wrapper
#ifdef TARGET_FAIL
#define MAIN void os_main(void)
#define PRINT(fmt, ...)
#define PRINT_ERROR(fmt, ...)
#define PRINT_SUCCESS(fmt, ...)
#define HOST_PRINT(msg)
#define RET(val) return
#endif
#ifdef TARGET_LINUX_BAREMETAL
#define MAIN int main(int argc, char *argv[])
#define MAIN void os_main(void)
#define PRINT(fmt, ...)
#define PRINT_ERROR(fmt, ...)
#define PRINT_SUCCESS(fmt, ...)
#define HOST_PRINT(msg)
#define RET(val) return
#endif
#ifdef TARGET_LINUX
#include "stdio.h"
#define MAIN int main(int argc, char *argv[])
#define PRINT(fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__)
#define PRINT_ERROR(fmt, ...) \
@@ -42,8 +48,7 @@
#define PRINT_SUCCESS(fmt, ...) \
fprintf(stdout, "[Success] "); \
fprintf(stdout, fmt, ##__VA_ARGS__)
#define HOST_PRINT(msg) print(msg)
#define RET(val) return val;
#define RET(val) return val
#endif
typedef uint16_t enc_t;
+2 -2
View File
@@ -52,11 +52,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
};
if (cmp(Calculated, Expected)) {
HOST_PRINT("result correct.\n");
PRINT("result correct.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("result incorrect.\n");
PRINT("result incorrect.\n");
fail_marker_negative();
return 1;
}
+2 -2
View File
@@ -25,11 +25,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (X == 5) {
HOST_PRINT("result correct.\n");
PRINT("result correct.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("result incorrect.\n");
PRINT("result incorrect.\n");
fail_marker_negative();
return 1;
}
+3 -3
View File
@@ -17,7 +17,7 @@ static void naive_vote(void) {
} else if (YC == ZC) {
vote_res = YC;
} else {
HOST_PRINT("all replicas differ.\n");
PRINT("all replicas differ.\n");
fail_marker_detected();
}
}
@@ -50,11 +50,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (vote_res == 5) {
HOST_PRINT("vote success.\n");
PRINT("vote success.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("undetected error.\n");
PRINT("undetected error.\n");
fail_marker_negative();
return 1;
}
+6 -6
View File
@@ -27,7 +27,7 @@ static enc_t sum_out[REPLICA_COUNT];
static INLINE enc_t apply(enc_t vc, sign_t bdyn) {
if (bdyn > SIG_MAX) {
HOST_PRINT("signature overflow.\n");
PRINT("signature overflow.\n");
fail_marker_detected();
}
return vc + bdyn;
@@ -49,7 +49,7 @@ static sign_t cored_vote(void) {
cored_res = apply(XC, (XC - ZC));
return SIG_s_XZ;
} else {
HOST_PRINT("all replicas differ.\n");
PRINT("all replicas differ.\n");
fail_marker_detected();
return 0;
}
@@ -93,7 +93,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
vote_result_sig = SIG_Y;
break;
default:
HOST_PRINT("unknown static_sig.\n");
PRINT("unknown static_sig.\n");
break;
}
@@ -102,18 +102,18 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
/* Validate Vote result */
if (!check(cored_res, THE_A, vote_result_sig)) {
HOST_PRINT("voted result invalid.\n");
PRINT("voted result invalid.\n");
fail_marker_detected();
return 2;
}
plain_t res = decode(cored_res, THE_A, vote_result_sig);
if (res == 5) {
HOST_PRINT("cored success.\n");
PRINT("cored success.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("undetected error.\n");
PRINT("undetected error.\n");
fail_marker_negative();
return 1;
}
+3 -3
View File
@@ -17,7 +17,7 @@ static void naive_vote(void) {
} else if (YC == ZC) {
vote_res = YC;
} else {
HOST_PRINT("all replicas differ.\n");
PRINT("all replicas differ.\n");
fail_marker_detected();
}
}
@@ -50,11 +50,11 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
fail_stop_trace();
if (vote_res == 5) {
HOST_PRINT("vote success.\n");
PRINT("vote success.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("undetected error.\n");
PRINT("undetected error.\n");
fail_marker_negative();
return 1;
}
+6 -6
View File
@@ -27,7 +27,7 @@ static enc_t sum_out[REPLICA_COUNT];
static INLINE enc_t apply(enc_t vc, sign_t bdyn) {
if (bdyn > SIG_MAX) {
HOST_PRINT("signature overflow.\n");
PRINT("signature overflow.\n");
fail_marker_detected();
}
return vc + bdyn;
@@ -49,7 +49,7 @@ static sign_t cored_vote(void) {
cored_res = apply(XC, (XC - ZC));
return SIG_s_XZ;
} else {
HOST_PRINT("all replicas differ.\n");
PRINT("all replicas differ.\n");
fail_marker_detected();
return 0;
}
@@ -93,7 +93,7 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
vote_result_sig = SIG_Y;
break;
default:
HOST_PRINT("unknown static_sig.\n");
PRINT("unknown static_sig.\n");
break;
}
@@ -102,18 +102,18 @@ extern "C" EXPORT("wasm_module") int wasm_module(void) {
/* Validate Vote result */
if (!check(cored_res, THE_A, vote_result_sig)) {
HOST_PRINT("voted result invalid.\n");
PRINT("voted result invalid.\n");
fail_marker_detected();
return 2;
}
plain_t res = decode(cored_res, THE_A, vote_result_sig);
if (res == 5) {
HOST_PRINT("cored success.\n");
PRINT("cored success.\n");
fail_marker_positive();
return 0;
} else {
HOST_PRINT("undetected error.\n");
PRINT("undetected error.\n");
fail_marker_negative();
return 1;
}
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = binarysearch_return() - (-1);
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = bsort_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = complex_updates_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = countnegative_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
+2
View File
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = fft_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = matrix1_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
+2
View File
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = md5_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = (quicksort_return() - 1527923179 != 0);
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = recursion_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
+2
View File
@@ -16,8 +16,10 @@ EXPORT("wasm_module") int wasm_module(void) {
int ret = sha_return();
if (ret == 0) {
PRINT("result correct.\n");
fail_marker_positive();
} else {
PRINT("result incorrect.\n");
fail_marker_negative();
}
return ret;
@@ -28,7 +28,7 @@
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
#define MAXSIZE 20
#define MAXSIZE 8
/*
Type definition for the matrix
@@ -71,7 +71,7 @@
__attribute__((import_module("__pragma"), import_name("loopbound"))) extern void
__pragma_loopbound(unsigned int min_bound, unsigned int max_bound);
#define N_FFT 1024
#define N_FFT 16
#define NUMBER_OF_BITS 13 /* fract format 1.NUMBER_OF_BITS = 1.13 */
#define BITS_PER_TWID 13 /* bits per twiddle coefficient */
@@ -37,7 +37,7 @@ __attribute__((noinline)) __attribute__((export_name("main"))) int main(void);
void
recursion_init() {
int volatile temp_input = 10;
int volatile temp_input = 7;
recursion_input = temp_input;
}
@@ -53,7 +53,7 @@ recursion_fib(int i) {
int
recursion_return() {
return (recursion_result + (-89)) != 0;
return (recursion_result + (-21)) != 0;
}
__attribute__((noinline)) __attribute__((export_name("entrypoint"))) void