All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] drivers/kmem: disable on arm64
Date: Mon, 19 Jun 2017 16:03:23 +0100	[thread overview]
Message-ID: <20170619150323.GB9291@arm.com> (raw)
In-Reply-To: <1497883044-1276-1-git-send-email-ard.biesheuvel@linaro.org>

On Mon, Jun 19, 2017 at 04:37:24PM +0200, Ard Biesheuvel wrote:
> On arm64, the /dev/kmem driver barely works, given that it assumes that
> VMALLOC_START > PAGE_OFFSET, which is not the case on arm64. Due to the

Probably worth being explicit about the failure mode here (the commit
message you had in your RFC was much better ;).

Will

> dubious value of kmem on an architecture such as arm64, which is fairly
> new and is not as forgiving as other architectures when it comes to
> userland accesses to kernel memory using mismatched attributes*, let's
> disable it altogether if CONFIG_ARM64=y.
> 
> * Mappings in the vmalloc region will be accessed using vread/vwrite when
>   reading/writing to/from /dev/kmem, which will perform these accesses by
>   kmap()'ing each page using writeback cacheable attributes. This will be
>   correct in most cases, but this is not guaranteed.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/char/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index 31adbebf812e..8102ee7b3247 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -17,6 +17,8 @@ config DEVMEM
>  
>  config DEVKMEM
>  	bool "/dev/kmem virtual device support"
> +	# On arm64, VMALLOC_START < PAGE_OFFSET, which confuses kmem read/write
> +	depends on !ARM64
>  	help
>  	  Say Y here if you want to support the /dev/kmem device. The
>  	  /dev/kmem device is rarely used, but can be used for certain
> -- 
> 2.7.4
> 

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, arnd@arndb.de,
	mark.rutland@arm.com, gregkh@linuxfoundation.org
Subject: Re: [PATCH v2] drivers/kmem: disable on arm64
Date: Mon, 19 Jun 2017 16:03:23 +0100	[thread overview]
Message-ID: <20170619150323.GB9291@arm.com> (raw)
In-Reply-To: <1497883044-1276-1-git-send-email-ard.biesheuvel@linaro.org>

On Mon, Jun 19, 2017 at 04:37:24PM +0200, Ard Biesheuvel wrote:
> On arm64, the /dev/kmem driver barely works, given that it assumes that
> VMALLOC_START > PAGE_OFFSET, which is not the case on arm64. Due to the

Probably worth being explicit about the failure mode here (the commit
message you had in your RFC was much better ;).

Will

> dubious value of kmem on an architecture such as arm64, which is fairly
> new and is not as forgiving as other architectures when it comes to
> userland accesses to kernel memory using mismatched attributes*, let's
> disable it altogether if CONFIG_ARM64=y.
> 
> * Mappings in the vmalloc region will be accessed using vread/vwrite when
>   reading/writing to/from /dev/kmem, which will perform these accesses by
>   kmap()'ing each page using writeback cacheable attributes. This will be
>   correct in most cases, but this is not guaranteed.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  drivers/char/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index 31adbebf812e..8102ee7b3247 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -17,6 +17,8 @@ config DEVMEM
>  
>  config DEVKMEM
>  	bool "/dev/kmem virtual device support"
> +	# On arm64, VMALLOC_START < PAGE_OFFSET, which confuses kmem read/write
> +	depends on !ARM64
>  	help
>  	  Say Y here if you want to support the /dev/kmem device. The
>  	  /dev/kmem device is rarely used, but can be used for certain
> -- 
> 2.7.4
> 

  reply	other threads:[~2017-06-19 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 14:37 [PATCH v2] drivers/kmem: disable on arm64 Ard Biesheuvel
2017-06-19 14:37 ` Ard Biesheuvel
2017-06-19 15:03 ` Will Deacon [this message]
2017-06-19 15:03   ` Will Deacon
2017-06-20  6:48   ` Ard Biesheuvel
2017-06-20  6:48     ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170619150323.GB9291@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.