Probe an bigger linear available address to attachment.
PATCH 1/1 Probe an bigger linear available address to attachment.
Hi
When running shmat01 on some platforms, it fails on
"addr = shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);"
with a INVAL error. Look at codes in "setup()", it probes
an available address and align the address to SHMLBA. After
alignment, the new address is no guarantee to be available
any more. Here a bigger size is used to probe so that it's
still valid address after alignment.Pertaining to the function setup_tc(lc, &tc) ,when it outside of "for (i = 0; i < TST_TOTAL; i++)",and printf the tc.offset value is always 0,add correct a mistake of original codes to move "setup_tc()" to right place.
wei yang
BR
From 22b24a3d16a751f6512a7691abc46f9d744c091a Mon Sep 17 00:00:00 2001
From: Yang Wei <[email protected]>
Date: Tue, 31 Aug 2010 18:02:16 +0800
Subject: [PATCH] Probe an bigger linear available address to attachment.
When running shmat01 on some platforms, it fails on "addr = shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a EINVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.And correct a mistake of original codes to move "setup_tc()" to right place.
--- testcases/kernel/syscalls/ipc/shmat/shmat01.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/ipc/shmat/shmat01.c +12 -3
@@ -120,11 +120,12 @@ int main(int ac, char **av)/* reset Tst_count in case we are looping */ Tst_count =0 ; -/* setup test case paremeters */ -setup_tc (lc, &tc);/* loop through the test cases */ for (i =0 ; i <TST_TOTAL ; i++) { + +/* setup test case paremeters */ +setup_tc (i, &tc);/* * Use TEST macro to make the call
@@ -246,6 +247,8 @@ void check_functionality(int i)*/ void setup (void ) { +int shm_id_2; +/* capture signals */ tst_sig (NOFORK ,DEF_HANDLER , cleanup);
@@ -270,12 +273,18 @@ void setup(void) }/* Probe an available linear address for attachment */ -if ((base_addr =shmat (shm_id_1,NULL ,0 )) == (void *)-1 ) { +if ((shm_id_2 =shmget (shmkey++,SHMLBA +INT_SIZE ,SHM_RW |IPC_CREAT | +IPC_EXCL )) ==-1 ) { +tst_brkm (TBROK , cleanup,"Failed to create shared memory " +"resource 1 in setup()" ); + } +if ((base_addr =shmat (shm_id_2,NULL ,0 )) == (void *)-1 ) {tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); }if (shmdt ((const void *)base_addr) ==-1 ) {tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); } +rm_shm (shm_id_2);/* some architectures (e.g. parisc) are strange, so better always align to * next SHMLBA address. */
Signature · 1 line
1.6.0.4
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 Probe an bigger linear available address to attachment.
Hi
When running shmat01 on some platforms, it fails on
"addr = shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a INVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.Pertaining to the function setup_tc(lc, &tc) ,when it outside of "for (i = 0; i < TST_TOTAL; i++)",and printf the tc.offset value is always 0,add correct a mistake of original codes to move "setup_tc()" to right place.
wei yang
BR
From 22b24a3d16a751f6512a7691abc46f9d744c091a Mon Sep 17 00:00:00 2001
From: Yang Wei <[email protected]>
Date: Tue, 31 Aug 2010 18:02:16 +0800
Subject: [PATCH] Probe an bigger linear available address to attachment.
When running shmat01 on some platforms, it fails on "addr = shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a EINVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.And correct a mistake of original codes to move "setup_tc()" to right place.
--- testcases/kernel/syscalls/ipc/shmat/shmat01.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/ipc/shmat/shmat01.c +12 -3
@@ -120,11 +120,12 @@ int main(int ac, char **av)/* reset Tst_count in case we are looping */ Tst_count =0 ; -/* setup test case paremeters */ -setup_tc (lc, &tc);/* loop through the test cases */ for (i =0 ; i <TST_TOTAL ; i++) { + +/* setup test case paremeters */ +setup_tc (i, &tc);/* * Use TEST macro to make the call
@@ -246,6 +247,8 @@ void check_functionality(int i)*/ void setup (void ) { +int shm_id_2; +/* capture signals */ tst_sig (NOFORK ,DEF_HANDLER , cleanup);
@@ -270,12 +273,18 @@ void setup(void) }/* Probe an available linear address for attachment */ -if ((base_addr =shmat (shm_id_1,NULL ,0 )) == (void *)-1 ) { +if ((shm_id_2 =shmget (shmkey++,SHMLBA +INT_SIZE ,SHM_RW |IPC_CREAT | +IPC_EXCL )) ==-1 ) { +tst_brkm (TBROK , cleanup,"Failed to create shared memory " +"resource 1 in setup()" ); + } +if ((base_addr =shmat (shm_id_2,NULL ,0 )) == (void *)-1 ) {tst_brkm (TBROK , cleanup,"Couldn't attach shared memory" ); }if (shmdt ((const void *)base_addr) ==-1 ) {tst_brkm (TBROK , cleanup,"Couldn't detach shared memory" ); } +rm_shm (shm_id_2);/* some architectures (e.g. parisc) are strange, so better always align to * next SHMLBA address. */
Signature · 1 line
1.6.0.4
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
2010/8/31 Yang, Wei <[email protected]>:
Quoted 12 lines
Hi
When running shmat01 on some platforms, it fails on
"addr =shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a INVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.Pertaining to the functionsetup_tc(lc, &tc),when it outside of "for (i = 0; i <TST_TOTAL; i++)",and printf the tc.offset value is always 0,add correct a mistake of original codes to move "setup_tc()" to right place.
Which of the sub-testcases fail and on which architecture(s)? Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi
It failed on the first sub-testcase and on the mips architecture. Thanks
wei.yang
Quoted 14 lines · Garrett Cooper
2010/8/31 Yang, Wei <[email protected]>:
Quoted 12 lines
Hi
When running shmat01 on some platforms, it fails on
"addr =shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a INVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.Pertaining to the functionsetup_tc(lc, &tc),when it outside of "for (i = 0; i <TST_TOTAL; i++)",and printf the tc.offset value is always 0,add correct a mistake of original codes to move "setup_tc()" to right place.
Quoted 3 lines
Which of the sub-testcases fail and on which architecture(s)? Thanks,
-Garrett
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Garret, this patch ?
Regards--
Subrata
Quoted 23 lines · Wei
Hi
When running shmat01 on some platforms, it fails on
"addr =shmat(*(tc.shmid), base_addr + tc.offset,tc.flags);" with a INVAL error. Look at codes in "setup()", it probes an available address and align the address to SHMLBA. After alignment, the new address is no guarantee to be available any more. Here a bigger size is used to probe so that it's still valid address after alignment.Pertaining to the functionsetup_tc(lc, &tc),when it outside of "for (i = 0; i <TST_TOTAL; i++)",and printf the tc.offset value is always 0,add correct a mistake of original codes to move "setup_tc()" to right place.Signed-off-by Yang Wei <[email protected]>wei yang
BR
Quoted 7 lines
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list