From: Cheng Xu <chengxu@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
Paul Mckenney <paulmck@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: rt_rq runtime leakage bug fix
Date: Sat, 14 May 2011 13:48:27 +0800 [thread overview]
Message-ID: <4DCE17AB.4090002@linux.vnet.ibm.com> (raw)
In-Reply-To: <1305195150.2914.268.camel@laptop>
On 2011-5-12 18:12, Peter Zijlstra wrote:
>
> it would be nice to know why the , operator version
> doesn't work though, since that looks to be the more conventional way to
> write it.
>
I did some investigation, it looks that,
1 #define for_each_rt_rq(rt_rq, iter, rq) \
2 for (iter = list_entry_rcu(task_groups.next, typeof(*iter), list), \
3 rt_rq = iter->rt_rq[cpu_of(rq)]; &iter->list != &task_groups; \
4 iter = list_entry_rcu(iter->list.next, typeof(*iter), list), \
5 rt_rq = iter->rt_rq[cpu_of(rq)])
in for loop, when task_groups (as sentinel node of the doubly linked circular list) is reached after the final iteration, a fake iter (of struct task_group *) is calculated at line 4 via container_of(&task_groups, struct task_group, list). By "fake", as we know, it is just an address, with &iter->list == &task_groups, but not pointing to a true struct task_group object. Accessing other members of fake iter might be the cause of page fault.
In my JS22 blade, cpu_of(rq)=1 and fake iter->rt_rq happens to be 0x100000000, value of another global variable near task_groups. Kernel tries to take it plus 8 as address, to retrieve iter->rt_rq[1]. and then page fault happens at address 0x100000008.
prev parent reply other threads:[~2011-05-14 5:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 7:34 [PATCH] sched: rt_rq runtime leakage bug fix Cheng Xu
2011-05-11 9:21 ` Peter Zijlstra
2011-05-11 17:30 ` Cheng Xu
2011-05-12 10:12 ` Peter Zijlstra
2011-05-12 10:55 ` Cheng Xu
2011-05-12 11:27 ` Peter Zijlstra
2011-05-14 5:48 ` Cheng Xu [this message]
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=4DCE17AB.4090002@linux.vnet.ibm.com \
--to=chengxu@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.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