From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by kanga.kvack.org (Postfix) with ESMTP id CAFD56B004A for ; Fri, 10 Jun 2011 01:22:26 -0400 (EDT) Received: by vws4 with SMTP id 4so2565919vws.14 for ; Thu, 09 Jun 2011 22:22:24 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20110610133021.2eaaf0da.kamezawa.hiroyu@jp.fujitsu.com> References: <20110609212956.GA2319@redhat.com> <20110610091355.2ce38798.kamezawa.hiroyu@jp.fujitsu.com> <20110610113311.409bb423.kamezawa.hiroyu@jp.fujitsu.com> <20110610121949.622e4629.kamezawa.hiroyu@jp.fujitsu.com> <20110610125551.385ea7ed.kamezawa.hiroyu@jp.fujitsu.com> <20110610133021.2eaaf0da.kamezawa.hiroyu@jp.fujitsu.com> Date: Fri, 10 Jun 2011 13:21:46 +0800 Message-ID: Subject: Re: [PATCH] [BUGFIX] update mm->owner even if no next owner. From: Xiaotian Feng Content-Type: multipart/alternative; boundary=20cf307f37b6fb030704a554befa Sender: owner-linux-mm@kvack.org List-ID: To: KAMEZAWA Hiroyuki Cc: Hugh Dickins , Ying Han , Dave Jones , Linux Kernel , "linux-mm@kvack.org" , Oleg Nesterov , "akpm@linux-foundation.org" --20cf307f37b6fb030704a554befa Content-Type: text/plain; charset=UTF-8 On Fri, Jun 10, 2011 at 12:30 PM, KAMEZAWA Hiroyuki < kamezawa.hiroyu@jp.fujitsu.com> wrote: > > I think this can be a fix. > maybe good to CC Oleg. == > From dff52fb35af0cf36486965d19ee79e04b59f1dc4 Mon Sep 17 00:00:00 2001 > From: KAMEZAWA Hiroyuki > Date: Fri, 10 Jun 2011 13:15:14 +0900 > Subject: [PATCH] [BUGFIX] update mm->owner even if no next owner. > > A panic is reported. > > > Call Trace: > > [] mem_cgroup_from_task+0x15/0x17 > > [] __mem_cgroup_try_charge+0x148/0x4b4 > > [] ? need_resched+0x23/0x2d > > [] ? preempt_schedule+0x46/0x4f > > [] mem_cgroup_charge_common+0x9a/0xce > > [] mem_cgroup_newpage_charge+0x5d/0x5f > > [] khugepaged+0x5da/0xfaf > > [] ? __init_waitqueue_head+0x4b/0x4b > > [] ? add_mm_counter.constprop.5+0x13/0x13 > > [] kthread+0xa8/0xb0 > > [] ? sub_preempt_count+0xa1/0xb4 > > [] kernel_thread_helper+0x4/0x10 > > [] ? retint_restore_args+0x13/0x13 > > [] ? __init_kthread_worker+0x5a/0x5a > > The code is. > > return container_of(task_subsys_state(p, mem_cgroup_subsys_id), > > struct mem_cgroup, css); > > > What happens here is accssing a freed task struct "p" from mm->owner. > So, it's doubtful that mm->owner points to freed task struct. > > But from the bug itself, it looks more likely kernel is hitting a freed p->cgroups, right? If p is already freed, the kernel will fault on 781cc62d: 8b 82 fc 08 00 00 mov 0x8fc(%edx),%eax Then you will not get a value of 6b6b6b87, right? --20cf307f37b6fb030704a554befa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Fri, Jun 10, 2011 at 12:30 PM, KAMEZA= WA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wr= ote:

I think this can be a fix.
maybe good to CC Oleg.=C2=A0
=3D=3D
>>From dff52fb35af0cf36486965d19ee79e04b59f1dc4 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Date: Fri, 10 Jun 2011 13:15:14 +0900
Subject: [PATCH] [BUGFIX] update mm->owner even if no next owner.

A panic is reported.

> Call Trace:
> =C2=A0[<ffffffff81139792>] mem_cgroup_from_task+0x15/0x17
> =C2=A0[<ffffffff8113a75a>] __mem_cgroup_try_charge+0x148/0x4b4 > =C2=A0[<ffffffff810493f3>] ? need_resched+0x23/0x2d
> =C2=A0[<ffffffff814cbf43>] ? preempt_schedule+0x46/0x4f
> =C2=A0[<ffffffff8113afe8>] mem_cgroup_charge_common+0x9a/0xce > =C2=A0[<ffffffff8113b6d1>] mem_cgroup_newpage_charge+0x5d/0x5f > =C2=A0[<ffffffff81134024>] khugepaged+0x5da/0xfaf
> =C2=A0[<ffffffff81078ea0>] ? __init_waitqueue_head+0x4b/0x4b
> =C2=A0[<ffffffff81133a4a>] ? add_mm_counter.constprop.5+0x13/0x1= 3
> =C2=A0[<ffffffff81078625>] kthread+0xa8/0xb0
> =C2=A0[<ffffffff814d13e8>] ? sub_preempt_count+0xa1/0xb4
> =C2=A0[<ffffffff814d5664>] kernel_thread_helper+0x4/0x10
> =C2=A0[<ffffffff814ce858>] ? retint_restore_args+0x13/0x13
> =C2=A0[<ffffffff8107857d>] ? __init_kthread_worker+0x5a/0x5a

The code is.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return container_of(task_subsys_state(p, m= em_cgroup_subsys_id),
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct mem_cgroup, css);


What happens here is accssing a freed task struct "p" from mm->= ;owner.
So, it's doubtful that mm->owner points to freed task struct.


But from the bug itself, it looks more= likely kernel is hitting a freed p->cgroups, right?
If p is a= lready freed, the kernel will fault on=C2=A0
781cc62d: 8b 82 fc 0= 8 00 00 =C2=A0 =C2=A0 =C2=A0 mov =C2=A0 =C2=A00x8fc(%edx),%eax

Then you will not get a value of 6b6b6b87, right?=
--20cf307f37b6fb030704a554befa-- -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org