From patchwork Mon Dec 4 04:41:21 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: 10089609 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 3317160327 for ; Mon, 4 Dec 2017 04:41:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2461A28F59 for ; Mon, 4 Dec 2017 04:41:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 194AD28F68; Mon, 4 Dec 2017 04:41:43 +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 4D91E28F59 for ; Mon, 4 Dec 2017 04:41:41 +0000 (UTC) Received: (qmail 1496 invoked by uid 550); 4 Dec 2017 04:41:38 -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 1453 invoked from network); 4 Dec 2017 04:41:38 -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=V0cxvntKtNogsP1218skK8sUmcPtDSxIxZ9Ym8KxX9w=; b=tjtFfs0mqdrHRVtrEyPtH/Aa5JBD6jnOpjW2sUuxZVmFZrdvPHR1od3pe/6fqHZlw8 ZFeW2WhtZgjNJPCXS+pEjWZiRYLOH8d5Buwm5zR08yBmtziNWLTc/uG357TXfI7jwm6b 4hJZdS0SlQZ3Is3bqegflXqmw+/njdK68fAfm6QsHbxzJcty2FULw/HrGWwC2HvmQbHT Eaf1bc6cONnxcbOkWXRPl2TBn+4nayojVCNo54FdSCzgfDCaMZqe62fbvp9bJ7OaS1EM wrMLdHLZpsGvPVDPMj2ueUrlwz3qxqPJAp5OK+LZlIZsSsM8xOWrIZPNZhWb45NW52PT Q0oQ== 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=V0cxvntKtNogsP1218skK8sUmcPtDSxIxZ9Ym8KxX9w=; b=JkHw4Deval16Yg4IBZZK7csGUMw+FKUc/EULNSU4VQsYX87RSSFfqU27uTf4ETc3ga j7KryMNC7etJLHDFa0/1gIxeSL3WNwlag5AvqVYQYoklMmOiVUnL1dtRxiAze6cZ9BmC /nfG2fq/1DB1hEdv3nHlvachBSFEUVjEv7LDjydOWNXdsJ0c3tYnmf1WqQpPDAtncLZk 5dDCuEYkR3w7ES01P5nkMMdA2oUzdpYxoVJeJ1khgFKrqFm6rCVUmY406zcNm6OmP1Wg iJUyls+y6pIn/3oyFHvLj3kz/rbZrP7W0/3oz2nWaz1hn95JsrEpwhe3dT90RoAkzpOh A3qw== X-Gm-Message-State: AJaThX5+pefF+Ej2fYWnE25kmziZ6y/1MlKawPkXVuL0g6A9l8KDlF4V mnNotRoRMKaivbM2EtTtiB0= X-Google-Smtp-Source: AGs4zMbhYfE9Kl/vWrrqOd5JhSZFvOgEAurX31ZTy7z+fRKa8+eVFtTV51yomzDwocWIcsI7ISLjHw== X-Received: by 10.98.198.142 with SMTP id x14mr18113817pfk.131.1512362485554; Sun, 03 Dec 2017 20:41:25 -0800 (PST) Message-ID: <1512362481.17323.9.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 10:11:21 +0530 In-Reply-To: <20171204001106.GB27780@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> 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 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. 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;