diff mbox

Re: [PATCH] leaking_addresses: add support for 32-bit kernel addresses

Message ID 1512362481.17323.9.camel@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kaiwan N Billimoria Dec. 4, 2017, 4:41 a.m. UTC
On Mon, 2017-12-04 at 11:11 +1100, Tobin C. Harding wrote:
> On Fri, Dec 01, 2017 at 06:39:07PM +0530, kaiwan.billimoria@gmail.com wrote:

> > @@ -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
> 
> Why do you use 'eval' here?
> 
Without the eval:
i.e.
  state $page_offset = get_page_offset(); # only gets called once

$ ./leaking_addresses.pl  |head -200
Argument "0x80000000" isn't numeric in numeric lt (<) at ./leaking_addresses.pl line 277.
...

With the 'eval', no warning, it's fine.


Additional Comments:

a) When running in debug mode, print the arch we're currently running on
b) Also, while checking, I found another bug; requires the fix below (strip the filename of LF).

Patch follows:

---



Thanks,
Kaiwan.


> thanks,
> Tobin.

Comments

Tobin Harding Dec. 4, 2017, 4:55 a.m. UTC | #1
On Mon, Dec 04, 2017 at 10:11:21AM +0530, kaiwan.billimoria@gmail.com wrote:
> On Mon, 2017-12-04 at 11:11 +1100, Tobin C. Harding wrote:
> > On Fri, Dec 01, 2017 at 06:39:07PM +0530, kaiwan.billimoria@gmail.com wrote:
> 
> > > @@ -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
> > 
> > Why do you use 'eval' here?
> > 
> Without the eval:
> i.e.
>   state $page_offset = get_page_offset(); # only gets called once
> 
> $ ./leaking_addresses.pl  |head -200
> Argument "0x80000000" isn't numeric in numeric lt (<) at ./leaking_addresses.pl line 277.
> ...
> 
> With the 'eval', no warning, it's fine.

Why not use hex()?

> Additional Comments:
> 
> a) When running in debug mode, print the arch we're currently running on
> b) Also, while checking, I found another bug; requires the fix below (strip the filename of LF).
> 
> Patch follows:
> 
> ---
> diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
> index 3a8691a642c8..9906dcf8b807 100755
> --- a/scripts/leaking_addresses.pl
> +++ b/scripts/leaking_addresses.pl
> @@ -158,8 +158,8 @@ if (!$input_raw and ($squash_by_path or $squash_by_filename)) {
>         exit(128);
>  }
>  
> +show_detected_architecture() if $debug;
>  if (!is_supported_architecture()) {
> -       show_detected_architecture() if $debug;
>         printf "\nScript does not support your architecture, sorry.\n";
>         printf "\nCurrently we support: \n\n";
>         foreach(@SUPPORTED_ARCHITECTURES) {
> @@ -313,6 +313,7 @@ sub get_page_offset
>         }
>  
>         foreach my $config_file (@config_files) {
> +               $config_file =~ s/\R*//g;

Is there some reason you don't use chomp()?

thanks,
Tobin.
Kaiwan N Billimoria Dec. 4, 2017, 5:09 a.m. UTC | #2
On Mon, Dec 4, 2017 at 10:25 AM, Tobin C. Harding <me@tobin.cc> wrote:
>
> > With the 'eval', no warning, it's fine.
>
> Why not use hex()?

> >
> >         foreach my $config_file (@config_files) {
> > +               $config_file =~ s/\R*//g;
>
> Is there some reason you don't use chomp()?

Tobin, now you can see that I'm indeed a Perl newbie noob! :-)
Will follow your suggestions.. indeed, feel free to go ahead with Perl-stuff
that's more appropriate than my (very amateur) perl!

thanks, Kaiwan.

> thanks,
> Tobin.
diff mbox

Patch

diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
index 3a8691a642c8..9906dcf8b807 100755
--- a/scripts/leaking_addresses.pl
+++ b/scripts/leaking_addresses.pl
@@ -158,8 +158,8 @@  if (!$input_raw and ($squash_by_path or $squash_by_filename)) {
        exit(128);
 }
 
+show_detected_architecture() if $debug;
 if (!is_supported_architecture()) {
-       show_detected_architecture() if $debug;
        printf "\nScript does not support your architecture, sorry.\n";
        printf "\nCurrently we support: \n\n";
        foreach(@SUPPORTED_ARCHITECTURES) {
@@ -313,6 +313,7 @@  sub get_page_offset
        }
 
        foreach my $config_file (@config_files) {
+               $config_file =~ s/\R*//g;
                $page_offset = parse_kernel_config_file($config_file);
                if ($page_offset ne "") {
                        return $page_offset;