@@ -160,7 +160,6 @@ if (!$input_raw and ($squash_by_path or $squash_by_filename)) {
if (!is_supported_architecture()) {
show_detected_architecture() if $debug;
-} else {
printf "\nScript does not support your architecture, sorry.\n";
printf "\nCurrently we support: \n\n";
foreach(@SUPPORTED_ARCHITECTURES) {
@@ -267,7 +266,7 @@ sub is_false_positive
sub is_false_positive_ix86_32
{
my ($match) = @_;
- state $page_offset = get_page_offset(); # only gets called once
+ state $page_offset = eval get_page_offset(); # only gets called once
if ($match =~ '\b(0x)?(f|F){8}\b') {
return 1;
@@ -293,7 +292,7 @@ sub get_page_offset
}
# Allow --kernel-config-file to override.
- if ($kernel_config_file != "") {
+ if ($kernel_config_file ne "") {
@config_files = ($kernel_config_file);
} else {
my $config_file = '/boot/config-' . `uname -r`;
@@ -314,14 +313,16 @@ sub get_page_offset
}
foreach my $config_file (@config_files) {
- $page_offset = parse_kernel_config($config_file);
+ $page_offset = parse_kernel_config_file($config_file);
if ($page_offset ne "") {
return $page_offset;
}
}
- printf STDERR "Failed to parse kernel config files\n";
- printf STDERR "Falling back to %s\n", $default_offset;
+ printf STDERR "\nFailed to parse kernel config files\n";
+ printf STDERR "*** NOTE ***\n";
+ printf STDERR "Falling back to PAGE_OFFSET = %s\n\n", $default_offset;
+
return $default_offset;
}
@@ -329,11 +330,13 @@ sub parse_kernel_config_file
{
my ($file) = @_;
my $config = 'CONFIG_PAGE_OFFSET';
+ my $str = "";
+ my $val = "";
open(my $fh, "<", $file) or return "";
while (my $line = <$fh> ) {
if ($line =~ /^$config/) {
- my ($str, $val) = split /=/, $line;
+ ($str, $val) = split /=/, $line;
chomp($val);
last;
}
Hi, Applies upon the previous one in this thread. Found and fixed some minor issues with light testing on a 32-bit x86. (I realize this isn't an ideal description, forgive me!). Have also emitted a 'noisy' warning on PAGE_OFFSET fallback to 0xc00000000. Signed-off-by: Kaiwan N Billimoria <kaiwan.billimoria@gmail.com> --- scripts/leaking_addresses.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)