Hi Group,
Pardon me to interpret you guys with my question.

About SIGILL  signal,
According to wiki.

On POSIX-compliant platforms, SIGILL is the signal sent to a process when it 
attempts to execute a malformed, unknown, or privileged instruction. The 
symbolic constant for SIGILL is defined in the signal.h header file. Symbolic 
signal names are used because signal numbers can vary across platforms.

SA_SIGINFO macros
ILL_ILLOPC      illegal opcode
ILL_ILLOPN      illegal operand
ILL_ILLADR      illegal addressing mode
ILL_ILLTRP      illegal trap
ILL_PRVOPC      privileged opcode
ILL_PRVREG      privileged register
ILL_COPROC      coprocessor error
ILL_BADSTK      internal stack error


Take below sample 

#include <dirent.h>
#include <stdio.h>

int main (void)
{
        DIR* dir = opendir("/usr/lib");
        if (dir)
        {
                struct dirent* d = NULL;
                while ((d = readdir(dir)) != NULL)
                {
                        const char* local = d->d_name; // bam!
                        printf ("%s\n", local);
                }
                closedir(dir);
        }

        return 0;
}



When we try to compile and run  the  code on X OS i.e 

$ ./a.out
.
..
arc
Illegal instruction: 4

After debugging the sample,it turns out be unaligned pointer access,

The question here is that OS should had been signaled with SIGBUS then 
SIGILL,Because according wiki the SIGILL signaled when there is “malformed, 
unknown, or privileged instruction.” 

Did I’m missing something here ????

Thanks 
~Umesh 

-- 
Mailing list guidelines and other related articles: http://lug-iitd.org/Footer

Reply via email to