linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sasha.levin@oracle.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, mpm@selenic.com,
	cpw@sgi.com, kosaki.motohiro@jp.fujitsu.com, hannes@cmpxchg.org,
	kamezawa.hiroyu@jp.fujitsu.com, mhocko@suse.cz,
	aneesh.kumar@linux.vnet.ibm.com, xemul@parallels.com,
	riel@redhat.com, kirill.shutemov@linux.intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/11] pagewalk: update page table walker core
Date: Fri, 21 Feb 2014 11:50:29 -0500	[thread overview]
Message-ID: <530783D5.3060806@oracle.com> (raw)
In-Reply-To: <1393000553-ocl81482@n-horiguchi@ah.jp.nec.com>

[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]

On 02/21/2014 11:35 AM, Naoya Horiguchi wrote:
> On Fri, Feb 21, 2014 at 01:43:20AM -0500, Sasha Levin wrote:
>> On 02/20/2014 10:20 PM, Naoya Horiguchi wrote:
>>> Hi Sasha,
>>>
>>> On Thu, Feb 20, 2014 at 06:47:56PM -0500, Sasha Levin wrote:
>>>> Hi Naoya,
>>>>
>>>> This patch seems to trigger a NULL ptr deref here. I didn't have a change to look into it yet
>>>> but here's the spew:
>>>
>>> Thanks for reporting.
>>> I'm not sure what caused this bug from the kernel message. But in my guessing,
>>> it seems that the NULL pointer is deep inside lockdep routine __lock_acquire(),
>>> so if we find out which pointer was NULL, it might be useful to bisect which
>>> the proble is (page table walker or lockdep, or both.)
>>
>> This actually points to walk_pte_range() trying to lock a NULL spinlock. It happens when we call
>> pte_offset_map_lock() and get a NULL ptl out of pte_lockptr().
> 
> I don't think page->ptl was NULL, because if so we hit NULL pointer dereference
> outside __lock_acquire() (it's derefered in __raw_spin_lock()).
> Maybe page->ptl->lock_dep was NULL. I'll digging it more to find out how we failed
> to set this lock_dep thing.

I don't see __raw_spin_lock() derefing it before calling __lock_acquire():

	static inline void __raw_spin_lock(raw_spinlock_t *lock)
	{
		preempt_disable();
		spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
		LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
	}

So after we disable preemption, spin_acquire() is basically a macro that ends up pointing to
lock_acquire().

__raw_spin_lock() would dereference 'lock' only after the lockdep call.

>>> BTW, just from curiousity, in my build environment many of kernel functions
>>> are inlined, so should not be shown in kernel message. But in your report
>>> we can see the symbols like walk_pte_range() and __lock_acquire() which never
>>> appear in my kernel. How did you do it? I turned off CONFIG_OPTIMIZE_INLINING,
>>> but didn't make it.
>>
>> I'm really not sure. I've got a bunch of debug options enabled and it just seems to do the trick.
>>
>> Try CONFIG_READABLE_ASM maybe?
> 
> Hmm, it makes no change, can I have your config?

Sure, attached.


Thanks,
Sasha


[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39429 bytes --]

  parent reply	other threads:[~2014-02-21 16:50 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 21:44 [PATCH 00/11 v5] update page table walker Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 01/11] pagewalk: update page table walker core Naoya Horiguchi
2014-02-12  5:39   ` Joonsoo Kim
2014-02-12 15:40     ` Naoya Horiguchi
2014-02-20 23:47   ` Sasha Levin
2014-02-21  3:20     ` Naoya Horiguchi
2014-02-21  4:30     ` Sasha Levin
     [not found]     ` <5306c629.012ce50a.6c48.ffff9844SMTPIN_ADDED_BROKEN@mx.google.com>
2014-02-21  6:43       ` Sasha Levin
2014-02-21 16:35         ` Naoya Horiguchi
     [not found]         ` <1393000553-ocl81482@n-horiguchi@ah.jp.nec.com>
2014-02-21 16:50           ` Sasha Levin [this message]
2014-06-02 23:49   ` Dave Hansen
2014-06-03  0:29     ` Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 02/11] pagewalk: add walk_page_vma() Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 03/11] smaps: redefine callback functions for page table walker Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 04/11] clear_refs: " Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 05/11] pagemap: " Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 06/11] numa_maps: " Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 07/11] memcg: " Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 08/11] madvise: " Naoya Horiguchi
2014-03-21  1:47   ` Sasha Levin
2014-03-21  2:43     ` [PATCH] madvise: fix locking in force_swapin_readahead() (Re: [PATCH 08/11] madvise: redefine callback functions for page table walker) Naoya Horiguchi
2014-03-21  5:16       ` Hugh Dickins
2014-03-21  6:22         ` Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 09/11] arch/powerpc/mm/subpage-prot.c: use walk_page_vma() instead of walk_page_range() Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 10/11] pagewalk: remove argument hmask from hugetlb_entry() Naoya Horiguchi
2014-02-10 21:44 ` [PATCH 11/11] mempolicy: apply page table walker on queue_pages_range() Naoya Horiguchi
2014-02-21  6:30   ` Sasha Levin
2014-02-21 16:58     ` Naoya Horiguchi
     [not found]     ` <530785b2.d55c8c0a.3868.ffffa4e1SMTPIN_ADDED_BROKEN@mx.google.com>
2014-02-21 17:18       ` Sasha Levin
2014-02-21 17:25         ` Naoya Horiguchi
     [not found]         ` <1393003512-qjyhnu0@n-horiguchi@ah.jp.nec.com>
2014-02-23 13:04           ` Sasha Levin
2014-02-23 18:59             ` Naoya Horiguchi
2014-02-10 22:42 ` [PATCH 00/11 v5] update page table walker Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2014-01-13 16:54 [PATCH 00/11 v4] " Naoya Horiguchi
2014-01-13 16:54 ` [PATCH 01/11] pagewalk: update page table walker core Naoya Horiguchi
2013-12-11 22:08 [PATCH 00/11 v3] update page table walker Naoya Horiguchi
2013-12-11 22:08 ` [PATCH 01/11] pagewalk: update page table walker core Naoya Horiguchi
2014-01-08 23:48   ` Andrew Morton
2014-01-09  4:35     ` Naoya Horiguchi
2013-10-30 21:44 [PATCH 00/11 v2] update page table walker Naoya Horiguchi
2013-10-30 21:44 ` [PATCH 01/11] pagewalk: update page table walker core Naoya Horiguchi
2013-11-01  6:23   ` Naoya Horiguchi
2013-10-14 17:36 [PATCH 0/11] update page table walker Naoya Horiguchi
2013-10-14 17:37 ` [PATCH 01/11] pagewalk: update page table walker core Naoya Horiguchi

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=530783D5.3060806@oracle.com \
    --to=sasha.levin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cpw@sgi.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mpm@selenic.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=xemul@parallels.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).