Received: by 10.223.164.202 with SMTP id h10csp2899517wrb; Sun, 12 Nov 2017 21:47:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMa1YJ1kt22mqkhdPBnKrAG9sc5AWY8ails4IB5AIpxoTbg0lp37n5lQ5iuS8OKfFlKJt3ml X-Received: by 10.159.204.146 with SMTP id t18mr7710388plo.83.1510552048716; Sun, 12 Nov 2017 21:47:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510552048; cv=none; d=google.com; s=arc-20160816; b=doriBtQgcQhRZ7lg0MWz9S9gMRGGwHAckmge2D6MViOu0zYduPiM8xm5LzZTCdi4rk WD6wH39A6eVbK8dgFh+ggDL2OmWdPXKi6mJio/OoJ2cI6MoshkkJ5Rk7nqKa52tInxRv 9z6y3MJ9xOfjZzYA4JM43TYNrQiav6YP/VanNKuAAGmAamr3+0TSvo7h4SozGSZo7oRh 7GD8AOnyI+zlrJjsTLvzMLKYA0N+5wwRIpaWHXBSnSmphdeGlTmpHBiyXM2zxGaRmsdX bYlKdzpHkTLygBnOLQ48x3XTFtH/jutMiXQvoU0NtsjtxOOn7LXgCnguDbP2IIZrRdus By2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=mPgmMH5LnxqTY5KH4xGNcoBmMnzLTHQH7PXz88MzGAA=; b=RdvjnBr7e8dMkJiyomXV7y027tk4OoCTXEqkp27gn/RPd2gvUqEAzpzOVH6MNpJgce Ss5ieIhpyVS1m0jVl3OFCs1kDxkImB8cHTDNwk4iS3r3HPpQQC2nJAYkeGCUGU0DRA8X JB99gXLVAE0gQ18Z7ckfguKKHmkP5XBvi4WayXAeqkgPfOoFlb33iwA0ukX8OHnlUb7g 9mCHm3JIlHKOL8+19gBlz8Hquayxfk0eHb5FBvo664Xpg84nr+9ZJulqnUmtWubbl40G C0pnpqVnpeqxDsFNUHrp+8yOnRAxkLCaUpTORL/CFSR+9DSctMHfvdtuuBZkpWNxC66j g0DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a5fBNjxl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n25si1089902pgc.42.2017.11.12.21.47.15; Sun, 12 Nov 2017 21:47:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a5fBNjxl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751601AbdKMFqk (ORCPT + 88 others); Mon, 13 Nov 2017 00:46:40 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:47959 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbdKMFqi (ORCPT ); Mon, 13 Nov 2017 00:46:38 -0500 Received: by mail-io0-f194.google.com with SMTP id h70so19327627ioi.4; Sun, 12 Nov 2017 21:46:38 -0800 (PST) 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=mPgmMH5LnxqTY5KH4xGNcoBmMnzLTHQH7PXz88MzGAA=; b=a5fBNjxl1B4eeDEs6kyOdeslJvlsQlXlpSyzG/ki40d8jVAYdUmIIa3w6trbie8TEu SJX2lC7cOUOR/b7420y76E1DH/GzEcw/WAuC1CMxD3NEl83H7rCRgDbgYIkXURtCcoNM AFGwPrF4EH4eY0gkKNtD+TvLf3KYbvmZJsG3jaJq5/cmQcXjKkOjBktp0QZobJo5LDlu woA1mAzpricpdXIbmd/HREfnel6QeKR6MpkwZKCkZIWseE+MBHCk91xssGbQOigQLtnp GmyXGvGOF8NSgP2mYi0wUm27JEHRPeW5RiQtQHypyKg6wC2lreUmNpIWhhEWZ5AXXP2a a8dw== 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=mPgmMH5LnxqTY5KH4xGNcoBmMnzLTHQH7PXz88MzGAA=; b=huffv2rCMyrBCB4ZE7dBjeCpamXiS1A9ZwCHc9OiGciBYW6wNc6s3PRotYv0vjmWVg 5R0iDJGaPlUNZIUWZvwR0mYVkCT5OhLWMWDCWX1UgTAu8I4Ns0Vne8aKdLe8wCECgR70 f/wu0xyYRI9gO5N3ky5zHd725Ey35yVIcbModMXKSpSebu4PZClE/zaAdXtX5uQ45Zrd iyPyF58XMyAXaEMuIY1z8eIEwQAlLifbBKlzSkJMsoE9R0igjlKTrHKjSTQcofW1UVzZ rp0dQXImtPpoQ0KFPY0SxIoNWhbUsaTjaNEXPWT9HvgYbZ9qjhkZi+EVkDpi/sYhJUdN JURQ== X-Gm-Message-State: AJaThX5YmqTJW+FlKeMcufdYxm6cmKeK/WWE2vrNX9qDvk+95P7IiPik flbep+lUBUa+IhYDDAnJI/g= X-Received: by 10.107.1.198 with SMTP id 189mr2607401iob.249.1510551998000; Sun, 12 Nov 2017 21:46:38 -0800 (PST) Received: from klaptop ([49.207.61.12]) by smtp.gmail.com with ESMTPSA id i62sm7028428ioe.31.2017.11.12.21.46.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Nov 2017 21:46:37 -0800 (PST) Message-ID: <1510551988.30178.10.camel@gmail.com> Subject: Re: [kernel-hardening] [PATCH v4] scripts: add leaking_addresses.pl From: kaiwan.billimoria@gmail.com To: "Tobin C. Harding" Cc: kernel-hardening@lists.openwall.com, "Jason A. Donenfeld" , Theodore Ts'o , Linus Torvalds , Kees Cook , Paolo Bonzini , Tycho Andersen , "Roberts, William C" , Tejun Heo , Jordan Glover , Greg KH , Petr Mladek , Joe Perches , Ian Campbell , Sergey Senozhatsky , Catalin Marinas , Will Deacon , Steven Rostedt , Chris Fries , Dave Weinstein , Daniel Micay , Djalal Harouni , linux-kernel@vger.kernel.org, Network Development , David Miller Date: Mon, 13 Nov 2017 11:16:28 +0530 In-Reply-To: <20171112222119.GL19752@eros> References: <1510050731-32446-1-git-send-email-me@tobin.cc> <1510322194.19812.3.camel@gmail.com> <20171112222119.GL19752@eros> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2017-11-13 at 09:21 +1100, Tobin C. Harding wrote: > On Fri, Nov 10, 2017 at 07:26:34PM +0530, kaiwan.billimoria@gmail.com > wrote: > > On Tue, 2017-11-07 at 21:32 +1100, Tobin C. Harding wrote: > > > Currently we are leaking addresses from the kernel to user space. > > > This > > > script is an attempt to find some of those leakages. Script > > > parses > > > `dmesg` output and /proc and /sys files for hex strings that look > > > like > > > kernel addresses. > > > > > > Only works for 64 bit kernels, the reason being that kernel > > > addresses > > > on 64 bit kernels have 'ffff' as the leading bit pattern making > > > greping > > > possible. On 32 kernels we don't have this luxury. > > > > Tobin C. Harding wrote: > > > Only works for 64 bit kernels, the reason being that kernel > > > addresses > > > on 64 bit kernels have 'ffff' as the leading bit pattern making > > > greping > > > possible. On 32 kernels we don't have this luxury. > > > > [RFC] leaking_addresses.pl - enhance it to work for 32-bit kernels > > as well > > > > (Firstly, apologies if I've got the protocol horribly wrong- should > > this > > be a new thread altogether?) > > I think this patch will need to wait until the patch set that is > currently in flight is either merged or dropped. > Thanks for looking at it! Okay; blocking on merge || drop... :-) > > > We can work this out pragmatically, Perl can give us an architecture > string then a few regexs can ascertain which architecture we are > running > on. This is in the inflight patch set. > > > The patch below does Not take into account (yet) stuff like: > > - exactly which files & dirs should be skipped on 32-bit (will it > > be > > identical to 64-bit?; unsure..) > > As per discussion later in this thread we may need to consider > architecture specific lists for files/directories to skip. Right > > > - it currently hard-codes a global 'PAGE_OFFSET_32BIT=0xc0000000' > > , just > > so I can test quickly; must figure whether to query it or pass it; > > Suggestions? > > Perhaps we should have a command line option for this. > > --kernel-base-address Why not just detect it programatically? We could devise a series of fallbacks; something like: - if .config exists in the kernel source tree root, grep it for PAGE_OFFSET - if not, grep the arch-specific (arch//configs/) for the same - if for some reason we don't have enough info regarding specific platform and thus the defconfig filename (could happen for ARM, PPC?), we then fail and request the user to pass it as a parameter. > > - the 'false positives'; again, what differs for 32-bit? > > (BTW, shouldn't the dmesg 'root=UUID=<...>' line be a false > > positive > > & skipped?). > > We could probably do with architecture specific false > positives. Inflight patch set refactors false_positive() so adding to > this should be easy. Sure. > > > Also, I must point out that I'm a complete newbie to Perl :-) so, > > pl excuse > > my highly inadequate perl-foo; I rely on you perl gurus out there > > to fix > > and optimize :) > > I'm no Perl guru but following are a few tips I have picked up over > the > last month. Thanks, will fix the issues you point out.. > > > > Conceptually your ideas look good to me. If there is some reason this > approach won't work hopefully someone else will jump in and say so. > > Nice work, thanks for putting in effort to get 32 bit machines > supported. Let's see what happens with the inflight patch set then > work > on getting these ideas in. > Thanks! yes.. > thanks, > Tobin. From 1583927898559657468@xxx Mon Nov 13 05:35:55 +0000 2017 X-GM-THRID: 1583410491222242898 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread