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

Tobin C. Harding
2017-12-04T04:55:28Z

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.