In x86_64 kernel, the valid value of u_info.entry_number is 12 to 14.
So when making with -m32 in x86_64 kernel, the value of u_info.entry_number
cannot be set to 6, should be set to 12.

Please refer to the following log.
# ./set_thread_area01
set_thread_area01    1  TFAIL  :  failed - errno = 22 : Invalid argument
# ./set_thread_area02
set_thread_area_02    1  TFAIL  :  call get_thread_area() failed: 
TEST_ERRNO=EINVAL(22): Invalid argument

Signed-off-by: Peng Haitao <[email protected]>
---
 .../syscalls/set_thread_area/set_thread_area01.c   |   11 ++++++++---
 .../syscalls/set_thread_area/set_thread_area02.c   |    8 +++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/set_thread_area/set_thread_area01.c 
b/testcases/kernel/syscalls/set_thread_area/set_thread_area01.c
index 3bda657..1c22c19 100644
--- a/testcases/kernel/syscalls/set_thread_area/set_thread_area01.c
+++ b/testcases/kernel/syscalls/set_thread_area/set_thread_area01.c
@@ -43,6 +43,7 @@
  *             Manas Kumar Nayak [email protected]>
  *****************************************************************************/
 
+#include <sys/utsname.h>
 #include "set_thread_area.h"
 
 /* Global Variables */
@@ -109,6 +110,7 @@ int main(int ac, char **av) {
        thread_area_s u_info;
        int lc;         /* loop counter */
        char *msg;      /* message returned from parse_opts */
+       struct utsname uval;
 
        /* parse standard options */
        if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
@@ -116,6 +118,7 @@ int main(int ac, char **av) {
                 tst_exit();
        }
 
+       uname(&uval);
        setup();
 
        for (lc = 0; TEST_LOOPING(lc); ++lc) {
@@ -123,8 +126,10 @@ int main(int ac, char **av) {
                Tst_count = 0;
 
                for (testno = 0; testno < TST_TOTAL; ++testno) {
-
-                       u_info.entry_number = 6;
+                       if (strcmp(uval.machine, "x86_64") == 0)
+                               u_info.entry_number = 12;
+                       else
+                               u_info.entry_number = 6;
 
                        /*
                         * This call to get_thread_area function should be
@@ -175,4 +180,4 @@ int main(void) {
                        "architecture");
        tst_exit();
 }
-#endif
\ No newline at end of file
+#endif
diff --git a/testcases/kernel/syscalls/set_thread_area/set_thread_area02.c 
b/testcases/kernel/syscalls/set_thread_area/set_thread_area02.c
index ff8710c..65b65ae 100644
--- a/testcases/kernel/syscalls/set_thread_area/set_thread_area02.c
+++ b/testcases/kernel/syscalls/set_thread_area/set_thread_area02.c
@@ -49,6 +49,7 @@
 /* History:     Porting from Crackerjack to LTP is done by             */
 /*             Manas Kumar Nayak [email protected]>                  */
 /************************************************************************/
+#include <sys/utsname.h>
 #include "set_thread_area.h"
 
 /* Global Variables */
@@ -75,10 +76,15 @@ void setup()
 int main(int ac, char **av)
 {
        thread_area_s u_info;
+       struct utsname uval;
 
+       uname(&uval);
        setup();
 
-       u_info.entry_number = 6;
+       if (strcmp(uval.machine, "x86_64") == 0)
+               u_info.entry_number = 12;
+       else
+               u_info.entry_number = 6;
 
        TEST(syscall(__NR_get_thread_area, &u_info));    //call 
get_thread_area()
        if (TEST_RETURN == -1) {
-- 
1.7.1

-- 
Best Regards,
Peng Haitao


------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to