Received: by 10.223.164.202 with SMTP id h10csp2472192wrb; Sun, 12 Nov 2017 10:03:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMbvv3smUob0LJHBRyGWjn3mw/PRyafsuWsm+UcjVOhG33+sMxFfqLtt76sSWH8UTr8I2djX X-Received: by 10.98.156.210 with SMTP id u79mr7336627pfk.50.1510509830326; Sun, 12 Nov 2017 10:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510509830; cv=none; d=google.com; s=arc-20160816; b=M8Wb/CBG4BtHMjrpJ0RR7my6ZxzzQluI5PlvfD8BhbSrYFVScm/+wOYcUSIWZ6G/8y fn9KR+cSOZWrLRiHL2EubKRkoLxU4nJ47CKip97A69OgiB0qWB/o2Zr9qSeDEf9plEhm D0m0b5O78Iooez15rAbORphVVTiEHjbw622peTPUdkyxq0ljn3/Id/7Gt7lMG5rCgBxb 4oIP2aCg4TYABd7NQMA/QB8V1fPuTG4l5MLjN9K1C08cweQR9MRYOjw0X7stjFEHdHHY wMYGqDjtCfKnxf5x3i6E9C4NF2ZTct5xmz5lAZzdlymbdtXqWq7e42e6dzAFDn3T9EX9 OU1A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=3u0nRbXIDzRLa7ir8BNa5slZciMeP7/3DMkpqTTIr8k=; b=P0rUf+5yNrgzN0k8KK3DG3ag6b3r+bmvt+f2/4B3RCuKDsGggGZ5LPDcS4ZeMTh18N jIds889EX6RPuBmKyosZhQH9W2XeCOsUAA8GhJNVltcPZT3nRQzS8Q6rwEkv09gD6W19 e8bVR1gg1lMSDiEzSOaDVcOGvF3tjFMNrEL6SfgDFr0hJ0rG8fzIeWvd4mZ5LCRz6KVG OHn98uwld+w4fF/2wlpfasDZvQzRerOfDAzBNVkoWLw+JZAZ3OEBAhOW3QyUECCoAI1O SXbzfvQACOT5QrV9nj4lCXlU/skr/CHoHgRJtx2iY2erkdwVe6tG9+7yr0IIfHwCiXE/ mIZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QYd/UcGB; 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 y76si13868910pfd.136.2017.11.12.10.03.37; Sun, 12 Nov 2017 10:03:50 -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=QYd/UcGB; 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 S1751092AbdKLSDA (ORCPT + 87 others); Sun, 12 Nov 2017 13:03:00 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:49731 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbdKLSC6 (ORCPT ); Sun, 12 Nov 2017 13:02:58 -0500 Received: by mail-pf0-f194.google.com with SMTP id i5so10239312pfe.6; Sun, 12 Nov 2017 10:02:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3u0nRbXIDzRLa7ir8BNa5slZciMeP7/3DMkpqTTIr8k=; b=QYd/UcGBQ3aoviLPKbnRszBWnpPiZCkH6OP3m38zIP5jzfKKFyG/890IcI4vwwc/Fh dr4zR8d+lYPbVqMh+3XRdf/FEj17vmHxQLTFWgTHCnIuyUy0bh8HvLuRCVO0QGVbfLos QMXUpDSyA1Zw0bD1bZJ27CKntAzksq/RZOXtdfts+vmDis+/OB/a41n3yoXybncyO2D/ mRe0fhVldJwDc3P3sPf0qCF3SyqEf5CgbmXNtPx+Q0TqgwiAYF1agwP2TgyIIJtKdErO y1VYv54yjFjGX/v7RX+lHCohwa2V1LD0zsJkLE0GRct3ovJQDrVGfTBzOeVt5u1AEJQ6 sNgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3u0nRbXIDzRLa7ir8BNa5slZciMeP7/3DMkpqTTIr8k=; b=h66Mu83Ni2A0BKLWPgE4JY7tjwZyjg3XgD0rtcOEZTtHzAzdYzLKwwlO2ZBRL1J5qY EBASva53MH4PNA/1YkdqmchIKjV+m5M6bLyf29JE4VPUTx/90aaTOD/rP1+O+cNkknqf lRkV3cnw2m7DVVxaAc5YxSrliy3YiOc+8hOCfc6umVPSv2zbj7DhL4Um9JVsVe9g6Xyb WscWMYIyifuN0o3Ehq8oDNRktcnnKKm6/YCVJQcjCF+lkeInMd4DUZsVLVF+pLusGE4N 2h57AbochItdk5Kr21rddaWX0XyjLMFhMAgzd0U89RWdfjLxytpyZrv867fvuySEKc7c cLtQ== X-Gm-Message-State: AJaThX4FlPunaq9zBoLNIn3aCy5iT9oowxhAAmJiJjJdi+Xt4k66yyym OXWVkxJeu3HYub+1E2Fxans= X-Received: by 10.101.74.4 with SMTP id s4mr6264037pgq.259.1510509777814; Sun, 12 Nov 2017 10:02:57 -0800 (PST) Received: from [192.168.1.70] (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id u8sm22339589pgp.17.2017.11.12.10.02.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Nov 2017 10:02:57 -0800 (PST) Subject: Re: [kernel-hardening] [PATCH v4] scripts: add leaking_addresses.pl To: Michael Ellerman , "Tobin C. Harding" , kernel-hardening@lists.openwall.com Cc: "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 References: <1510050731-32446-1-git-send-email-me@tobin.cc> <87k1z12cof.fsf@concordia.ellerman.id.au> <7fa01b32-4db0-3742-067b-955969020953@gmail.com> <87o9o7wwbl.fsf@concordia.ellerman.id.au> From: Frank Rowand Message-ID: <67c090b8-926a-1637-c335-863c068e62d0@gmail.com> Date: Sun, 12 Nov 2017 10:02:55 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <87o9o7wwbl.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On 11/12/17 03:49, Michael Ellerman wrote: > Hi Frank, > > Frank Rowand writes: >> Hi Michael, Tobin, >> >> On 11/08/17 04:10, Michael Ellerman wrote: >>> "Tobin C. Harding" writes: >>>> 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. >>> >>> That doesn't work super well on other architectures :D >>> >>> I don't speak perl but presumably you can check the arch somehow and >>> customise the regex? >>> >>> ... >>>> +# Return _all_ non false positive addresses from $line. >>>> +sub extract_addresses >>>> +{ >>>> + my ($line) = @_; >>>> + my $address = '\b(0x)?ffff[[:xdigit:]]{12}\b'; >>> >>> On 64-bit powerpc (ppc64/ppc64le) we'd want: >>> >>> + my $address = '\b(0x)?[89abcdef]00[[:xdigit:]]{13}\b'; >>> >>> >>>> +# Do not parse these files (absolute path). >>>> +my @skip_parse_files_abs = ('/proc/kmsg', >>>> + '/proc/kcore', >>>> + '/proc/fs/ext4/sdb1/mb_groups', >>>> + '/proc/1/fd/3', >>>> + '/sys/kernel/debug/tracing/trace_pipe', >>>> + '/sys/kernel/security/apparmor/revision'); >>> >>> Can you add: >>> >>> /sys/firmware/devicetree >>> >>> and/or /proc/device-tree (which is a symlink to the above). >> >> /proc/device-tree is a symlink to /sys/firmware/devicetree/base > > Oh yep, forgot about the base part. > >> /sys/firmware contains >> fdt -- the flattened device tree that was passed to the >> kernel on boot >> devicetree/base/ -- the data that is currently in the live device tree. >> This live device tree is represented as directories >> and files beneath base/ >> >> The information in fdt is directly available in the kernel source tree > > On ARM that might be true, but not on powerpc. > > Remember FDT comes from DT which comes from OF - in which case the > information is definitely not in the kernel source! :) > > On our bare metal machines the device tree comes from skiboot > (firmware), with some of the content provided by hostboot (other > firmware), both of which are open source, so in theory most of the > information is available in *some* source tree. But there's still > information about runtime allocations etc. that is not available in the > source anywhere. Thanks for the additional information. Can you explain a little bit what "runtime allocations" are? Are you referring to the memory reservation block, the memory node(s) and the chosen node? Or other information? From 1583860928163241121@xxx Sun Nov 12 11:51:27 +0000 2017 X-GM-THRID: 1583410491222242898 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread