mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ankit Jindal <ajindal@apm.com>
Cc: linux-kernel@vger.kernel.org, "Hans J. Koch" <hjk@hansjkoch.de>,
	Pranavkumar Sawargaonkar <psawargaonkar@apm.com>,
	Jitendra Kanitkar <jkanitkar@apm.com>,
	Tushar Jagad <tjagad@apm.com>
Subject: Re: Unmapping of UIO logical memory causing a trace
Date: Tue, 11 Aug 2015 14:45:45 -0700	[thread overview]
Message-ID: <20150811214545.GA1457@kroah.com> (raw)
In-Reply-To: <CAJC5FUVt-QxOGv-sgrfAQtGmw=J1+vXQfsMtrRHfXt-j0YtFqg@mail.gmail.com>

On Tue, Aug 11, 2015 at 04:39:08PM +0530, Ankit Jindal wrote:
> Hi,
> 
> We have observed an issue where kmalloc of a small sized memory causes
> an occasional trace when unmapping the mmaped memory via UIO framework
> This trace is coming when kernel sees a negative value in
> page->_mapcount. Trace is pasted at the end of the mail.
> 
> After debugging this issue further, we realized following sequence
> occurs when kmalloc is used to allocate small memory using slub
> allocator:
> 1. Frozen bit (msb) of the page from which memory has been allocated
> is set (which is an union with _mapcount).
> 2. If there are free objects in the the same page then this frozen bit
> remains set even after kernel boots completely.
> 3. When user space calls unmap of this memory, vma_unmap_single()
> treats the _mapcount as a negative (as frozen bit is set), causing a
> trace.
> 
> We are not sure whether exposing kernel memory of size
> less than PAGE_SIZE via UIO is a valid use case ? In case this is an invalid
> use case then shouldn't the UIO framework restrict mapping of non
> PAGE_SIZE aligned memory and size not in order of PAGE_SIZE.

We've had a few discussions about this in the past, and one proposed
patch which had to be reverted because it broke some working systems, so
it's a messy thing.

What UIO driver are you using that causes this behavior?

thanks,

greg k-h

  reply	other threads:[~2015-08-11 21:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 11:09 Ankit Jindal
2015-08-11 21:45 ` Greg Kroah-Hartman [this message]
2015-08-12  7:55   ` Ankit Jindal
2015-08-12 17:11     ` Greg Kroah-Hartman
2015-08-19  9:55       ` Ankit Jindal
2015-08-19 14:07         ` Greg Kroah-Hartman

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=20150811214545.GA1457@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=ajindal@apm.com \
    --cc=hjk@hansjkoch.de \
    --cc=jkanitkar@apm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=psawargaonkar@apm.com \
    --cc=tjagad@apm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome