Skip to contentSkip to conversation

getpeername01, getsockname01, socketpair01

LTP Michal Simek 2 participants 3 messages Jul 2, 2009 – Jul 6, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

Can someone explain me why is in that subject tests for invalid pointer choose
address 1 (or 7 in socketpair01)? I did some tests on Microblaze and for this address I am getting segfault.
That's the reason why I think that problem is in glibc or ltp test. All tests test reaction for invalid pointer address.

The interesting is that any address from 1 to 999 9999 caused segfault. Address above not.
Below is memory map but first segment starts at 0x1000 0000 not 1000 0000 which is in patches below and works.

# cat /proc/66/maps
10000000-10001000 r-xp 00000000 00:01 394        /opcoded
10001000-10002000 rw-p 00000000 00:01 394        /opcoded
48000000-4801c000 r-xp 00000000 00:01 389        /lib/ld-2.3.3.so
4801c000-4801e000 rw-p 0001b000 00:01 389        /lib/ld-2.3.3.so
4801e000-4817c000 r-xp 00000000 00:01 379        /lib/libc-2.3.3.so
4817c000-4817f000 r--p 0015d000 00:01 379        /lib/libc-2.3.3.so
4817f000-48181000 rw-p 00160000 00:01 379        /lib/libc-2.3.3.so
48181000-48186000 rw-p 00000000 00:00 0
bfc15000-bfc2a000 rwxp 00000000 00:00 0          [stack]

Below are my changes which jump over segfault but they are still invalid pointer.
Has someone ever met with this problem before?

Patches below are on this link too.
http://developer.petalogix.com/git/gitweb.cgi?p=ltp-microblaze.git;a=commitdiff;h=45f4cd783ce8b94f1267bb87c0c46e8536f62eca

Thanks,
Michal

(quoted diff) +0 -0

b/testcases/kernel/syscalls/getpeername/getpeername01.c index 55d349a..3ae015d 100644 (file)

testcases/kernel/syscalls/getpeername/getpeername01.c +1 -1
@@ -93,7 +93,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup2, cleanup1,
                    "invalid socket buffer"}, {
        PF_UNIX, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup2, cleanup1,
+                   (socklen_t *) 10000000, -1, EFAULT, setup2, cleanup1,
                    "invalid salen"},
 #endif
 };
(quoted diff) +0 -0

b/testcases/kernel/syscalls/getsockname/getsockname01.c index 6159847..2020230 100644 (file)

testcases/kernel/syscalls/getsockname/getsockname01.c +1 -1
@@ -90,7 +90,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup1, cleanup1,
                    "invalid socket buffer"}, {
        PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup1, cleanup1,
+                   (socklen_t *) 1000000, -1, EFAULT, setup1, cleanup1,
                    "invalid salen"},
 #endif
 };
(quoted diff) +0 -0

b/testcases/kernel/syscalls/socketpair/socketpair01.c index fc90529..f8c29c0 100644 (file)

testcases/kernel/syscalls/socketpair/socketpair01.c +1 -1
@@ -81,7 +81,7 @@ struct test_case_t {          /* test case structure */
            /* Skip since uClinux does not implement memory protection */
        {
        PF_UNIX, SOCK_STREAM, 0, 0, -1, EFAULT, "bad pointer"}, {
-       PF_UNIX, SOCK_STREAM, 0, (int *)7, -1, EFAULT, "bad pointer"},
+       PF_UNIX, SOCK_STREAM, 0, (int *)10000000, -1, EFAULT, "bad

pointer"},

 #endif
        {
        PF_INET, SOCK_DGRAM, 17, sv, -1, EOPNOTSUPP, "UDP socket"}, {
Signature · 10 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 30 lines · Michal Simek

Hi,

Can someone explain me why is in that subject tests for invalid pointer choose
address 1 (or 7 in socketpair01)? I did some tests on Microblaze and for this address I am getting segfault.
That's the reason why I think that problem is in glibc or ltp test. All tests test reaction for invalid pointer address.

The interesting is that any address from 1 to 999 9999 caused segfault. Address above not.
Below is memory map but first segment starts at 0x1000 0000 not 1000 0000 which is in patches below and works.

# cat /proc/66/maps
10000000-10001000 r-xp 00000000 00:01 394        /opcoded
10001000-10002000 rw-p 00000000 00:01 394        /opcoded
48000000-4801c000 r-xp 00000000 00:01 389        /lib/ld-2.3.3.so
4801c000-4801e000 rw-p 0001b000 00:01 389        /lib/ld-2.3.3.so
4801e000-4817c000 r-xp 00000000 00:01 379        /lib/libc-2.3.3.so
4817c000-4817f000 r--p 0015d000 00:01 379        /lib/libc-2.3.3.so
4817f000-48181000 rw-p 00160000 00:01 379        /lib/libc-2.3.3.so
48181000-48186000 rw-p 00000000 00:00 0
bfc15000-bfc2a000 rwxp 00000000 00:00 0          [stack]

Below are my changes which jump over segfault but they are still invalid pointer.
Has someone ever met with this problem before?

Quoted 5 lines

Patches below are on this link too.
http://developer.petalogix.com/git/gitweb.cgi?p=ltp-microblaze.git;a=commitdiff;h=45f4cd783ce8b94f1267bb87c0c46e8536f62eca

Thanks,
Michal

Michal,

I think you would need to recreate this :-)

patching file testcases/kernel/syscalls/getpeername/getpeername01.c Hunk #1 FAILED at 93.
1 out of 1 hunk FAILED -- saving rejects to file testcases/kernel/syscalls/getpeername/getpeername01.c.rej patching file testcases/kernel/syscalls/getsockname/getsockname01.c Hunk #1 FAILED at 90.
1 out of 1 hunk FAILED -- saving rejects to file testcases/kernel/syscalls/getsockname/getsockname01.c.rej patching file testcases/kernel/syscalls/socketpair/socketpair01.c
patch: **** malformed patch at line 151: pointer"},

Regards--
Subrata

Quoted 46 lines
testcases/kernel/syscalls/getpeername/getpeername01.c +1 -1
index 55d349a..3ae015d 100644 (file)
@@ -93,7 +93,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup2, cleanup1,
                    "invalid socket buffer"}, {
        PF_UNIX, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup2, cleanup1,
+                   (socklen_t *) 10000000, -1, EFAULT, setup2, cleanup1,
                    "invalid salen"},
 #endif
 };
testcases/kernel/syscalls/getsockname/getsockname01.c +1 -1
index 6159847..2020230 100644 (file)
@@ -90,7 +90,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup1, cleanup1,
                    "invalid socket buffer"}, {
        PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup1, cleanup1,
+                   (socklen_t *) 1000000, -1, EFAULT, setup1, cleanup1,
                    "invalid salen"},
 #endif
 };
testcases/kernel/syscalls/socketpair/socketpair01.c +1 -1
index fc90529..f8c29c0 100644 (file)
@@ -81,7 +81,7 @@ struct test_case_t {          /* test case structure */
            /* Skip since uClinux does not implement memory protection */
        {
        PF_UNIX, SOCK_STREAM, 0, 0, -1, EFAULT, "bad pointer"}, {
-       PF_UNIX, SOCK_STREAM, 0, (int *)7, -1, EFAULT, "bad pointer"},
+       PF_UNIX, SOCK_STREAM, 0, (int *)10000000, -1, EFAULT, "bad
 pointer"},
 #endif
        {
Quoted 3 lines
        PF_INET, SOCK_DGRAM, 17, sv, -1, EOPNOTSUPP, "UDP socket"}, {

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 35 lines · Subrata Modak
Quoted 33 lines · Michal Simek

Hi,

Can someone explain me why is in that subject tests for invalid pointer choose
address 1 (or 7 in socketpair01)? I did some tests on Microblaze and for this address I am getting segfault.
That's the reason why I think that problem is in glibc or ltp test. All tests test reaction for invalid pointer address.

The interesting is that any address from 1 to 999 9999 caused segfault. Address above not.
Below is memory map but first segment starts at 0x1000 0000 not 1000 0000 which is in patches below and works.

# cat /proc/66/maps
10000000-10001000 r-xp 00000000 00:01 394        /opcoded
10001000-10002000 rw-p 00000000 00:01 394        /opcoded
48000000-4801c000 r-xp 00000000 00:01 389        /lib/ld-2.3.3.so
4801c000-4801e000 rw-p 0001b000 00:01 389        /lib/ld-2.3.3.so
4801e000-4817c000 r-xp 00000000 00:01 379        /lib/libc-2.3.3.so
4817c000-4817f000 r--p 0015d000 00:01 379        /lib/libc-2.3.3.so
4817f000-48181000 rw-p 00160000 00:01 379        /lib/libc-2.3.3.so
48181000-48186000 rw-p 00000000 00:00 0
bfc15000-bfc2a000 rwxp 00000000 00:00 0          [stack]

Below are my changes which jump over segfault but they are still invalid pointer.
Has someone ever met with this problem before?

Patches below are on this link too.
http://developer.petalogix.com/git/gitweb.cgi?p=ltp-microblaze.git;a=commitdiff;h=45f4cd783ce8b94f1267bb87c0c46e8536f62eca

Quoted 8 lines
Quoted 3 lines

Thanks,
Michal

Michal,

I think you would need to recreate this :-)

:-) I don't wanted to add it to mainline LTP I just wanted to know why are there that hardcoded value.
Who write them there and especially why? Maybe there are correct but none know why?
On x86 that test passed but not on Microblaze. :-( I think that has any connection with memory map.

Thanks for any info,
Michal

Quoted 65 lines

patching file testcases/kernel/syscalls/getpeername/getpeername01.c Hunk #1 FAILED at 93.
1 out of 1 hunk FAILED -- saving rejects to file testcases/kernel/syscalls/getpeername/getpeername01.c.rej patching file testcases/kernel/syscalls/getsockname/getsockname01.c Hunk #1 FAILED at 90.
1 out of 1 hunk FAILED -- saving rejects to file testcases/kernel/syscalls/getsockname/getsockname01.c.rej patching file testcases/kernel/syscalls/socketpair/socketpair01.c
patch: **** malformed patch at line 151: pointer"},

Regards--
Subrata

Quoted 48 lines
testcases/kernel/syscalls/getpeername/getpeername01.c +1 -1
index 55d349a..3ae015d 100644 (file)
@@ -93,7 +93,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup2, cleanup1,
                    "invalid socket buffer"}, {
        PF_UNIX, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup2, cleanup1,
+                   (socklen_t *) 10000000, -1, EFAULT, setup2, cleanup1,
                    "invalid salen"},
 #endif
 };
testcases/kernel/syscalls/getsockname/getsockname01.c +1 -1
index 6159847..2020230 100644 (file)
@@ -90,7 +90,7 @@ struct test_case_t {          /* test case structure */
                    &sinlen, -1, EFAULT, setup1, cleanup1,
                    "invalid socket buffer"}, {
        PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
-                   (socklen_t *) 1, -1, EFAULT, setup1, cleanup1,
+                   (socklen_t *) 1000000, -1, EFAULT, setup1, cleanup1,
                    "invalid salen"},
 #endif
 };
testcases/kernel/syscalls/socketpair/socketpair01.c +1 -1
index fc90529..f8c29c0 100644 (file)
@@ -81,7 +81,7 @@ struct test_case_t {          /* test case structure */
            /* Skip since uClinux does not implement memory protection */
        {
        PF_UNIX, SOCK_STREAM, 0, 0, -1, EFAULT, "bad pointer"}, {
-       PF_UNIX, SOCK_STREAM, 0, (int *)7, -1, EFAULT, "bad pointer"},
+       PF_UNIX, SOCK_STREAM, 0, (int *)10000000, -1, EFAULT, "bad
 pointer"},
 #endif
        {
        PF_INET, SOCK_DGRAM, 17, sv, -1, EOPNOTSUPP, "UDP socket"}, {
Signature · 10 lines
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list