Find the answer to your Linux question:
Results 1 to 3 of 3
Dear, Recently I'm struggling with a problem of running my application. The thing is I have compiled this app with some specific linker script which layout the program sections in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2

    Kernel rejects launchng my application


    Dear,

    Recently I'm struggling with a problem of running my application. The thing is I have compiled this app with some specific linker script which layout the program sections in a specific order and manner. I'm planning to play a bit with linux kernel so I would like to ask you to help me identify the place within kernel sources where the kernel loads applications into memory.

    The result of running my application is:
    #>./myapp
    Killed

    That is the only message which I can see. I have used strace and here is the output:

    #> ./strace -t ./myapp
    [ 5964.080000] ##### send signal from USER, SIG : 19, strace(1050)->strace(1050) sys_kill
    01:39:24 execve[ 5964.088000] [VDLP COREDUMP] SIGNR:5
    [ 5964.088000]
    ("[ 5964.092000] ##### send signal from USER, SIG : 9, strace(1049)->strace(1049) sys_tgkill
    ./myapp", ["./myapp"], [/* 40 vars */] <unfinished ...>
    01:39:24 +++ killed by SIGKILL +++
    Killed

    Cheers,
    Przemek

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,509
    Is this a kernel module, or a user space program? You cannot use kernel code in a user-space application, just as you cannot use a lot of user-space code (clib/glibc) in kernel space code.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Posts
    2
    This is very simple application which shall be executed in user space. As I mentioned I used linked script to compile this very very simple application. The script is suppose to layout program sections so the .bss section requires 1GB of memory. My env. has only 1GB of memory and kernel simply rejects executed of this application. I wanted to fix it or make a workaround in kernel so I can get this application running. The crucial thing about this app is that it has to be as small as possible and it requires a specific layout of sections. The code of the app is below.

    #include <stdio.h>

    int do_load(unsigned int* stack)
    {

    }

    asm(".pushsection \".text\",\"ax\",%progbits\n"
    ".globl _start\n"
    ".type _start,#function\n"
    "_start:\n"
    "mov fp, #0\n"
    "mov lr, #0\n"
    "mov r4, sp\n"
    "mov r0, sp\n"
    "bl do_load\n"
    "mov sp, r4\n"

    "mov r0, #0\n"
    "mov r7, #1\n"
    "svc 0x00000000\n"
    ".popsection"
    );

    void __aeabi_unwind_cpp_pr0(void)
    {
    }

    and the script:


    ENTRY(_start)

    TEXT_START = 0x10000;

    PHDRS {
    text PT_LOAD FILEHDR PHDRS;
    data PT_LOAD;
    reserve PT_LOAD FLAGS(0);
    r_debug PT_LOAD;
    note PT_NOTE;
    stack PT_GNU_STACK FLAGS(6); /* RW, no E */
    }

    SECTIONS {
    . = TEXT_START + SIZEOF_HEADERS;

    .note.gnu.build-id : {
    *(.note.gnu.build-id)
    } :text :note

    .text : {
    *(.text*)
    } :text
    .rodata : {
    *(.rodata*)
    *(.eh_frame*)
    }

    etext = .;

    . = (ALIGN(CONSTANT(MAXPAGESIZE)) -
    ((CONSTANT(MAXPAGESIZE) - .) & (CONSTANT(MAXPAGESIZE) - 1)));
    . = DATA_SEGMENT_ALIGN(CONSTANT(MAXPAGESIZE), CONSTANT(COMMONPAGESIZE));

    .data : {
    *(.data*)
    } :data
    .bss : {
    *(.bss*)
    }
    . = ALIGN(CONSTANT(COMMONPAGESIZE));
    RESERVE_START = .;
    .reserve : {
    . += DEFINED(RESERVE_TOP) ? (RESERVE_TOP - RESERVE_START) : 0;
    } :reserve

    .r_debug : {
    *(.r_debug)
    } :r_debug

    /DISCARD/ : {
    *(.iplt)
    *(.rel*)
    *(.igot.plt)
    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •