Skip to contentSkip to conversation

mbind01: Fix the bug of mind case10

PATCH In review Zhang Xiliang 2 participants 2 messages Sep 2, 2009 – Sep 7, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbind01: Fix the bug of mind case10

I tested ltp mbind01 case and found the case10 failed.

In case10, the expect errno is EFAULT.

In mbind manual, it says "EFAULT Part or all of the memory range specified by nodemask and maxnode points outside your accessible address space. "

So the case should use invalid "nodemask" instead of invalid "p" to test.

---
 testcases/kernel/syscalls/mbind/mbind01.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/mbind/mbind01.c +6 -3
index 446fdaf..4afa71b 100644
@@ -238,8 +238,8 @@ static struct test_case tcase[] = {
         },
         { // case10
                 .ttype          = INVALID_POINTER,
-                .policy         = MPOL_DEFAULT,
-                .from_node      = NONE,
+                .policy         = MPOL_PREFERRED,
+                .from_node      = SELF,
                 .ret            = -1,
                 .err            = EFAULT,
         },
@@ -263,6 +263,7 @@ static int do_test(struct test_case *tc) {
         nodemask_t nodemask, getnodemask;
         unsigned long maxnode = NUMA_NUM_NODES;
         unsigned long len = MEM_LENGTH;
+	unsigned long *invalid_nodemask;
 
         /* We assume that there is only one node(node0). */
         nodemask_zero(&nodemask);
@@ -279,13 +280,15 @@ static int do_test(struct test_case *tc) {
                 tst_exit();
         }
         if(tc->ttype == INVALID_POINTER)
-                p = (char*)0xc0000000;
+		invalid_nodemask = (unsigned long *)0xc0000000;
 /*
          * Execute system call
          */
         errno = 0;
         if (tc->from_node == NONE)
                 TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy,NULL, 0, tc->flags));
+	else if (tc->ttype == INVALID_POINTER)
+		TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy, invalid_nodemask, maxnode, tc->flags));
         else
                 TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy,&nodemask, maxnode, tc->flags));
         sys_errno = errno;

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 10 lines · Zhang Xiliang

I tested ltp mbind01 case and found the case10 failed.

In case10, the expect errno is EFAULT.

In mbind manual, it says "EFAULT Part or all of the memory range specified by nodemask and maxnode points outside your accessible address space. "

So the case should use invalid "nodemask" instead of invalid "p" to test.

Thanks.

Regards--
Subrata

Quoted 47 lines
---
 testcases/kernel/syscalls/mbind/mbind01.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/mbind/mbind01.c +6 -4
index 446fdaf..4afa71b 100644
@@ -238,8 +238,8 @@ static struct test_case tcase[] = {
         },
         { // case10
                 .ttype          = INVALID_POINTER,
-                .policy         = MPOL_DEFAULT,
-                .from_node      = NONE,
+                .policy         = MPOL_PREFERRED,
+                .from_node      = SELF,
                 .ret            = -1,
                 .err            = EFAULT,
         },
@@ -263,6 +263,7 @@ static int do_test(struct test_case *tc) {
         nodemask_t nodemask, getnodemask;
         unsigned long maxnode = NUMA_NUM_NODES;
         unsigned long len = MEM_LENGTH;
+	unsigned long *invalid_nodemask;
 
         /* We assume that there is only one node(node0). */
         nodemask_zero(&nodemask);
@@ -279,13 +280,15 @@ static int do_test(struct test_case *tc) {
                 tst_exit();
         }
         if(tc->ttype == INVALID_POINTER)
-                p = (char*)0xc0000000;
+		invalid_nodemask = (unsigned long *)0xc0000000;
 /*
          * Execute system call
          */
         errno = 0;
         if (tc->from_node == NONE)
                 TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy,NULL, 0, tc->flags));
+	else if (tc->ttype == INVALID_POINTER)
+		TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy, invalid_nodemask, maxnode, tc->flags));
         else
                 TEST(sys_ret = syscall(__NR_mbind, p, len, tc->policy,&nodemask, maxnode, tc->flags));
         sys_errno = errno;
 
 
------------------------------------------------------------------------------
Quoted 8 lines

Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list