All of lore.kernel.org
 help / color / mirror / Atom feed
From: vamsi krishna <vamsi.krishnak@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: kernel generating SIGBUS while handling pagefault.
Date: Tue, 31 May 2005 23:51:53 +0530	[thread overview]
Message-ID: <3faf05680505311121264fab06@mail.gmail.com> (raw)

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.

                 reply	other threads:[~2005-05-31 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3faf05680505311121264fab06@mail.gmail.com \
    --to=vamsi.krishnak@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.