Core File Not Being Generated in AIX

I have created an executable using my login session in an AIX Version 5 Unix system. After to which I have change the file mode to set uid and rwsrwx--x and ownership to root:system by using the following Standard C Library functions.

chmod (name, S_ISUID|S_IRWXU|S_IRWXG|S_IXOTH|S_IROTH)
chown (name, 0, 1)

where name is the name of the executable whose permissions needs to be changed. When I execute my executable using my login session, the executable gives a segmentation fault but the core file is not being generated. When I saw the man page of core in the system it said that "A process with a saved user ID that differs from the real user ID does not produce a memory image. The same holds true for the group ID (GID) and effective
group ID" .

Is it possible that we can generate a core file through some technique which would aid me in tracing the cause of the segmentation fault.

Hi,

You could truss or tusc the process when you start the program.
In Solaris/HP-ux it goes like :

truss /program/to/start/myprog

When debugging an already running program you can do :

truss -p <processid>

There is one note :

AIX 5.1 has 'truss'.

AIX 4.3.3 and earlier you can use the 'trace' command - but it's a pain because it's a system-level trace from which you can then extract the information for the process you cared about.

Regs David

On AIX, isn't there a way to allow a process to write a core file? (Assuming it dies as the result of the default action of an appropiate signal)

It may be that the program drops core (or dies trying) once in a blue moon. You can't run truss hundreds or thousands of times.

As per Perderabo advice, I tried various options by using the 'smit' tool in AIX for "a proces to allow to creat a core file .." but was incapable to do so. I am unable to proceed further cause of this.

I would appreciate if someone could provide me accurate information or solution for the existing issue.

I don't know too much about AIX but on Linux you have to play with 'ulimit' to set the size of core file allowed on your system. If the size of core file being generated is bigger than the limit specified it won't be created. Is there something like this on AIX?

Dang! I saw AIX in the original post and I just moved on since I don't know AIX. But now I just read the post....

The program is suid to root! If you run it as an ordinary user, it will not drop core. This is a security feature in most versions of unix.

Remove the suid bit or sign on as root to run it.

Thanks a lot Perderabo for all your help. By removing the set uid bit the process was able to generate the core dump image file.

Thanks for all your assistance.