kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Debugging memset crashes
Date: Thu, 24 Feb 2011 00:37:27 -0700	[thread overview]
Message-ID: <AANLkTim59MFcPrBC11Q6AZR6H864DUC9rZXMHNPAohC=@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikOvjdUZMmm2X7JuK+TPPo7PhtLNmDom7n1TjEe@mail.gmail.com>

Hi Praveen,

On Wed, Feb 23, 2011 at 11:58 PM, Praveen kumar <chatpravi@gmail.com> wrote:
> Hi,
> I have an embedded system on which i get crash (Caused by memset )? at long
> run( Reproducible 2/10 times ),
> I wanted to know efficient ways (materials) to handle memset crashes .
>
> Program terminated with signal 11, Segmentation fault.
>
> #0 memset (dstpp=0xd2, c=<value optimized out>, len=3374)
> ????at ../../../src/Common/OS/linux/memset.c:20
> 20 ../../../src/Common/OS/linux/memset.c: No such file or directory.
> in ../../../src/Common/OS/linux/memset.c

The problem is probably that memset has been passed either a bad
pointer, or a bad size.

>From your backtrace, the dstpp of 0xd2 is almost certainly the
problem. The first 4K (and sometimes 64K) starting at location zero is
invalid. Passing a pointer in that range will cause an page fault (or
segmentation fault).

memset doesn't do any parameter checking, so if you want parameter
checking you'll need to do that yourself. You could add a function
like my_memest and use a macro to map memset to my_memset. Or you
could play with LD_PRELOAD (if your runtime library is in a shared
library) and intercept the calls that way.

http://stackoverflow.com/questions/69859/how-could-i-intercept-linux-sys-calls
http://developers.sun.com/solaris/articles/lib_interposers_code.html
http://www.jayconrod.com/cgi/view_post.py?23

Yet another technique is to use the linker's wrap capability
http://stackoverflow.com/questions/998464/function-interposition-in-linux-without-dlsym

Dave Hylands

      reply	other threads:[~2011-02-24  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24  6:58 Debugging memset crashes Praveen kumar
2011-02-24  7:37 ` Dave Hylands [this message]

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='AANLkTim59MFcPrBC11Q6AZR6H864DUC9rZXMHNPAohC=@mail.gmail.com' \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).