public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
@ 2012-12-05 11:49 Jan Stancek
  2012-12-05 11:53 ` Jan Stancek
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jan Stancek @ 2012-12-05 11:49 UTC (permalink / raw)
  To: ltp-list

This testcase crashed in about 1/200 of runs on s390x system with 2 CPUs:

Core was generated by `./7-1.run-test'.
Program terminated with signal 11, Segmentation fault.
  #0  _dl_fini () at dl-fini.c:228
  228               if (l->l_init_called)
  (gdb) bt
  #0  _dl_fini () at dl-fini.c:228
  #1  0x000003fffd345c62 in __run_exit_handlers (status=<optimized out>, listp=0x3fffd4b4a78 <__exit_funcs>,
      run_list_atexit=run_list_atexit@entry=true) at exit.c:77
  #2  0x000003fffd345ca4 in __GI_exit (status=<optimized out>) at exit.c:99
  #3  0x000003fffd3294e6 in __libc_start_main (main=0x80000b18 <main>, argc=<optimized out>, ubp_av=0x3ffff970108,
      init=<optimized out>, fini=0x80000d4c <__libc_csu_fini>, rtld_fini=0x3fffd50821c <_dl_fini>, stack_end=0x3ffff970050)
      at libc-start.c:257
  #4  0x0000000080000a26 in _start ()
  (gdb) x/1x l
  0x9fd4f2918:    Cannot access memory at address 0x9fd4f2918

The crash was presumably caused by race, where variable defined in main()
got out of scope before operation started by aio_read() completed.

Patched version succesfully made 100000 iterations.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 .../conformance/interfaces/aio_read/7-1.c          |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
index 2d13565..1227db4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
@@ -70,6 +70,9 @@ int main()
 		exit(PTS_FAIL);
 	}
 
+	while (aio_error(&aiocb) == EINPROGRESS)
+		;
+
 	close(fd);
 	printf("Test PASSED\n");
 	return PTS_PASS;
-- 
1.7.1


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
  2012-12-05 11:49 [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit Jan Stancek
@ 2012-12-05 11:53 ` Jan Stancek
  2012-12-05 13:01 ` Wanlong Gao
  2012-12-06  9:30 ` chrubis
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Stancek @ 2012-12-05 11:53 UTC (permalink / raw)
  To: ltp-list



----- Original Message -----
> From: "Jan Stancek" <jstancek@redhat.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Wednesday, 5 December, 2012 12:49:47 PM
> Subject: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at	exit

^^ Sorry, there's a typo in subject. "red" -> "read".

> 
> This testcase crashed in about 1/200 of runs on s390x system with 2
> CPUs:
> 
> Core was generated by `./7-1.run-test'.
> Program terminated with signal 11, Segmentation fault.
>   #0  _dl_fini () at dl-fini.c:228
>   228               if (l->l_init_called)
>   (gdb) bt
>   #0  _dl_fini () at dl-fini.c:228
>   #1  0x000003fffd345c62 in __run_exit_handlers (status=<optimized
>   out>, listp=0x3fffd4b4a78 <__exit_funcs>,
>       run_list_atexit=run_list_atexit@entry=true) at exit.c:77
>   #2  0x000003fffd345ca4 in __GI_exit (status=<optimized out>) at
>   exit.c:99
>   #3  0x000003fffd3294e6 in __libc_start_main (main=0x80000b18
>   <main>, argc=<optimized out>, ubp_av=0x3ffff970108,
>       init=<optimized out>, fini=0x80000d4c <__libc_csu_fini>,
>       rtld_fini=0x3fffd50821c <_dl_fini>, stack_end=0x3ffff970050)
>       at libc-start.c:257
>   #4  0x0000000080000a26 in _start ()
>   (gdb) x/1x l
>   0x9fd4f2918:    Cannot access memory at address 0x9fd4f2918
> 
> The crash was presumably caused by race, where variable defined in
> main()
> got out of scope before operation started by aio_read() completed.
> 
> Patched version succesfully made 100000 iterations.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  .../conformance/interfaces/aio_read/7-1.c          |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> index 2d13565..1227db4 100644
> ---
> a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> +++
> b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> @@ -70,6 +70,9 @@ int main()
>  		exit(PTS_FAIL);
>  	}
>  
> +	while (aio_error(&aiocb) == EINPROGRESS)
> +		;
> +
>  	close(fd);
>  	printf("Test PASSED\n");
>  	return PTS_PASS;
> --
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add
> services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
  2012-12-05 11:49 [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit Jan Stancek
  2012-12-05 11:53 ` Jan Stancek
@ 2012-12-05 13:01 ` Wanlong Gao
  2012-12-06  9:30 ` chrubis
  2 siblings, 0 replies; 6+ messages in thread
From: Wanlong Gao @ 2012-12-05 13:01 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

On 12/05/2012 07:49 PM, Jan Stancek wrote:
> This testcase crashed in about 1/200 of runs on s390x system with 2 CPUs:
> 
> Core was generated by `./7-1.run-test'.
> Program terminated with signal 11, Segmentation fault.
>   #0  _dl_fini () at dl-fini.c:228
>   228               if (l->l_init_called)
>   (gdb) bt
>   #0  _dl_fini () at dl-fini.c:228
>   #1  0x000003fffd345c62 in __run_exit_handlers (status=<optimized out>, listp=0x3fffd4b4a78 <__exit_funcs>,
>       run_list_atexit=run_list_atexit@entry=true) at exit.c:77
>   #2  0x000003fffd345ca4 in __GI_exit (status=<optimized out>) at exit.c:99
>   #3  0x000003fffd3294e6 in __libc_start_main (main=0x80000b18 <main>, argc=<optimized out>, ubp_av=0x3ffff970108,
>       init=<optimized out>, fini=0x80000d4c <__libc_csu_fini>, rtld_fini=0x3fffd50821c <_dl_fini>, stack_end=0x3ffff970050)
>       at libc-start.c:257
>   #4  0x0000000080000a26 in _start ()
>   (gdb) x/1x l
>   0x9fd4f2918:    Cannot access memory at address 0x9fd4f2918
> 
> The crash was presumably caused by race, where variable defined in main()
> got out of scope before operation started by aio_read() completed.
> 
> Patched version succesfully made 100000 iterations.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>

Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
  2012-12-05 11:49 [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit Jan Stancek
  2012-12-05 11:53 ` Jan Stancek
  2012-12-05 13:01 ` Wanlong Gao
@ 2012-12-06  9:30 ` chrubis
       [not found]   ` <50C06733.2000903@cn.fujitsu.com>
  2 siblings, 1 reply; 6+ messages in thread
From: chrubis @ 2012-12-06  9:30 UTC (permalink / raw)
  To: Jan Stancek; +Cc: ltp-list

Hi!
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  .../conformance/interfaces/aio_read/7-1.c          |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> index 2d13565..1227db4 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_read/7-1.c
> @@ -70,6 +70,9 @@ int main()
>  		exit(PTS_FAIL);
>  	}
>  
> +	while (aio_error(&aiocb) == EINPROGRESS)
> +		;
> +

That creates unnecessary bussy-loop here, I usually add reasonally small
usleep to such loop to avoid that. Something like usleep(10000) would
do.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
       [not found]   ` <50C06733.2000903@cn.fujitsu.com>
@ 2012-12-06 15:15     ` chrubis
       [not found]       ` <50C0B851.4050106@cn.fujitsu.com>
  0 siblings, 1 reply; 6+ messages in thread
From: chrubis @ 2012-12-06 15:15 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: ltp-list

Hi!
> >> +	while (aio_error(&aiocb) == EINPROGRESS)
> >> +		;
> >> +
> > 
> > That creates unnecessary bussy-loop here, I usually add reasonally small
> > usleep to such loop to avoid that. Something like usleep(10000) would
> > do.
> 
> Yeah, that's reasonable, so we have the same problem in almost all of the cases
> under aio_read/ and aio_*/

As usuall, do you care to send a patch or should I look into this issue?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit
       [not found]       ` <50C0B851.4050106@cn.fujitsu.com>
@ 2012-12-06 15:25         ` chrubis
  0 siblings, 0 replies; 6+ messages in thread
From: chrubis @ 2012-12-06 15:25 UTC (permalink / raw)
  To: Wanlong Gao; +Cc: ltp-list

Hi!
> >>> That creates unnecessary bussy-loop here, I usually add reasonally small
> >>> usleep to such loop to avoid that. Something like usleep(10000) would
> >>> do.
> >>
> >> Yeah, that's reasonable, so we have the same problem in almost all of the cases
> >> under aio_read/ and aio_*/
> > 
> > As usuall, do you care to send a patch or should I look into this issue?
> 
> Yeah, let me do it tomorrow morning carefully, I'm sleepy now. ;)

Sure thing ;).

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-06 15:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-05 11:49 [LTP] [PATCH] open_posix_testsuite/.../aio_red/7-1.c: fix race at exit Jan Stancek
2012-12-05 11:53 ` Jan Stancek
2012-12-05 13:01 ` Wanlong Gao
2012-12-06  9:30 ` chrubis
     [not found]   ` <50C06733.2000903@cn.fujitsu.com>
2012-12-06 15:15     ` chrubis
     [not found]       ` <50C0B851.4050106@cn.fujitsu.com>
2012-12-06 15:25         ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox