Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux application get Killed

I have a "Seagate Central" NAS with an embedded linux on it

$ cat /etc/*release
MontaVista Linux 6, (.dev-snapshot-20130726)

When I try to run my own application on this NAS, it will be "Killed" without any notifications on dmesg or /var/log/messages

$ cat /proc/cpuinfo
Processor       : ARMv6-compatible processor rev 4 (v6l)
BogoMIPS        : 279.34
Features        : swp half thumb fastmult vfp edsp java
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb02
CPU revision    : 4

Hardware        : Cavium Networks CNS3420 Validation Board
Revision        : 0000
Serial          : 0000000000000000

My toolchain is

Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/arm-none-linux-gnueabi

and my compile switches are

-march=armv6k -mcpu=mpcore -mfloat-abi=softfp -mfpu=vfp

How can I find out which process is killing my application, or what setting I have to change?

PS: I have created a simple HelloWorld application which is also not working !

$ ldd Hello
$       not a dynamic executable


readelf -a Hello
=> http://pastebin.com/kT9FvkjE

readelf -a zip
=> http://pastebin.com/3V6kqA9b

UPDATE 1

I have comiled a new binary with hard float

 Readelf output
 http://pastebin.com/a87bKksY

But no success ;(

I guess it is really a "lock" topic, which is blocking my application to execute. How can I find out what application kills mine ? Or how can I disable such kind of function ?

like image 312
element Avatar asked Oct 29 '13 07:10

element


People also ask

Why is Linux killing my process?

The Linux Kernel may also decide to terminate one or more processes when the system is running low on resources. A very common example of that is the out-of-memory (OOM) killer, which takes action when the system's physical memory is getting exhausted.

What is kill 9 PID?

“ kill -9” command sends a kill signal to terminate any process immediately when attached with a PID or a processname. It is a forceful way to kill/terminate a or set of processes. “ kill -9 <pid> / <processname>” sends SIGKILL (9) — Kill signal. This signal cannot be handled (caught), ignored or blocked.

How do I know if a process is killed in Unix?

If the kernel killed a process (because the system ran out of memory), there will be a kernel log message. Check in /var/log/kern. log (on Debian/Ubuntu, other distributions might send kernel logs to a different file, but usually under /var/log under Linux).


1 Answers

Use these compiler switches:

-march=armv6k -Wl,-z,max-page-size=0x10000,-z,common-page-size=0x10000,-Ttext-segment=0x10000

See also this link regarding the toolchain.

You can run readelf -a against one of the built-in binaries (e.g. /usr/bin/nano) to see the proper text-segment offset in the section headers and page size / alignment in the program headers. The above compiler flags make self-compiled programs match the structure of built in binaries, and have been tested to work. It seems the Seagate Central NAS uses a page size / offset of 0x10000 while the default for ARM gcc is 0x8000.

Edit: I see you ran readelf already. Your pastebin shows

HelloWorld:[ 1] .interp           PROGBITS        00008134 000134 000013 00   A  0   0  1
       zip:[ 1] .interp           PROGBITS        00010134 000134 000013 00   A  0   0  1

The value 10134-134=10000 (hex) yields the correct text-segment linker option. Further down (LOAD...) are the alignment specifiers, which are 0x8000 for your HelloWorld, but 0x10000 for the zip built-in. In my experience, soft-float has not caused problems.

like image 64
norstadt Avatar answered Sep 30 '22 13:09

norstadt