kernel generating SIGBUS while handling pagefault.

From: vamsi krishna (vamsi.krishnak_at_gmail.com)
Date: 05/31/05

  • Next message: Steven Rostedt: "Re: RT patch acceptance"
    Date:	Tue, 31 May 2005 23:51:53 +0530
    To: linux-kernel@vger.kernel.org
    
    

    Hello,

    I have a program which is trying to access its virtual memory segments
    (listed in /proc/<pid>/maps file). But while reading the following
    virtual memory segment as below.
    <-------------------------------------------------------------------------------------------------------------------->
           0x2a95556000 0x2a9566b000 0x115000 0
    /lib64/ld-2.3.2.so
           0x2a9566b000 0x2a9566c000 0x1000 0x15000
    /lib64/ld-2.3.2.so
    <-------------------------------------------------------------------------------------------------------------------->
    generate SIGBUS with siginfo as BUS_ADRERR (Non-existent physical
    address), I traced back into the kernel code to get the detail on why
    this BUS_ADRERR is set and found that, if the kernel could not handle
    pagefault it generates BUS_ADRERR.

     In the file /usr/src/linux-2.4.21-20.EL/mm/memory.c at line 1746.
    <------------------------------------------------------------------->
            new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0);

           if (new_page == NULL) /* no page was available -- SIGBUS */
                   return 0;
           if (new_page == NOPAGE_OOM)
                   return -1;
    <------------------------------------------------------------------->
    So is the kernel trying to get a page (map a page) into the swap space
    from file, and failing to map the file ? due to lack of swap space??.
    Currently the kernel runs on a amd64 machine with 5GB RAM and 33GB
    swap space.

    But if I run the same program(executable) on amd64 machine with kernel
    2.4.21-4 with 8GB RAM and 16GB swap space, there were no page faults
    and I see only 1 virtual address mapping for /lib64/ld-2.3.2.so on
    this machine.

    I analyzed the strace on the machine failing with SIGBUS and found the
    following in the strace output
    <-------------------------------------------------------------------->
    mmap(NULL, 1061968, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) =
    0x2a95687000 mprotect(0x2a9568b000, 1045584, PROT_NONE) = 0
    mmap(0x2a95787000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED,
    3, 0) = 0x2a95787000
    close(3) = 0
    mprotect(0x7fbff09000, 4096,
    PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = -1 EINVAL (Invalid
    argument) mprotect(0x7fbff02000, 32768,
    PROT_READ|PROT_WRITE|PROT_EXEC) = -1 ENOMEM (Cannot allocate memory)
    mprotect(0x7fbff06000, 16384, PROT_READ|PROT_WRITE|PROT_EXEC) = -1
    ENOMEM (Cannot allocate memory) mprotect(0x7fbff08000, 8192,
    PROT_READ|PROT_WRITE|PROT_EXEC) = 0 mprotect(0x7fbff06000, 8192,
    PROT_READ|PROT_WRITE|PROT_EXEC) = -1 ENOMEM (Cannot allocate memory)
    mprotect(0x7fbff07000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC) = -1
    ENOMEM (Cannot allocate memory)
    <-------------------------------------------------------------------->
    I see some system calls failing with 'Cannot allocate memory', is this
    because that I use only 5GB of RAM for a 64-bit machine?

    Can some mm hackers kindly give some inputs in this?

    Thanks in advance.

    Best,
    Vamsi kundeti.
    India.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Steven Rostedt: "Re: RT patch acceptance"

    Relevant Pages

    • [UNIX] Linux Kernel do_brk() Vulnerablility (Explained)
      ... Get your security news from a reliable source. ... A critical security bug has been found in the Linux kernel 2.4.22 (and ... earlier) memory management subsystem. ... for the code working at the lowest privilege level. ...
      (Securiteam)
    • Re: Cached memory never gets released
      ... Stock linux 2.4.26 kernel. ... Due to flash bug 3M of memory gets lost due to font memory getting lost ... The output of "free" cache number steadily grows. ... longer to exhaust all of system memory with the cache. ...
      (Linux-Kernel)
    • Re: memory not released after using cdrecord/cdrdao (was: audio cd writing causes massive swap and c
      ... The kernel is most definitely not releasing the memory ... I further would have to say that the kernel isn't being ... >after cdrdao or cdrecord have used it, ... the Linux Kernel maintainers have not been very helpful with Linux ...
      (Linux-Kernel)
    • Re: Allocating kernel memory
      ... am doing has to be in kernel space - no other option. ... I never complained about the real memory that was used but pointed out ... the features of the architecture in the best possible way. ... Oh but wait, paging is there to ...
      (comp.os.linux.development.system)
    • Re: [PATCH -mm 1/5] Blackfin: blackfin architecture patch update
      ... the workload really doesn't matter. ... And that is the problem - the kernel doesn't know how much on chip ... memory an application which will be loaded in the future might need. ... Obviously you expect them to be sitting there with a profiler open ...
      (Linux-Kernel)