From patchwork Mon Dec 4 10:20:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaiwan N Billimoria X-Patchwork-Id: 10089911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B8B4F60329 for ; Mon, 4 Dec 2017 10:21:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACFFC29115 for ; Mon, 4 Dec 2017 10:21:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB6172913C; Mon, 4 Dec 2017 10:21:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id EA50B29115 for ; Mon, 4 Dec 2017 10:21:01 +0000 (UTC) Received: (qmail 32074 invoked by uid 550); 4 Dec 2017 10:20:59 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 32037 invoked from network); 4 Dec 2017 10:20:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=+RHKJb/npvZ6gw7NpfbDYtwcPqOeX4lYg10JVsezPpQ=; b=b3uxIXnqzdukV5PlVet07MCTQPPFgVZHlUeFWUIvtr+yuDDWZgnfO74ax1M2J88Nzn 6486GSsRuX/LRGIM57YhGA95te2bbhsPYCVWwiA7SzCJQii5LxzxZgQxsd+WB3HHxJUZ PcO2ZThAJhadNgjZM1ubC1rYtiLdObCo7J/xVd/4lA0S139FsCOcrWacHxntci6BUN3U G7vviC+l9FUAQDd+EZEFvADSQio0bMG2MA1FJ6ZbmCMdH1Bikhme0OLBI9nLJzK4Gkd+ EOL8Zqj3p/Khl02EZXyv021qxTKHJvB7xL+JTCVO6ZjaSmVFSE1IAg88WjX49eS7jIfW Vtmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=+RHKJb/npvZ6gw7NpfbDYtwcPqOeX4lYg10JVsezPpQ=; b=brHnsmskALOhjeqWt4YrSLXrf7YI6eSujqJBFre4PBSGAmbXZFd8aXY+59W8aTvuUZ Ozbfv29bHUz0GK0e/xDGXT5ET8CWp5QNhYiOiJQ61QK3xSsWu4Hu9xMNpYrrf9t5FkH/ pAy48cKStgTdVbECwKibYSZGRpunnDbfes82ipMEsBgluWUoBBNpzwN+ory76Zz+W7Je UcgWSolk6+M7lxUtCDais16UlFNczaYA2+sMxayJLS7lMCbxITUySNj6QAMT6pfHbhFE +Q2qg5LOUSgOQpjaRdy4n+ppqPi3Mu+7DEQvTeeGjU3CSJ8FZJW3G/E8ZFy8LPcaN4Vn 4aBg== X-Gm-Message-State: AKGB3mJYK9Cn3/dnDXVjlCj+mRbx5zskkySQlnOa2nyPKUArxqjbDIJU ZIS8s3LCW2aRTzKVyy/a0OI= X-Google-Smtp-Source: AGs4zMYgpUVcEk2SX+NWQpULzyw5qfLoxZZWX95T58+4rR+QRoB60Kodtlf8zTaWBT9pYeg4xLJmew== X-Received: by 10.36.44.197 with SMTP id i188mr12759060iti.40.1512382846964; Mon, 04 Dec 2017 02:20:46 -0800 (PST) Message-ID: <1512382841.17323.11.camel@gmail.com> From: kaiwan.billimoria@gmail.com To: "Tobin C. Harding" Cc: Alexander Kapshuk , linux-kernel , kernel-hardening@lists.openwall.com Date: Mon, 04 Dec 2017 15:50:41 +0530 In-Reply-To: <20171204082111.GB21565@eros> References: <20171129101640.GC6217@eros> <20171129204812.GE6217@eros> <1512133747.17323.3.camel@gmail.com> <20171204001106.GB27780@eros> <1512362481.17323.9.camel@gmail.com> <20171204045522.GE27780@eros> <20171204082111.GB21565@eros> X-Mailer: Evolution 3.26.2 (3.26.2-1.fc27) Mime-Version: 1.0 Subject: [kernel-hardening] Re: [PATCH] leaking_addresses: add support for 32-bit kernel addresses X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 2017-12-04 at 19:21 +1100, Tobin C. Harding wrote: > On Mon, Dec 04, 2017 at 10:51:53AM +0530, Kaiwan N Billimoria wrote: > > > --- > > diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl > > index 9906dcf8b807..260b52e456f1 100755 > > --- a/scripts/leaking_addresses.pl > > +++ b/scripts/leaking_addresses.pl > > @@ -266,7 +266,7 @@ sub is_false_positive > > sub is_false_positive_ix86_32 > > { > > my ($match) = @_; > > - state $page_offset = eval get_page_offset(); # only gets called once > > + state $page_offset = hex get_page_offset(); # only gets called once > > I don't think this is valid ;) I meant use hex() to convert the string > to an int so it doesn't throw the warning (inside get_page_offset()). Yup, got it, thanks :-p Combined patch below: --- scripts/leaking_addresses.pl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl index 9906dcf8b807..a595a2c66b12 100755 --- a/scripts/leaking_addresses.pl +++ b/scripts/leaking_addresses.pl @@ -266,8 +266,7 @@ sub is_false_positive sub is_false_positive_ix86_32 { my ($match) = @_; - state $page_offset = eval get_page_offset(); # only gets called once - + state $page_offset = get_page_offset(); # only gets called once if ($match =~ '\b(0x)?(f|F){8}\b') { return 1; } @@ -283,7 +282,7 @@ sub is_false_positive_ix86_32 sub get_page_offset { my $page_offset; - my $default_offset = "0xc0000000"; + my $default_offset = hex("0xc0000000"); my @config_files; # Allow --page-offset-32bit to override. @@ -306,23 +305,23 @@ sub get_page_offset } else { $page_offset = parse_kernel_config_file($tmp_file); if ($page_offset ne "") { - return $page_offset; + return hex($page_offset); } } system("rm -f $tmp_file"); } foreach my $config_file (@config_files) { - $config_file =~ s/\R*//g; + chomp $config_file; $page_offset = parse_kernel_config_file($config_file); if ($page_offset ne "") { - return $page_offset; + return hex($page_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; + printf STDERR "Falling back to PAGE_OFFSET = 0x%x\n\n", $default_offset; return $default_offset; }