linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>, Jens Axboe <axboe@kernel.dk>
Subject: Re: mm: shmem: freeing mlocked page
Date: Tue, 18 Nov 2014 22:56:10 -0500	[thread overview]
Message-ID: <20141119035610.GA14468@redhat.com> (raw)
In-Reply-To: <546C1202.1020502@oracle.com>

On Tue, Nov 18, 2014 at 10:44:02PM -0500, Sasha Levin wrote:
 > On 11/18/2014 04:58 PM, Andrew Morton wrote:
 
 > >> [ 1027.012856] ? pipe_lock (fs/pipe.c:69)
 > >> [ 1027.013728] ? write_pipe_buf (fs/splice.c:1534)
 > >> [ 1027.014756] vmsplice_to_user (fs/splice.c:1574)
 > >> [ 1027.015725] ? rcu_read_lock_held (kernel/rcu/update.c:169)
 > >> [ 1027.016757] ? __fget_light (include/linux/fdtable.h:80 fs/file.c:684)
 > >> [ 1027.017782] SyS_vmsplice (fs/splice.c:1656 fs/splice.c:1639)
 > >> [ 1027.018863] tracesys_phase2 (arch/x86/kernel/entry_64.S:529)
 > > 
 > > So what happened here?  Userspace fed some mlocked memory into splice()
 > > and then, while splice() was running, userspace dropped its reference
 > > to the memory, leaving splice() with the last reference.  Yet somehow,
 > > that page was still marked as being mlocked.  I wouldn't expect the
 > > kernel to permit userspace to drop its reference to the memory without
 > > first clearing the mlocked state.
 > > 
 > > Is it possible to work out from trinity sources what the exact sequence
 > > was?  Which syscalls are being used, for example?
 > 
 > Trinity can't really log anything because attempts to log syscalls slow everything
 > down to a crawl to the point nothing reproduces.

If the machine is still alive after /proc/sys/kernel/tainted changes,
trinity will dump a trinity-post-mortem.log somewhere[*] that should
contain the last two syscalls each process did. (Even if logging
is disabled).

It's not perfect however, and knowing that we passed a pointer to
a syscall isn't always useful unless we also dump the data that pointer
pointed at.  It's a work in progress. I don't know if I'm going to
get time to improve it any time soon though.

	Dave

[*] wherever cwd happened to be when the main process exited.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-11-19  4:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07  4:27 mm: shmem: freeing mlocked page Sasha Levin
2014-11-14 14:39 ` Sasha Levin
2014-11-18 21:58   ` Andrew Morton
2014-11-19  3:44     ` Sasha Levin
2014-11-19  3:56       ` Dave Jones [this message]
2014-11-19  3:56       ` Andrew Morton
2014-11-19  4:12         ` Sasha Levin
2014-11-19 13:38     ` Vlastimil Babka
2014-12-10  2:15     ` Sasha Levin
2014-12-10  2:23       ` Sasha Levin

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=20141119035610.GA14468@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.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;
as well as URLs for NNTP newsgroup(s).