From: Subrata M. <su...@li...> - 2008-12-17 06:31:26
|
On Wed, 2008-12-10 at 23:15 +0100, Jiří Paleček wrote: > Per request of Mike Frysinger, I resend this patch. The patch itself is > the same, but the explanation is extended. Hope it's better this time. > > Hello, > > I'm sorry to say this, but some changes in the "Fix Warnings and Badness > v2" patch[1] from October actually create bugs in the ltp tests. I think > they should be reverted by applying the attached patch. > > The problems are of those types: > > 1) Calling > > pthread_create(&th, &newattr, (void *)&new_thread, (void > *)&newsockfd) > > is wrong if eg. newsockfd is a variable subsequently modified by the > parent thread, not protected by locking. This is because there is a data > race between the read in the new thread and the write in the parent > thread. Moreover, it is quite often meant to pass different values to more > threads in the ltp tests, which results in the different threads actually > sharing the variable, which leads to unpredictable results. > > 2) Calling > > pthread_exit((void *)&exit_val); > > is wrong if exit_val is a local or thread-local variable, incl. errno. > These variables cease to exist when the thread finishes, so subsequent > dereferencing & read in the joining thread would read nonexistent variable. > > I think they should be reverted, because the warning (conversion > pointer/integer) doesn't mean anything bad in this context (provided you > use the same type on both sides, eg. the calling thread and the created > thread) and other solutions just add unnecessary complexity. > > The patch goes a little further, while I was searching for related > problems, I've found one typo and changed the signatures of some thread > functions (they really should be (void* (*)(void*)), not (void* (*)(int))) > > I've discovered this when I debugged a deadlock in test_1_to_1_threads. > BTW, shouldn't the first (or last) thread in this test call t_recv instead > of t_send (see the relay function). > > Regards > Jiri Palecek Thanks. Regards-- Subrata > > [1] http://article.gmane.org/gmane.linux.ltp/5866 > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > Ltp-list mailing list > Ltp...@li... > https://lists.sourceforge.net/lists/listinfo/ltp-list |