All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang
@ 2012-02-21  5:43 Peng Haitao
  2012-02-21  5:50 ` Wanlong Gao
  2012-02-23 14:17 ` Cyril Hrubis
  0 siblings, 2 replies; 5+ messages in thread
From: Peng Haitao @ 2012-02-21  5:43 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: LTP List


commit d2e9f84 replace fprintf() with snprintf() in tst_print(), but this will
cause container_test.sh hang in case shmem_2nstest.

If compile tst_res.c without -O[level], the case will not hang.

When I test the following cases:
# ./shmem_2nstest none
shmem_2nstest    0  TINFO  :  Shared Memory namespace test : none
shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
shmem_2nstest    1  TPASS  :  Plain cloned process able to access shmem segment created
# ./shmem_2nstest unshare
shmem_2nstest    0  TINFO  :  Shared Memory namespace test : unshare
shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
shmem_2nstest    0  TINFO  :  Cont2: Able to allocate shmem seg with the same key
shmem_2nstest    1  TPASS  :  unshare : In namespace2 unable to access the shmem seg created in Namespace1
# ./shmem_2nstest clone
shmem_2nstest    0  TINFO  :  Shared Memory namespace test : clone

this will hang up.

So I think tst_resm("Cont1") will cause hang.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
 .../kernel/containers/sysvipc/shmem_2nstest.c      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/containers/sysvipc/shmem_2nstest.c b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
index 7a468ad..28e91ff 100644
--- a/testcases/kernel/containers/sysvipc/shmem_2nstest.c
+++ b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
@@ -69,8 +69,8 @@ int check_shmem1(void *vtest)
 	if (id1 == -1)
 		tst_brkm(TFAIL|TERRNO, NULL, "shmget failed");
 
-	tst_resm(TINFO, "Cont1: Able to create shared mem segment");
 	write(p1[1], "done", 5);
+	tst_resm(TINFO, "Cont1: Able to create shared mem segment");
 	tst_exit();
 }
 
-- 
1.7.1

-- 
Best Regards,
Peng


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang
  2012-02-21  5:43 [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang Peng Haitao
@ 2012-02-21  5:50 ` Wanlong Gao
  2012-02-23 14:17 ` Cyril Hrubis
  1 sibling, 0 replies; 5+ messages in thread
From: Wanlong Gao @ 2012-02-21  5:50 UTC (permalink / raw)
  To: Peng Haitao; +Cc: LTP List

On 02/21/2012 01:43 PM, Peng Haitao wrote:

> 
> commit d2e9f84 replace fprintf() with snprintf() in tst_print(), but this will
> cause container_test.sh hang in case shmem_2nstest.
> 
> If compile tst_res.c without -O[level], the case will not hang.
> 
> When I test the following cases:
> # ./shmem_2nstest none
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : none
> shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
> shmem_2nstest    1  TPASS  :  Plain cloned process able to access shmem segment created
> # ./shmem_2nstest unshare
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : unshare
> shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
> shmem_2nstest    0  TINFO  :  Cont2: Able to allocate shmem seg with the same key
> shmem_2nstest    1  TPASS  :  unshare : In namespace2 unable to access the shmem seg created in Namespace1
> # ./shmem_2nstest clone
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : clone
> 
> this will hang up.
> 
> So I think tst_resm("Cont1") will cause hang.


Tested OK to me. 

Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

> 
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
> ---
>  .../kernel/containers/sysvipc/shmem_2nstest.c      |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/kernel/containers/sysvipc/shmem_2nstest.c b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
> index 7a468ad..28e91ff 100644
> --- a/testcases/kernel/containers/sysvipc/shmem_2nstest.c
> +++ b/testcases/kernel/containers/sysvipc/shmem_2nstest.c
> @@ -69,8 +69,8 @@ int check_shmem1(void *vtest)
>  	if (id1 == -1)
>  		tst_brkm(TFAIL|TERRNO, NULL, "shmget failed");
>  
> -	tst_resm(TINFO, "Cont1: Able to create shared mem segment");
>  	write(p1[1], "done", 5);
> +	tst_resm(TINFO, "Cont1: Able to create shared mem segment");
>  	tst_exit();
>  }
>  



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang
  2012-02-21  5:43 [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang Peng Haitao
  2012-02-21  5:50 ` Wanlong Gao
@ 2012-02-23 14:17 ` Cyril Hrubis
  2012-02-23 14:59   ` Cyril Hrubis
  1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2012-02-23 14:17 UTC (permalink / raw)
  To: Peng Haitao; +Cc: LTP List

Hi!
> commit d2e9f84 replace fprintf() with snprintf() in tst_print(), but this will
> cause container_test.sh hang in case shmem_2nstest.
> 
> If compile tst_res.c without -O[level], the case will not hang.
> 
> When I test the following cases:
> # ./shmem_2nstest none
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : none
> shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
> shmem_2nstest    1  TPASS  :  Plain cloned process able to access shmem segment created
> # ./shmem_2nstest unshare
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : unshare
> shmem_2nstest    0  TINFO  :  Cont1: Able to create shared mem segment
> shmem_2nstest    0  TINFO  :  Cont2: Able to allocate shmem seg with the same key
> shmem_2nstest    1  TPASS  :  unshare : In namespace2 unable to access the shmem seg created in Namespace1
> # ./shmem_2nstest clone
> shmem_2nstest    0  TINFO  :  Shared Memory namespace test : clone
> 
> this will hang up.
> 
> So I think tst_resm("Cont1") will cause hang.

Looked in the code, the stack for cloned process is four pages in size
(see ltp_clone_quick()). And when the tst_resm() is called, the buffer
created on stack to store the message most likely overflows the stack
which results in hang in snprintf(). So I would rather remove this
tst_resm() entirely.

Anyway this is good catch, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang
  2012-02-23 14:17 ` Cyril Hrubis
@ 2012-02-23 14:59   ` Cyril Hrubis
  2012-02-23 16:51     ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2012-02-23 14:59 UTC (permalink / raw)
  To: Peng Haitao; +Cc: LTP List

Hi!
> Looked in the code, the stack for cloned process is four pages in size
> (see ltp_clone_quick()). And when the tst_resm() is called, the buffer
> created on stack to store the message most likely overflows the stack
> which results in hang in snprintf(). So I would rather remove this
> tst_resm() entirely.

Hmm, or we could add a page or two to the ltp_clone_quick(), which
should be quite safe...

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang
  2012-02-23 14:59   ` Cyril Hrubis
@ 2012-02-23 16:51     ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2012-02-23 16:51 UTC (permalink / raw)
  To: Peng Haitao; +Cc: LTP List

Hi!
> Hmm, or we could add a page or two to the ltp_clone_quick(), which
> should be quite safe...

I've commited a patch that increases the cloned process stack size from
four to six pages (which seems to be enough to work here). Please test
that this works also for you and if that change hasn't breaked anything
else.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2012-02-23 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21  5:43 [LTP] [PATCH v3 2/2] shmem_2nstest: fix a bug of hang Peng Haitao
2012-02-21  5:50 ` Wanlong Gao
2012-02-23 14:17 ` Cyril Hrubis
2012-02-23 14:59   ` Cyril Hrubis
2012-02-23 16:51     ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.