All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Roderik_Wildenburg@domain.hid, xenomai@xenomai.org
Subject: Re: AW: [Xenomai-help] resubmission : memset of heap crashes	Xenomai-Task
Date: Wed, 06 Sep 2006 14:59:42 +0200	[thread overview]
Message-ID: <44FEC63E.3070009@domain.hid> (raw)
In-Reply-To: <17662.49530.72472.462058@domain.hid>

Hi Gilles,

Gilles Chanteperdrix wrote:
> Roderik_Wildenburg@domain.hid wrote:
>  > Dear Gilles,
>  > 
>  > I admit, the mechanism for allocating all memory of the target is not very sophisticated. The idea was, that MAXHEAPBLOCKS*MEMORYCHUNKSIZE is much much more, than memory available (at least with my target (128MB) this is true). I should have mentioned this in the source code, sorry. If your target has more then (MAXHEAPBLOCKS*MEMORYCHUNKSIZE=320MB(approcimate)) memory, you should increase MAXHEAPBLOCKS.
>  > 
>  > If this condition is fulfiled, I think, there should be no illegal memory access. Do you agree ?
>  > 
> 
> A better patch.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --- heap.c~	2006-09-06 14:27:31.000000000 +0200
> +++ heap.c	2006-09-06 14:37:07.000000000 +0200
> @@ -101,7 +101,15 @@ void display(void *cookie)
>     {
>        memsize+=addsize;
>        if(!(ret=rt_heap_create(&bigheap[i],nbuf,memsize,H_PRIO|H_MAPPABLE)))
> +      {
> +	 if (i > MAXHEAPBLOCKS - 1)
> +	 {
> +	    printf("i= %d is out of bounds, stopping here, avoid later SEGV.\n",
> +		   i);
> +	    exit(EXIT_FAILURE);
> +	 }
>           rt_heap_delete(&bigheap[i]);
> +      }
>     }while(ret==0);
>  
>     memsize>>=1;
> 
> 
> ------------------------------------------------------------------------

I was able to reproduce the problem on my MPC5200 system some time ago
and I have checked the index "i" as well. "i" was not out-of-range, 
IIRC. The problem only shows up on PowerPC., at least Jan was unable
to reproduce it on a x86 system. How could we debug the seg fault. Do
you have a good idea? Would the IPIPE tracer help?

Wolfgang.



  reply	other threads:[~2006-09-06 12:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 12:08 AW: [Xenomai-help] resubmission : memset of heap crashes Xenomai-Task Roderik_Wildenburg
2006-09-06 12:30 ` Gilles Chanteperdrix
2006-09-06 12:39 ` Gilles Chanteperdrix
2006-09-06 12:59   ` Wolfgang Grandegger [this message]
2006-09-06 13:04     ` Gilles Chanteperdrix
2006-09-06 13:08       ` Gilles Chanteperdrix
2006-09-06 13:12     ` Gilles Chanteperdrix
2006-09-06 13:32     ` Jan Kiszka
2006-09-06 14:50     ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2006-09-06 12:56 Roderik_Wildenburg

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=44FEC63E.3070009@domain.hid \
    --to=wg@domain.hid \
    --cc=Roderik_Wildenburg@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.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.