mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kosaki.motohiro@gmail.com
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@google.com>,
	Dave Jones <davej@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	stable@vger.kernel.org, hughd@google.com,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Subject: [PATCH 0/6] mempolicy memory corruption fixlet
Date: Wed, 30 May 2012 05:02:03 -0400	[thread overview]
Message-ID: <1338368529-21784-1-git-send-email-kosaki.motohiro@gmail.com> (raw)

From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

Hi Linus and all

Sorry for the long long delay.

Maybe I've finished a code auditing of mempolicy.c. It was hard work, multiple
mistakes hided real issues. :-/

Yes, my code auditing is too slow as usual, I know. But probably a slow work is 
better than do nothing, maybe.

Sadly, I've found multiple long living bugs and almost patches in this area were
 committed with no review.  That's sad. Therefore, I'd like to maintain this area 
a while (hopefully short) until known breakage will be fixed or finding another
volunteer. The purpose is not developing new feature. It is preventing more
corruption until known issue is fixed. (Of course, if anyone want to take the role,
I'm really happy and drop patch 6/6.

Here are some bandaid fixing patch set for mempolicy. It may fix all known uservisible
corruptions. But, I know, we have a lot of remained work. Below are unfixed issues.
(because of, they are broken by design. I can't fix them w/o design change)

1) mpol mount option of tmpfs doesn't work correctly

When not using =static mount option modifier, a nodemask is affected cpuset restriction 
of *inode creation* thread and ignore page allocation thread.

2) cpuset rebinding doesn't work correctly if shmem are shared from multiple processes.

mbind(2) (and set_mempolicy(2)) stores pre-calculated mask, say, 
(mbind-mask & cpuset-mask & online-nodes-mask) into struct mempolicy.
and the mempolicy attaches vma and shmem regions. But, of course, 
cpuset-mask depend on a thread. Thus we can't calculate final node mask
on ahead.

3) mbind(2) doesn't work correctly if shmem are shared from multiple processes.

The same of (2). mbind(2) stores final nodemask, but another thread have another
final node mask. The calculation is incorrect.


So, I think we should reconsider about shared mempolicy completely. If my remember 
is correct, Hugh said he worry about this feature because nobody seems
to use and lots bug about 4 years ago. As usually he is, he is correct. now, I'm 
convinced nobody uses this feature. Current  all of my patches are trivial and 
we can easily reproduce kernel memory corruption. And it don't work proper 
functionality (see above todo list). Thus, I'd like to hear his opinion. if he 
still dislike shared mempolicy feature, I'm ok to remove it entirely instead of 
applying current bandaid patch set.

Thank you.


-----------------------------------------------
KOSAKI Motohiro (6):
  Revert "mm: mempolicy: Let vma_merge and vma_split handle
    vma->vm_policy linkages"
  mempolicy: Kill all mempolicy sharing
  mempolicy: fix a race in shared_policy_replace()
  mempolicy: fix refcount leak in mpol_set_shared_policy()
  mempolicy: fix a memory corruption by refcount imbalance in
    alloc_pages_vma()
  MAINTAINERS: Added MEMPOLICY entry

 MAINTAINERS    |    7 +++
 mm/mempolicy.c |  151 ++++++++++++++++++++++++++++++++++++++++----------------
 mm/shmem.c     |    9 ++--
 3 files changed, 120 insertions(+), 47 deletions(-)


             reply	other threads:[~2012-05-30  9:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  9:02 kosaki.motohiro [this message]
2012-05-30  9:02 ` [PATCH 1/6] Revert "mm: mempolicy: Let vma_merge and vma_split handle vma->vm_policy linkages" kosaki.motohiro
2012-05-30 19:17   ` Christoph Lameter
2012-05-30 19:39     ` KOSAKI Motohiro
2012-05-30 19:44       ` Christoph Lameter
2012-05-31  6:49     ` KOSAKI Motohiro
2012-05-30  9:02 ` [PATCH 2/6] mempolicy: Kill all mempolicy sharing kosaki.motohiro
2012-05-30 19:41   ` Christoph Lameter
2012-05-30 19:46     ` KOSAKI Motohiro
2012-05-30 19:48     ` Andi Kleen
2012-05-30 20:31   ` Andi Kleen
2012-05-30 20:58     ` KOSAKI Motohiro
2012-05-30  9:02 ` [PATCH 3/6] mempolicy: fix a race in shared_policy_replace() kosaki.motohiro
2012-05-30  9:02 ` [PATCH 4/6] mempolicy: fix refcount leak in mpol_set_shared_policy() kosaki.motohiro
2012-05-30  9:02 ` [PATCH 5/6] mempolicy: fix a memory corruption by refcount imbalance in alloc_pages_vma() kosaki.motohiro
2012-05-30 20:37   ` Andi Kleen
2012-05-30  9:02 ` [PATCH 6/6] MAINTAINERS: Added MEMPOLICY entry kosaki.motohiro
2012-05-30 19:27   ` Christoph Lameter
2012-05-30 18:26 ` [PATCH 0/6] mempolicy memory corruption fixlet Linus Torvalds
2012-05-30 18:34   ` Christoph Lameter
2012-05-30 18:46     ` Andi Kleen
2012-05-30 18:50       ` Christoph Lameter
2012-05-30 19:32         ` Andi Kleen
2012-05-30 19:42           ` Christoph Lameter
2012-05-30 19:52             ` Andi Kleen
2012-05-30 20:00               ` KOSAKI Motohiro
2012-05-30 21:22                 ` Ben Hutchings
2012-05-30 21:25                   ` KOSAKI Motohiro
2012-05-30 19:54             ` KOSAKI Motohiro
2012-05-30 20:10               ` Andi Kleen
2012-05-30 20:16                 ` KOSAKI Motohiro
2012-06-01  0:45                   ` david
2012-06-01 13:51                     ` Christoph Lameter
2012-06-01 19:31                       ` david
2012-06-01 19:37                         ` KOSAKI Motohiro
2012-06-05 19:02                           ` Linus Torvalds
2012-06-05 19:17                             ` Andrew Morton
2012-06-06 19:10                               ` KOSAKI Motohiro
2012-05-30 19:03     ` Linus Torvalds
2012-05-30 20:10   ` KOSAKI Motohiro

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=1338368529-21784-1-git-send-email-kosaki.motohiro@gmail.com \
    --to=kosaki.motohiro@gmail.com \
    --cc=akpm@google.com \
    --cc=cl@linux.com \
    --cc=davej@redhat.com \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®