* PROBLEM:a bug about pi-futex maybe let the program going to hang
@ 2011-03-26 4:19 scxby
2011-03-28 17:16 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: scxby @ 2011-03-26 4:19 UTC (permalink / raw)
To: linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 1381 bytes --]
hi, all.
Maybe, there is a bug about pi-futex, it would let the program in user-space going to hang.
We have a board: CPU is powerpc 8572, two core. after ran one month, the state of pi-futex in user-space got bad: mutex->__data.__lock is 0x8000023e, mutex->__data.__count is 0, mutex->__data.__owner is 0.
then, I review file "kernel/funtex.c"(the version is linux 2.6.38), found a case:
if there are 3 thread, named threadA, threadB, threadC¡£thread A hold mutexM, threadB and threadC is waiting mutexM. They run as fllow steps:
1. threadB and threadC sleep at line 1984.
2. threadB receive a signal, then it will be wake up.
3. threadA unlock mutexM, and give mutexM to threadB.
4. threadB call fixup_owner, try to give mutex to threadC.
5. at line 1580, threadB trigger a addr-fault, then goto handle_fault.
6. at line 1617, threadB release spinlock, then handle fault.
7. threadC got spinlock, and call fixup_owner, and got mutexM.
8. threadC give mutexM to threadB.
9. threadB re-got spinlock, it will found "pi_state->owner == oldowner" and retry to fixup.
10. threadB give mutexM to threadC, that's a bad thing.
we have wrote a program, this program can prove all above.ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PROBLEM:a bug about pi-futex maybe let the program going to hang
2011-03-26 4:19 PROBLEM:a bug about pi-futex maybe let the program going to hang scxby
@ 2011-03-28 17:16 ` Steven Rostedt
0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2011-03-28 17:16 UTC (permalink / raw)
To: scxby; +Cc: linux-kernel, Darren Hart, Peter Zijlstra, Thomas Gleixner
Thanks for the report, I added Cc to people that may be able to help.
-- Steve
On Sat, Mar 26, 2011 at 12:19:03PM +0800, scxby wrote:
> hi, all.
>
> Maybe, there is a bug about pi-futex, it would let the program in user-space going to hang.
>
> We have a board: CPU is powerpc 8572, two core. after ran one month, the state of pi-futex in user-space got bad: mutex->__data.__lock is 0x8000023e, mutex->__data.__count is 0, mutex->__data.__owner is 0.
>
> then, I review file "kernel/funtex.c"(the version is linux 2.6.38), found a case:
>
> if there are 3 thread, named threadA, threadB, threadC??thread A hold mutexM, threadB and threadC is waiting mutexM. They run as fllow steps:
>
> 1. threadB and threadC sleep at line 1984.
> 2. threadB receive a signal, then it will be wake up.
> 3. threadA unlock mutexM, and give mutexM to threadB.
> 4. threadB call fixup_owner, try to give mutex to threadC.
> 5. at line 1580, threadB trigger a addr-fault, then goto handle_fault.
> 6. at line 1617, threadB release spinlock, then handle fault.
> 7. threadC got spinlock, and call fixup_owner, and got mutexM.
> 8. threadC give mutexM to threadB.
> 9. threadB re-got spinlock, it will found "pi_state->owner == oldowner" and retry to fixup.
> 10. threadB give mutexM to threadC, that's a bad thing.
>
> we have wrote a program, this program can prove all above
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PROBLEM:a bug about pi-futex maybe let the program going to hang
2011-03-28 8:26 ` Peter Zijlstra
@ 2011-03-28 22:13 ` Darren Hart
0 siblings, 0 replies; 5+ messages in thread
From: Darren Hart @ 2011-03-28 22:13 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: xby, linux-kernel, xie.baoyou172958, Thomas Gleixner
On 03/28/2011 01:26 AM, Peter Zijlstra wrote:
> On Mon, 2011-03-28 at 15:25 +0800, xby wrote:
>> hi, all.
>
> Works better if you also CC people who actually work on that code.
>
>> Maybe, there is a bug about pi-futex, it would let the program in user-space going to hang.
>>
>> We have a board: CPU is powerpc 8572, two core. after ran one month, the state of pi-futex in user-space got bad: mutex->__data.__lock is 0x8000023e, mutex->__data.__count is 0, mutex->__data.__owner is 0.
>>
>> then, I review file "kernel/funtex.c"(the version is linux 2.6.38), found a case:
>>
>> if there are 3 thread, named threadA, threadB, threadC。thread A hold mutexM, threadB and threadC is waiting mutexM. They run as fllow steps:
>>
>> 1. threadB and threadC sleep at line 1984.
>> 2. threadB receive a signal, then it will be wake up.
>> 3. threadA unlock mutexM, and give mutexM to threadB.
>> 4. threadB call fixup_owner, try to give mutex to threadC.
>> 5. at line 1580, threadB trigger a addr-fault, then goto handle_fault.
>> 6. at line 1617, threadB release spinlock, then handle fault.
>> 7. threadC got spinlock, and call fixup_owner, and got mutexM.
>> 8. threadC give mutexM to threadB.
>> 9. threadB re-got spinlock, it will found "pi_state->owner == oldowner" and retry to fixup.
>> 10. threadB give mutexM to threadC, that's a bad thing.
>>
>> we have wrote a program, this program can prove all above.
>
> It would have been ever so much more useful if you'd have included that.
Please reply with the testcase and your glibc version please. If this is
a custom kernel, please make your .config as well.
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PROBLEM:a bug about pi-futex maybe let the program going to hang
2011-03-28 7:25 xby
@ 2011-03-28 8:26 ` Peter Zijlstra
2011-03-28 22:13 ` Darren Hart
0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2011-03-28 8:26 UTC (permalink / raw)
To: xby; +Cc: linux-kernel, xie.baoyou172958, Thomas Gleixner, Darren Hart
On Mon, 2011-03-28 at 15:25 +0800, xby wrote:
> hi, all.
Works better if you also CC people who actually work on that code.
> Maybe, there is a bug about pi-futex, it would let the program in user-space going to hang.
>
> We have a board: CPU is powerpc 8572, two core. after ran one month, the state of pi-futex in user-space got bad: mutex->__data.__lock is 0x8000023e, mutex->__data.__count is 0, mutex->__data.__owner is 0.
>
> then, I review file "kernel/funtex.c"(the version is linux 2.6.38), found a case:
>
> if there are 3 thread, named threadA, threadB, threadC。thread A hold mutexM, threadB and threadC is waiting mutexM. They run as fllow steps:
>
> 1. threadB and threadC sleep at line 1984.
> 2. threadB receive a signal, then it will be wake up.
> 3. threadA unlock mutexM, and give mutexM to threadB.
> 4. threadB call fixup_owner, try to give mutex to threadC.
> 5. at line 1580, threadB trigger a addr-fault, then goto handle_fault.
> 6. at line 1617, threadB release spinlock, then handle fault.
> 7. threadC got spinlock, and call fixup_owner, and got mutexM.
> 8. threadC give mutexM to threadB.
> 9. threadB re-got spinlock, it will found "pi_state->owner == oldowner" and retry to fixup.
> 10. threadB give mutexM to threadC, that's a bad thing.
>
> we have wrote a program, this program can prove all above.
It would have been ever so much more useful if you'd have included that.
^ permalink raw reply [flat|nested] 5+ messages in thread
* PROBLEM:a bug about pi-futex maybe let the program going to hang
@ 2011-03-28 7:25 xby
2011-03-28 8:26 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: xby @ 2011-03-28 7:25 UTC (permalink / raw)
To: linux-kernel; +Cc: xie.baoyou172958
hi, all.
Maybe, there is a bug about pi-futex, it would let the program in user-space going to hang.
We have a board: CPU is powerpc 8572, two core. after ran one month, the state of pi-futex in user-space got bad: mutex->__data.__lock is 0x8000023e, mutex->__data.__count is 0, mutex->__data.__owner is 0.
then, I review file "kernel/funtex.c"(the version is linux 2.6.38), found a case:
if there are 3 thread, named threadA, threadB, threadC。thread A hold mutexM, threadB and threadC is waiting mutexM. They run as fllow steps:
1. threadB and threadC sleep at line 1984.
2. threadB receive a signal, then it will be wake up.
3. threadA unlock mutexM, and give mutexM to threadB.
4. threadB call fixup_owner, try to give mutex to threadC.
5. at line 1580, threadB trigger a addr-fault, then goto handle_fault.
6. at line 1617, threadB release spinlock, then handle fault.
7. threadC got spinlock, and call fixup_owner, and got mutexM.
8. threadC give mutexM to threadB.
9. threadB re-got spinlock, it will found "pi_state->owner == oldowner" and retry to fixup.
10. threadB give mutexM to threadC, that's a bad thing.
we have wrote a program, this program can prove all above.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-03-28 22:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-26 4:19 PROBLEM:a bug about pi-futex maybe let the program going to hang scxby
2011-03-28 17:16 ` Steven Rostedt
2011-03-28 7:25 xby
2011-03-28 8:26 ` Peter Zijlstra
2011-03-28 22:13 ` Darren Hart
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®