Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
334bdbff76
|
||
|
|
87d5d5b92d
|
||
|
|
d243703704
|
||
|
|
ba1f169ee0
|
||
|
|
ff26c61ab2
|
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
|
/**/__pycache__
|
||||||
/build-*
|
/build-*
|
||||||
/builds
|
/builds
|
||||||
/ghidra/projects/**/*.lock*
|
/ghidra/projects/**/*.lock*
|
||||||
/mars-db.conf
|
/mars-db.conf
|
||||||
/.direnv
|
/.direnv
|
||||||
/db.conf
|
/db.conf
|
||||||
/fail/bin/resultbrowser/app/__pycache__
|
|
||||||
/fail/bin/VisualFAIL/CONFIGURATION.php
|
/fail/bin/VisualFAIL/CONFIGURATION.php
|
||||||
/qemu.log
|
/qemu.log
|
||||||
|
|||||||
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
BIN
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
Binary file not shown.
|
+35
-5
@@ -181,19 +181,49 @@ sub format_number_sep {
|
|||||||
return $number;
|
return $number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run nm once and cache the result instead of running 20x per query
|
||||||
|
my %nm_cache;
|
||||||
|
|
||||||
|
sub nm_lines {
|
||||||
|
my ( $elffile, @nm_args ) = @_;
|
||||||
|
|
||||||
|
my $command = join ' ', 'nm', @nm_args, shell_quote($elffile);
|
||||||
|
return @{ $nm_cache{$command} } if exists $nm_cache{$command};
|
||||||
|
|
||||||
|
die "ELF file does not exist: $elffile\n" unless -f $elffile;
|
||||||
|
|
||||||
|
my @lines = qx{$command 2>&1};
|
||||||
|
my $status = $?;
|
||||||
|
|
||||||
|
die "nm not found in PATH\n"
|
||||||
|
if $status == -1 || ( $status >> 8 ) == 127;
|
||||||
|
die "nm failed on $elffile (exit @{[ $status >> 8 ]}): @lines"
|
||||||
|
if $status != 0;
|
||||||
|
die "nm found no symbols in $elffile\n" unless @lines;
|
||||||
|
|
||||||
|
$nm_cache{$command} = \@lines;
|
||||||
|
return @lines;
|
||||||
|
}
|
||||||
|
|
||||||
sub elf_sym_addr {
|
sub elf_sym_addr {
|
||||||
my ( $elffile, $sym ) = @_;
|
my ( $elffile, $sym ) = @_;
|
||||||
my $line = qx{nm "$elffile" 2>/dev/null | grep " $sym\$"};
|
|
||||||
return undef unless $line =~ /^([0-9a-f]+)/i;
|
for my $line ( nm_lines($elffile) ) {
|
||||||
return hex($1);
|
|
||||||
|
# "0010eefe T aot_invoke_native"
|
||||||
|
# This is case-sensitive!
|
||||||
|
next unless $line =~ /^([0-9a-fA-F]+)\s+\S\s+\Q$sym\E$/;
|
||||||
|
return hex($1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine the address range of a function symbol
|
# Determine the address range of a function symbol
|
||||||
sub elf_sym_range {
|
sub elf_sym_range {
|
||||||
my ( $elffile, $sym ) = @_;
|
my ( $elffile, $sym ) = @_;
|
||||||
|
|
||||||
my @lines = qx{nm -nS "$elffile" 2>/dev/null};
|
my @lines = nm_lines( $elffile, '-nS' );
|
||||||
return () unless @lines;
|
|
||||||
|
|
||||||
for my $i ( 0 .. $#lines ) {
|
for my $i ( 0 .. $#lines ) {
|
||||||
my $line = $lines[$i];
|
my $line = $lines[$i];
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package TraceWeight;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use diagnostics;
|
||||||
|
|
||||||
|
use FindBin;
|
||||||
|
use lib "$FindBin::Bin/../Modules";
|
||||||
|
use Filters;
|
||||||
|
|
||||||
|
use feature 'say';
|
||||||
|
|
||||||
|
sub query {
|
||||||
|
my ( $experiment, $experiment_dir, @filter_config_names ) = @_;
|
||||||
|
|
||||||
|
my $extra =
|
||||||
|
Filters::build_filter_clause( $experiment_dir, @filter_config_names );
|
||||||
|
|
||||||
|
# This query basically asks: How much faultspace area is there?
|
||||||
|
# It queries the same "SUM(t.time2 - t.time1 + 1)" as ResultsData.pm,
|
||||||
|
# but doesn't join over "result_GenericExperimentMessage", so the
|
||||||
|
# faultspace area is not repeated.
|
||||||
|
# The "COUNT(*)" part counts the number of equivalence classes
|
||||||
|
# (or the number of pilots in other words).
|
||||||
|
# The number of actual injections is (probably/hopefully) 8 * pilots,
|
||||||
|
# because we run with --inject-single-bit.
|
||||||
|
# We expect the "weight" to be equal to the number of pilots for the
|
||||||
|
# IP benchmark, as the IP injections are only a single tick long.
|
||||||
|
my $querystring = "SELECT
|
||||||
|
benchmark, SUM(t.time2 - t.time1 + 1) AS weight, COUNT(*) AS pilots
|
||||||
|
FROM variant v
|
||||||
|
JOIN trace t ON v.id = t.variant_id
|
||||||
|
JOIN fspgroup g ON g.variant_id = t.variant_id AND g.instr2 = t.instr2 AND g.data_physical_address = t.data_physical_address
|
||||||
|
JOIN fsppilot p ON p.id = g.pilot_id
|
||||||
|
WHERE v.variant = '$experiment'$extra
|
||||||
|
GROUP BY v.id, benchmark
|
||||||
|
ORDER BY variant, benchmark;";
|
||||||
|
|
||||||
|
say $querystring;
|
||||||
|
|
||||||
|
return $querystring;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub args { return "--batch --raw"; }
|
||||||
|
|
||||||
|
sub filename {
|
||||||
|
my @filter_config_names = grep { defined && length } @_;
|
||||||
|
my $suffix =
|
||||||
|
@filter_config_names ? "_" . join( "+", sort @filter_config_names ) : "";
|
||||||
|
return "traceweight${suffix}.csv";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub postprocess { $_[0] =~ s/\t/,/g; }
|
||||||
|
|
||||||
|
1;
|
||||||
+87
-87
@@ -336,93 +336,93 @@ my %handlers = (
|
|||||||
0, @entries );
|
0, @entries );
|
||||||
},
|
},
|
||||||
|
|
||||||
'11b. Compare to Baseline' => sub {
|
# '11b. Compare to Baseline' => sub {
|
||||||
|
#
|
||||||
my $baseline = Util::select_experiment(0);
|
# my $baseline = Util::select_experiment(0);
|
||||||
|
#
|
||||||
my @selected_experiments = Util::select_experiment(1);
|
# my @selected_experiments = Util::select_experiment(1);
|
||||||
|
#
|
||||||
# TODO: Fails silently if not every selected experiment has this datafile
|
# # TODO: Fails silently if not every selected experiment has this datafile
|
||||||
my $resultsdata_csv =
|
# my $resultsdata_csv =
|
||||||
Util::pick_data_file( "$local_archive_dir/$baseline", "resultsdata" );
|
# Util::pick_data_file( "$local_archive_dir/$baseline", "resultsdata" );
|
||||||
|
#
|
||||||
my %all_results;
|
# my %all_results;
|
||||||
foreach my $experiment ( $baseline, @selected_experiments ) {
|
# foreach my $experiment ( $baseline, @selected_experiments ) {
|
||||||
|
#
|
||||||
my $data = Text::CSV_XS::csv(
|
# my $data = Text::CSV_XS::csv(
|
||||||
in => "$local_archive_dir/$experiment/$resultsdata_csv",
|
# in => "$local_archive_dir/$experiment/$resultsdata_csv",
|
||||||
headers => 'auto'
|
# headers => 'auto'
|
||||||
);
|
# );
|
||||||
|
#
|
||||||
foreach my $row (@$data) {
|
# foreach my $row (@$data) {
|
||||||
$all_results{$experiment}{ $row->{benchmark} }
|
# $all_results{$experiment}{ $row->{benchmark} }
|
||||||
{ $row->{resulttype} } = $row->{faults};
|
# { $row->{resulttype} } = $row->{faults};
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
my @benchs = ( 'ip', 'mem', 'regs' );
|
# my @benchs = ( 'ip', 'mem', 'regs' );
|
||||||
my @markers = (
|
# my @markers = (
|
||||||
'OK_MARKER', 'FAIL_MARKER',
|
# 'OK_MARKER', 'FAIL_MARKER',
|
||||||
'DETECTED_MARKER', 'TIMEOUT',
|
# 'DETECTED_MARKER', 'TIMEOUT',
|
||||||
'TRAP', 'WRITE_TEXTSEGMENT',
|
# 'TRAP', 'WRITE_TEXTSEGMENT',
|
||||||
'ACCESS_OUTERSPACE', 'GROUP1_MARKER'
|
# 'ACCESS_OUTERSPACE', 'GROUP1_MARKER'
|
||||||
);
|
# );
|
||||||
|
#
|
||||||
my $heading = sprintf( "%5s %20s %50s ", "BENCH", "TYPE", $baseline );
|
# my $heading = sprintf( "%5s %20s %50s ", "BENCH", "TYPE", $baseline );
|
||||||
my $subheading = sprintf( "%5s %20s %50s ",
|
# my $subheading = sprintf( "%5s %20s %50s ",
|
||||||
"", "", Util::read_experiment_info($baseline) );
|
# "", "", Util::read_experiment_info($baseline) );
|
||||||
foreach my $experiment (@selected_experiments) {
|
# foreach my $experiment (@selected_experiments) {
|
||||||
$heading .= sprintf( "%50s ", $experiment );
|
# $heading .= sprintf( "%50s ", $experiment );
|
||||||
$subheading .=
|
# $subheading .=
|
||||||
sprintf( "%50s ", Util::read_experiment_info($experiment) );
|
# sprintf( "%50s ", Util::read_experiment_info($experiment) );
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
my @entries = ( $heading, $subheading, "" );
|
# my @entries = ( $heading, $subheading, "" );
|
||||||
foreach my $benchmark (@benchs) {
|
# foreach my $benchmark (@benchs) {
|
||||||
foreach my $marker (@markers) {
|
# foreach my $marker (@markers) {
|
||||||
my $entry = sprintf( "%5s %20s ", $benchmark, $marker );
|
# my $entry = sprintf( "%5s %20s ", $benchmark, $marker );
|
||||||
|
#
|
||||||
if ( exists $all_results{$baseline}{$benchmark}{$marker} ) {
|
# if ( exists $all_results{$baseline}{$benchmark}{$marker} ) {
|
||||||
$entry .= sprintf(
|
# $entry .= sprintf(
|
||||||
"%50s ",
|
# "%50s ",
|
||||||
Util::format_number_sep(
|
# Util::format_number_sep(
|
||||||
$all_results{$baseline}{$benchmark}{$marker}
|
# $all_results{$baseline}{$benchmark}{$marker}
|
||||||
)
|
# )
|
||||||
);
|
# );
|
||||||
}
|
# }
|
||||||
else {
|
# else {
|
||||||
$entry .= sprintf( "%50s ", "" );
|
# $entry .= sprintf( "%50s ", "" );
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
foreach my $experiment (@selected_experiments) {
|
# foreach my $experiment (@selected_experiments) {
|
||||||
if ( exists $all_results{$baseline}{$benchmark}{$marker}
|
# if ( exists $all_results{$baseline}{$benchmark}{$marker}
|
||||||
and
|
# and
|
||||||
exists $all_results{$experiment}{$benchmark}{$marker}
|
# exists $all_results{$experiment}{$benchmark}{$marker}
|
||||||
and $all_results{$baseline}{$benchmark}{$marker} != 0 )
|
# and $all_results{$baseline}{$benchmark}{$marker} != 0 )
|
||||||
{
|
# {
|
||||||
my $factor =
|
# my $factor =
|
||||||
$all_results{$experiment}{$benchmark}{$marker} /
|
# $all_results{$experiment}{$benchmark}{$marker} /
|
||||||
$all_results{$baseline}{$benchmark}{$marker};
|
# $all_results{$baseline}{$benchmark}{$marker};
|
||||||
$entry .=
|
# $entry .=
|
||||||
sprintf( "%50s ", sprintf( "%.2fx", $factor ) );
|
# sprintf( "%50s ", sprintf( "%.2fx", $factor ) );
|
||||||
}
|
# }
|
||||||
else {
|
# else {
|
||||||
$entry .= sprintf( "%50s ", "" );
|
# $entry .= sprintf( "%50s ", "" );
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
push @entries, $entry;
|
# push @entries, $entry;
|
||||||
}
|
# }
|
||||||
push @entries, "";
|
# push @entries, "";
|
||||||
}
|
# }
|
||||||
|
#
|
||||||
TUI::select_from_list(
|
# TUI::select_from_list(
|
||||||
"Baseline: $baseline — Comparing "
|
# "Baseline: $baseline — Comparing "
|
||||||
. scalar(@selected_experiments)
|
# . scalar(@selected_experiments)
|
||||||
. " Experiments",
|
# . " Experiments",
|
||||||
0, @entries
|
# 0, @entries
|
||||||
);
|
# );
|
||||||
},
|
# },
|
||||||
|
|
||||||
'12. Open Experiment in BinaryNinja' => sub {
|
'12. Open Experiment in BinaryNinja' => sub {
|
||||||
my @selected_experiments = Util::select_experiment(1);
|
my @selected_experiments = Util::select_experiment(1);
|
||||||
|
|||||||
+10
-2
@@ -281,9 +281,17 @@ sub results {
|
|||||||
# Filters are combined into one
|
# Filters are combined into one
|
||||||
my @configs = Filters::get_default_configs();
|
my @configs = Filters::get_default_configs();
|
||||||
|
|
||||||
|
# Keep trying even if a single query fails
|
||||||
for my $query (@queries) {
|
for my $query (@queries) {
|
||||||
Util::execute_query( $experiment, $query,
|
eval {
|
||||||
$remote_db_conf, $remote_builds_dir, 1, @configs );
|
Util::execute_query( $experiment, $query,
|
||||||
|
$remote_db_conf, $remote_builds_dir, 1, @configs );
|
||||||
|
1;
|
||||||
|
} or do {
|
||||||
|
my $error = $@ || 'bullshit error';
|
||||||
|
chomp $error;
|
||||||
|
warn "Query $query failed for $experiment: $error\n";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user