From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753388AbdLDEz2 (ORCPT ); Sun, 3 Dec 2017 23:55:28 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40101 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753370AbdLDEz0 (ORCPT ); Sun, 3 Dec 2017 23:55:26 -0500 X-ME-Sender: Date: Mon, 4 Dec 2017 15:55:22 +1100 From: "Tobin C. Harding" To: kaiwan.billimoria@gmail.com Cc: Alexander Kapshuk , linux-kernel , kernel-hardening@lists.openwall.com Subject: Re: [PATCH] leaking_addresses: add support for 32-bit kernel addresses Message-ID: <20171204045522.GE27780@eros> References: <1511850724-2381-1-git-send-email-me@tobin.cc> <20171128211003.GY17858@eros> <20171129101640.GC6217@eros> <20171129204812.GE6217@eros> <1512133747.17323.3.camel@gmail.com> <20171204001106.GB27780@eros> <1512362481.17323.9.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512362481.17323.9.camel@gmail.com> X-Mailer: Mutt 1.5.24 (2015-08-30) User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 4 Dec 2017 15:55:22 +1100 From: "Tobin C. Harding" Message-ID: <20171204045522.GE27780@eros> References: <1511850724-2381-1-git-send-email-me@tobin.cc> <20171128211003.GY17858@eros> <20171129101640.GC6217@eros> <20171129204812.GE6217@eros> <1512133747.17323.3.camel@gmail.com> <20171204001106.GB27780@eros> <1512362481.17323.9.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512362481.17323.9.camel@gmail.com> Subject: [kernel-hardening] Re: [PATCH] leaking_addresses: add support for 32-bit kernel addresses To: kaiwan.billimoria@gmail.com Cc: Alexander Kapshuk , linux-kernel , kernel-hardening@lists.openwall.com List-ID: 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.