Hi!
> We are testing several embedded Linux. When we use LTP to test these Linux, 
> we find that the testcase sigtimedwait01 always failed with Segment Fault.
> 
> As the testcase failed on x86_64, i586 and arm, we found that maybe glibc 
> doesn??t deal with the bad address
> 
> The testcase C program file is : 
> testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo.c
> 
> The result is :
> sigtimedwait01    6  TPASS  :  Test passed
> sigtimedwait01    0  TINFO  :  0x80493c0, 10
> sigtimedwait01    7  TBROK  :  unexpected signal 11 received (pid = 4057).
> sigtimedwait01    8  TBROK  :  Remaining cases broken
> 
> it always fail after line 334, because of Segment Fault
> 332 void test_bad_address2(swi_func sigwaitinfo, int signo)
> 333 {
> 334         TEST(sigwaitinfo((void*)1, NULL, NULL);
> 335         REPORT_SUCCESS(-1, EFAULT);
> 336 }
> 
> We can see that, here, we do
> 
> Sigtimedwait((void*)1, NULL, NULL));
> 
> And the parameter (void *)1 is a bad address.
> 
> This test can make things easier.
> 
> #include <stdio.h>
> #include <signal.h>
> 
> int main()
> {
>         int ret;
>         ret = sigtimedwait((void*)1, NULL, NULL);
>         printf("test end\n");
>         return 0;
> }
> 
> Why LTP expect to get the EFAULT error?

Hmm, that is dumbious test indeed, as the EFAULT isn't specified in
manual page as possible errno. Moreover if you look into the
corresponding glibc source (sysdeps/unix/sysv/linux/sigtimedwait.c) the
first parameter is dereferenced before the actual syscall is done.

Digging in glibc git log the checks for SIGCANCEL and SIGSETXID were
added around year 2003. I suspect that the test was working fine
beforehand.

My conclusion is that the test for bad address is wrong and should be
removed.

-- 
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to