Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1274413

Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges
Date Fri, 20 Nov 2015 21:50:02 +0100
Message-ID <qx0N4-3MB-29@gated-at.bofh.it> (permalink)
References <qwXPc-1Rb-1@gated-at.bofh.it> <qx0k1-3Cd-17@gated-at.bofh.it> <qx0tH-3FK-1@gated-at.bofh.it>
X-Original-To Dan Williams <dan.j.williams@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=zh4X781/ooyi60UbDtnPrtuZ2GXS0uKcc/Z/eQ4jBq8=; b=d796f/TxuB5RlPblyaWrWrMJhMtB1/VK2HnWl8ezCME7pz/Zaa06/b6DZhf2JCuMSF 7i/0zEgRUGM+YeU1B6YdJmLx2uUu6IJ7xMV9oFN6ZB6d43cRA/2QsemG/eFeQOhohvw4 3upndnj2hP3vmNgOSDbTVj+XGMUY1B8jVArWTUOP6xf6F+2f81BDV4y7TBUXkTXznLdT +tB3CPWk9rDEMFthy/EgPjXrkobBp180dOI8ATiz1ExM0st08wDk83hqbPl/PROvtdgO Ic9x2JfCMDLv10QeSAWERbZ6G/IUoX3SRiPfhd0GCOdFyj41pqkujjQo1ppVtOJcxMUU qhFA==
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=zh4X781/ooyi60UbDtnPrtuZ2GXS0uKcc/Z/eQ4jBq8=; b=fhaHhzXgojsVa9ysYyCyLiMH74wlC5k2xsP9OxeGF7J0jD+lDeQ+T5vxjy581C6wv/ pUD37Ob7dyN3LbG6+uBGNk4M1QYbG4/3DomI7teO+BoxIypaO3zSce2KXECbsfwObCVU DZbz3vYs0/cqkcEcT3Euq+6g2/7VBocz7KjL4=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=zh4X781/ooyi60UbDtnPrtuZ2GXS0uKcc/Z/eQ4jBq8=; b=Hu0/92dbFgrN2DyZRXT1l8S4hkwF8UoRCqfp96jko907u2eetP7AiCfEiSJearyk1R A7ohcs5PR/r60ybUZZDwkFVN9APjNhnPjKkGW1dKFH3j4pd/Syn6ZIWKWRNci8pvUMd+ X5F2GLmNpnwh+Q6ft4b4tImYG6OzAqa+eRM19U+D/YGyUt9KHvKMhCymr7483ZQB1Evt 8dtPZixC76qPcCtPGN/aYQfa8WRCDOCM2edNEVJlcTh0+fmjdPWMPHvotxdV2bf7Evev mb6X3YLEdiJPLPPVJF+2XFb/mj1yaHpR7CQ2mTVIPiHFaRoYKNubP+mf7tqnnVwAuk2f DLoA==
X-Gm-Message-State ALoCoQl0+PNcCDFBEVeNNReT64JrgcwsLZeyJOg2t+wflX21R4AcJKV0bjGST6uDpchDkRP2n+2m
MIME-Version 1.0
X-Received by 10.50.107.3 with SMTP id gy3mr3595359igb.48.1448052302778; Fri, 20 Nov 2015 12:45:02 -0800 (PST)
X-Google-Sender-Auth bjh8LABz1jDMsAg72J7KxMnGY1I
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc Russell King - ARM Linux <linux@arm.linux.org.uk>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Catalin Marinas <catalin.marinas@arm.com>, linux-nvdimm <linux-nvdimm@ml01.01.org>, Heiko Carstens <heiko.carstens@de.ibm.com>, Will Deacon <will.deacon@arm.com>, Ingo Molnar <mingo@redhat.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, "H. Peter Anvin" <hpa@zytor.com>, Martin Schwidefsky <schwidefsky@de.ibm.com>, Thomas Gleixner <tglx@linutronix.de>, Andrew Morton <akpm@linux-foundation.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>
X-Original-Date Fri, 20 Nov 2015 12:45:02 -0800
X-Original-Message-ID <CAGXu5jJ_Q4LLoaw=MHBDQVH0QuOFDvzwK5hhVN94n4AHWhARZQ@mail.gmail.com>
X-Original-References <20151120173133.24259.97028.stgit@dwillia2-desk3.jf.intel.com> <20151120201207.GH8644@n2100.arm.linux.org.uk> <CAPcyv4hagUwc3AJuDHvBy+YR1Khv+5uUL0HZawO9R0r-EZLVHg@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1274413

Show key headers only | View raw


On Fri, Nov 20, 2015 at 12:26 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Fri, Nov 20, 2015 at 12:12 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Fri, Nov 20, 2015 at 09:31:33AM -0800, Dan Williams wrote:
>>> This effectively promotes IORESOURCE_BUSY to IORESOURCE_EXCLUSIVE
>>> semantics by default.  If userspace really believes it is safe to access
>>> the memory region it can also perform the extra step of disabling an
>>> active driver.  This protects device address ranges with read side
>>> effects and otherwise directs userspace to use the driver.
>>
>> I'm happy with this as long as we retain the option to disable this
>> new behaviour.
>>
>> The reason being, when developing a driver, it is _very_ useful to
>> be able to poke around in the device's (and system memory) address
>> spaces with tools like devmem2 to work out what's going on when
>> things go wrong.
>>
>> To put it another way, I think it's a good idea to disable access to
>> these regions on production systems, but for driver development, we
>> want to retain the ability to poke around in physical address space
>> in any way we so desire.
>>
>
> Sounds ok to me, but I do think it's a good idea to default it to the
> same value as STRICT_DEVMEM.  Perhaps:
>
> bool "Filter I/O access to /dev/mem" if EXPERT
> default STRICT_DEVMEM
>
> When this in do we even need IORESOURCE_EXCLUSIVE?  It's barely used.

Let's leave it for now to give us the debugging granularity Russell
mentioned. If it turns out it's never used, we can drop it in the
future.

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] restrict /dev/mem to idle io memory ranges Dan Williams <dan.j.williams@intel.com> - 2015-11-20 18:40 +0100
  Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Kees Cook <keescook@chromium.org> - 2015-11-20 21:10 +0100
  Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Arnd Bergmann <arnd@arndb.de> - 2015-11-20 21:10 +0100
  Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-20 21:20 +0100
    Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Dan Williams <dan.j.williams@intel.com> - 2015-11-20 21:30 +0100
      Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Kees Cook <keescook@chromium.org> - 2015-11-20 21:50 +0100
      Re: [RFC PATCH] restrict /dev/mem to idle io memory ranges Ingo Molnar <mingo@kernel.org> - 2015-11-23 10:40 +0100

csiph-web