Compare commits

..
5 Commits
Author SHA1 Message Date
christoph 334bdbff76 Don't fail nm calls silently 2026-08-17 21:59:57 +02:00
christoph 87d5d5b92d Add traceweight query 2026-08-17 21:50:36 +02:00
christoph d243703704 Keep executing queries even if a single one fails 2026-08-17 21:47:08 +02:00
christoph ba1f169ee0 Disable baseline comparison action 2026-08-17 20:39:29 +02:00
christoph ff26c61ab2 Ignore __pycache__ 2026-08-17 20:37:01 +02:00
47 changed files with 314 additions and 95 deletions
+1 -1
View File
@@ -1,9 +1,9 @@
/**/__pycache__
/build-*
/builds
/ghidra/projects/**/*.lock*
/mars-db.conf
/.direnv
/db.conf
/fail/bin/resultbrowser/app/__pycache__
/fail/bin/VisualFAIL/CONFIGURATION.php
/qemu.log
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:e2ed30d803742bd252e6270cadf416d0397b2e4c03ccd34757c8085b614e4d27
3 size 59
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7798897d5294e0caf565c64fa4235d6f4d3dccbd68c67bf6adfc10146958bd86
3 size 56
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:740552aa6072758eaf2e0b6a3aaf1041baeab7effaf0cdb72d5ac93cf9b7fbc7
3 size 59
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f03eb0bd9d73f938600c3f049f0363ebfeaf940ff25d699bc39d55eb5fc5e88a
3 size 68
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:4c8a44218e52bf5191b119b5a233d1c68e7e00829b458efb8099486d51b59af2
3 size 66
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a713b975763865e9150b8d0966b67a0ab695cadf3e27013326f5785d941739ac
3 size 67
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:fa578c43d05a03614379afaba54ead1b3cc80f98b2778658def59c2c5083f374
3 size 74
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:0f69263036f15d57a987d52f8508f617cdaae97fad674d500d38d3a26f26f49c
3 size 74
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:378e09360459cc09708b2b9545e457f396d8ae33ae2680d5554d554c63af9b3a
3 size 79
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:db9c37652cc191d18f9c923250eb4143c41a0c56e2b098436432644922fdfb03
3 size 62
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:8a90a67f0cedd9577f3f833d5ad6d12c1bad962313c451a9402a0690dc24a7ab
3 size 69
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:8b8d824469b5dcc3fd8f3b0fa9a75e3ad0231eb98deeafb6c87b72535ea28dbf
3 size 79
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:257c3170574dedd88cc2a5470feed4ccf06a85fdf5e9d8255c224b072e012755
3 size 69
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:350f0fdf4e1d5c8353eb0d70025d896118fc269803922e66c1c66ad623629721
3 size 75
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:78e83fe57d8a210087ed81bbe4a63918e706901888e8c48606c5e86943601bb9
3 size 82
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:8587c963ac9dc66fe485eeb04d3e1e194183463e95db2f0711202ed3700d64e1
3 size 70
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:6f3d15f38e7196f00bdc04b897df7ea0efa0b5f0dc203ab83a53bf101bb80417
3 size 79
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d429548276c7849c61a98324dfbd4cff8e6ff226fed1159f141c8a38a05bc758
3 size 85
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a73b6788bbbbc8e6aa9bbf7ebeed3bfa0d80cdcc8bd0acd017856b41efbbc49e
3 size 67
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:a5e37bf8841e4b12e1d6cd4e9359d0f478b0e4d8b9c7f4eed69b84eccc5892b2
3 size 74
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:8a4286b6ce51d3a60776558c372ac6e3327e137154203c2947290ab2cb3862a7
3 size 80
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:e20f69c395e0ba1af4eb10e73c60dfbb5bed35a5cf785def576d3c1216a9a47c
3 size 69
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d6e9a0fb9b7ef6178f515564f286dee73ef4140a62bfe6cfafb11de8686f8fe6
3 size 75
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:ebff392b4181888c0365f7c8234e868431e2375d50124109b195dbb70bd63378
3 size 82
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:39c1248e770e7f9f20cf07207c5d484cce6410be8a799af8e8a4c37f5a366039
3 size 67
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:64368138de77e299d141b2e974eb9120c754aa44ab36b473a00e0b46385fdb53
3 size 75
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:56b4baec592c21cfc2ce514b3b7c397b26c96c0a66e9884480d7265f12e25e25
3 size 81
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:d169ea9e254966004851582feef4c972ff1769d26d4d10eaa22120cd5ca96fa8
3 size 73
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:139ee1a0e62c03274170e9868bc92f2f32dc2b069950d5fa59248223849e1aac
3 size 80
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:ebf459f76845385062ffffd4561cfc0eaaf073777863a19cf333c2bb9d09ce7f
3 size 86
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3b454f5afbf0a0e72f95ae5aa5ecf4b6ebd2253d191af91e63f9e19557659ae6
3 size 59
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:fefb23b39a4a1a7f41ec22cae47694db1cb62999f0d6736d95a30eefe1bd3ed6
3 size 67
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:08786ab399545da7ee9ec6b8ab7418927d690e34e950caff38fc70d3874d19ae
3 size 74
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:44da7dbab5b20047e39fb6d4e0a7892859934dd8584695c65c7b534e91ef8718
3 size 66
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:adaf7502a3e7d8708a98f52b43e7463be495078cbea3133a7eec1fd14def3746
3 size 74
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:f02bc6a76736597ad580486d2d8f232919e02b467545428522a857b678efc107
3 size 81
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:3a4de2f41f9b135c310581a6e15ec43c74d964846cdae30ee776ce511d338cc4
3 size 63
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:7509bf0a0ee4bdda6ec35f1202802074a5d88dc4105586d10705095bc6f956bf
3 size 72
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:fc31d680ce7cbd1aa72b5ddc07787d78a071f0b2424848fdff260fcd1a06cb35
3 size 79
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:747d234a0e2ee06db735995865381abad102fff1d71589b4f0e0b5960473179c
3 size 73
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:13237754e90b467c98c136c948179c5276c3a5ad38ed303baea0b8e014213637
3 size 79
Binary file not shown.
1 version https://git-lfs.github.com/spec/v1
2 oid sha256:4cacaf975ef3d749f36782a100e69d7d342647c088088dfd77b9ffe6584e7482
3 size 85
+35 -5
View File
@@ -181,19 +181,49 @@ sub format_number_sep {
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 {
my ( $elffile, $sym ) = @_;
my $line = qx{nm "$elffile" 2>/dev/null | grep " $sym\$"};
return undef unless $line =~ /^([0-9a-f]+)/i;
return hex($1);
for my $line ( nm_lines($elffile) ) {
# "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
sub elf_sym_range {
my ( $elffile, $sym ) = @_;
my @lines = qx{nm -nS "$elffile" 2>/dev/null};
return () unless @lines;
my @lines = nm_lines( $elffile, '-nS' );
for my $i ( 0 .. $#lines ) {
my $line = $lines[$i];
+55
View File
@@ -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
View File
@@ -336,93 +336,93 @@ my %handlers = (
0, @entries );
},
'11b. Compare to Baseline' => sub {
my $baseline = Util::select_experiment(0);
my @selected_experiments = Util::select_experiment(1);
# TODO: Fails silently if not every selected experiment has this datafile
my $resultsdata_csv =
Util::pick_data_file( "$local_archive_dir/$baseline", "resultsdata" );
my %all_results;
foreach my $experiment ( $baseline, @selected_experiments ) {
my $data = Text::CSV_XS::csv(
in => "$local_archive_dir/$experiment/$resultsdata_csv",
headers => 'auto'
);
foreach my $row (@$data) {
$all_results{$experiment}{ $row->{benchmark} }
{ $row->{resulttype} } = $row->{faults};
}
}
my @benchs = ( 'ip', 'mem', 'regs' );
my @markers = (
'OK_MARKER', 'FAIL_MARKER',
'DETECTED_MARKER', 'TIMEOUT',
'TRAP', 'WRITE_TEXTSEGMENT',
'ACCESS_OUTERSPACE', 'GROUP1_MARKER'
);
my $heading = sprintf( "%5s %20s %50s ", "BENCH", "TYPE", $baseline );
my $subheading = sprintf( "%5s %20s %50s ",
"", "", Util::read_experiment_info($baseline) );
foreach my $experiment (@selected_experiments) {
$heading .= sprintf( "%50s ", $experiment );
$subheading .=
sprintf( "%50s ", Util::read_experiment_info($experiment) );
}
my @entries = ( $heading, $subheading, "" );
foreach my $benchmark (@benchs) {
foreach my $marker (@markers) {
my $entry = sprintf( "%5s %20s ", $benchmark, $marker );
if ( exists $all_results{$baseline}{$benchmark}{$marker} ) {
$entry .= sprintf(
"%50s ",
Util::format_number_sep(
$all_results{$baseline}{$benchmark}{$marker}
)
);
}
else {
$entry .= sprintf( "%50s ", "" );
}
foreach my $experiment (@selected_experiments) {
if ( exists $all_results{$baseline}{$benchmark}{$marker}
and
exists $all_results{$experiment}{$benchmark}{$marker}
and $all_results{$baseline}{$benchmark}{$marker} != 0 )
{
my $factor =
$all_results{$experiment}{$benchmark}{$marker} /
$all_results{$baseline}{$benchmark}{$marker};
$entry .=
sprintf( "%50s ", sprintf( "%.2fx", $factor ) );
}
else {
$entry .= sprintf( "%50s ", "" );
}
}
push @entries, $entry;
}
push @entries, "";
}
TUI::select_from_list(
"Baseline: $baseline — Comparing "
. scalar(@selected_experiments)
. " Experiments",
0, @entries
);
},
# '11b. Compare to Baseline' => sub {
#
# my $baseline = Util::select_experiment(0);
#
# my @selected_experiments = Util::select_experiment(1);
#
# # TODO: Fails silently if not every selected experiment has this datafile
# my $resultsdata_csv =
# Util::pick_data_file( "$local_archive_dir/$baseline", "resultsdata" );
#
# my %all_results;
# foreach my $experiment ( $baseline, @selected_experiments ) {
#
# my $data = Text::CSV_XS::csv(
# in => "$local_archive_dir/$experiment/$resultsdata_csv",
# headers => 'auto'
# );
#
# foreach my $row (@$data) {
# $all_results{$experiment}{ $row->{benchmark} }
# { $row->{resulttype} } = $row->{faults};
# }
# }
#
# my @benchs = ( 'ip', 'mem', 'regs' );
# my @markers = (
# 'OK_MARKER', 'FAIL_MARKER',
# 'DETECTED_MARKER', 'TIMEOUT',
# 'TRAP', 'WRITE_TEXTSEGMENT',
# 'ACCESS_OUTERSPACE', 'GROUP1_MARKER'
# );
#
# my $heading = sprintf( "%5s %20s %50s ", "BENCH", "TYPE", $baseline );
# my $subheading = sprintf( "%5s %20s %50s ",
# "", "", Util::read_experiment_info($baseline) );
# foreach my $experiment (@selected_experiments) {
# $heading .= sprintf( "%50s ", $experiment );
# $subheading .=
# sprintf( "%50s ", Util::read_experiment_info($experiment) );
# }
#
# my @entries = ( $heading, $subheading, "" );
# foreach my $benchmark (@benchs) {
# foreach my $marker (@markers) {
# my $entry = sprintf( "%5s %20s ", $benchmark, $marker );
#
# if ( exists $all_results{$baseline}{$benchmark}{$marker} ) {
# $entry .= sprintf(
# "%50s ",
# Util::format_number_sep(
# $all_results{$baseline}{$benchmark}{$marker}
# )
# );
# }
# else {
# $entry .= sprintf( "%50s ", "" );
# }
#
# foreach my $experiment (@selected_experiments) {
# if ( exists $all_results{$baseline}{$benchmark}{$marker}
# and
# exists $all_results{$experiment}{$benchmark}{$marker}
# and $all_results{$baseline}{$benchmark}{$marker} != 0 )
# {
# my $factor =
# $all_results{$experiment}{$benchmark}{$marker} /
# $all_results{$baseline}{$benchmark}{$marker};
# $entry .=
# sprintf( "%50s ", sprintf( "%.2fx", $factor ) );
# }
# else {
# $entry .= sprintf( "%50s ", "" );
# }
# }
#
# push @entries, $entry;
# }
# push @entries, "";
# }
#
# TUI::select_from_list(
# "Baseline: $baseline — Comparing "
# . scalar(@selected_experiments)
# . " Experiments",
# 0, @entries
# );
# },
'12. Open Experiment in BinaryNinja' => sub {
my @selected_experiments = Util::select_experiment(1);
+10 -2
View File
@@ -281,9 +281,17 @@ sub results {
# Filters are combined into one
my @configs = Filters::get_default_configs();
# Keep trying even if a single query fails
for my $query (@queries) {
Util::execute_query( $experiment, $query,
$remote_db_conf, $remote_builds_dir, 1, @configs );
eval {
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";
};
}
}