All of lore.kernel.org
 help / color / mirror / Atom feed
* Fw: Segmentation error 6 in rt_heap_create() without --enable-pshared
@ 2018-11-07 13:00 Henning Schild
  2018-11-07 13:31 ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Schild @ 2018-11-07 13:00 UTC (permalink / raw)
  To: Xenomai

Readding list ...

Beginn der weitergeleiteten Nachricht:

Datum: Wed, 7 Nov 2018 13:55:53 +0100
Von: Henning Schild <henning.schild@siemens.com>
An: Xenomai <xenomai-bounces@xenomai.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, Philippe Gerum
<rpm@xenomai.org>, Petr Červenka <grugh@centrum.cz> Betreff: Re:
Segmentation error 6 in rt_heap_create() without --enable-pshared


Am Wed, 7 Nov 2018 13:10:34 +0100
schrieb Henning Schild <henning.schild@siemens.com>:

> Am Tue, 6 Nov 2018 19:04:51 +0100
> schrieb Jan Kiszka via Xenomai <xenomai@xenomai.org>:
>   
> > On 05.11.18 16:48, Petr Červenka wrote:    
> > >> Only? Sorry for insisting, but it may help to reduce the search
> > >> space, and it's also important as I'd like to release a new
> > >> stable version - without known issues.
> > >  > 
> > >> Thanks,
> > >> Jan
> > >  >      
> > >  
> > > I can confirm now, that the problem happens only with the master
> > > branch. Petr
> > >       
> > 
> > Thanks. Philippe, any idea?    
> 
> I was just looking into an issue in the dlopen-test. Turns out it is a
> segfault from rt_queue_create that only shows in "--enable-dlopen-libs
> --disable-pshared".
> 
> Will at least try and bisect my way to where that was introduced.  

Got it:
# first new commit: [fa39f253518101d0d31dc946ecdde55afb1b88b2]
copperplate/heapobj: enable heapmem for private memory

Henning

> Henning
>   
> > Jan
> >     
>   



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fw: Segmentation error 6 in rt_heap_create() without --enable-pshared
  2018-11-07 13:00 Fw: Segmentation error 6 in rt_heap_create() without --enable-pshared Henning Schild
@ 2018-11-07 13:31 ` Philippe Gerum
  2018-11-07 15:09   ` Henning Schild
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2018-11-07 13:31 UTC (permalink / raw)
  To: Henning Schild, Xenomai

On 11/7/18 2:00 PM, Henning Schild via Xenomai wrote:
> Readding list ...
> 

Does this help?

diff --git a/lib/copperplate/heapobj-heapmem.c b/lib/copperplate/heapobj-heapmem.c
index 5c0ce9b2d..124fe564a 100644
--- a/lib/copperplate/heapobj-heapmem.c
+++ b/lib/copperplate/heapobj-heapmem.c
@@ -33,8 +33,8 @@ int __heapobj_init_private(struct heapobj *hobj, const char *name,
 	int ret;
 
 	if (mem == NULL) {
-		_mem = __STD(malloc(size));
-		if (_mem == NULL)
+		mem = __STD(malloc(size));
+		if (mem == NULL)
 			return -ENOMEM;
 	}
 	
@@ -43,16 +43,16 @@ int __heapobj_init_private(struct heapobj *hobj, const char *name,
 	else
 		snprintf(hobj->name, sizeof(hobj->name), "%p", hobj);
 
-	ret = heapmem_init(hobj->pool, _mem, size);
+	hobj->pool = mem;
+	hobj->size = size;
+
+	ret = heapmem_init(hobj->pool, mem, size);
 	if (ret) {
-		if (mem == NULL)
-			__STD(free(_mem));
+		if (_mem == NULL)
+			__STD(free(mem));
 		return ret;
 	}
 
-	hobj->pool = _mem;
-	hobj->size = size;
-
 	return 0;
 }

-- 
Philippe.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Segmentation error 6 in rt_heap_create() without --enable-pshared
  2018-11-07 13:31 ` Philippe Gerum
@ 2018-11-07 15:09   ` Henning Schild
  2018-11-08  9:17     ` Philippe Gerum
  0 siblings, 1 reply; 5+ messages in thread
From: Henning Schild @ 2018-11-07 15:09 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

Am Wed, 7 Nov 2018 14:31:10 +0100
schrieb Philippe Gerum <rpm@xenomai.org>:

> On 11/7/18 2:00 PM, Henning Schild via Xenomai wrote:
> > Readding list ...
> >   
> 
> Does this help?
> 
> diff --git a/lib/copperplate/heapobj-heapmem.c
> b/lib/copperplate/heapobj-heapmem.c index 5c0ce9b2d..124fe564a 100644
> --- a/lib/copperplate/heapobj-heapmem.c
> +++ b/lib/copperplate/heapobj-heapmem.c
> @@ -33,8 +33,8 @@ int __heapobj_init_private(struct heapobj *hobj,
> const char *name, int ret;
>  
>  	if (mem == NULL) {
> -		_mem = __STD(malloc(size));
> -		if (_mem == NULL)
> +		mem = __STD(malloc(size));
> +		if (mem == NULL)
>  			return -ENOMEM;
>  	}
>  	
> @@ -43,16 +43,16 @@ int __heapobj_init_private(struct heapobj *hobj,
> const char *name, else
>  		snprintf(hobj->name, sizeof(hobj->name), "%p", hobj);
>  
> -	ret = heapmem_init(hobj->pool, _mem, size);
> +	hobj->pool = mem;
> +	hobj->size = size;
> +
> +	ret = heapmem_init(hobj->pool, mem, size);

ret = -EINVAL

Henning

>  	if (ret) {
> -		if (mem == NULL)
> -			__STD(free(_mem));
> +		if (_mem == NULL)
> +			__STD(free(mem));
>  		return ret;
>  	}
>  
> -	hobj->pool = _mem;
> -	hobj->size = size;
> -
>  	return 0;
>  }
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation error 6 in rt_heap_create() without --enable-pshared
  2018-11-07 15:09   ` Henning Schild
@ 2018-11-08  9:17     ` Philippe Gerum
  2018-11-08 15:03       ` Henning Schild
  0 siblings, 1 reply; 5+ messages in thread
From: Philippe Gerum @ 2018-11-08  9:17 UTC (permalink / raw)
  To: Henning Schild; +Cc: Xenomai

On 11/7/18 4:09 PM, Henning Schild wrote:
> Am Wed, 7 Nov 2018 14:31:10 +0100
> schrieb Philippe Gerum <rpm@xenomai.org>:
> 
>> On 11/7/18 2:00 PM, Henning Schild via Xenomai wrote:
>>> Readding list ...
>>>   
>>
>> Does this help?
>>
>> diff --git a/lib/copperplate/heapobj-heapmem.c
>> b/lib/copperplate/heapobj-heapmem.c index 5c0ce9b2d..124fe564a 100644
>> --- a/lib/copperplate/heapobj-heapmem.c
>> +++ b/lib/copperplate/heapobj-heapmem.c
>> @@ -33,8 +33,8 @@ int __heapobj_init_private(struct heapobj *hobj,
>> const char *name, int ret;
>>  
>>  	if (mem == NULL) {
>> -		_mem = __STD(malloc(size));
>> -		if (_mem == NULL)
>> +		mem = __STD(malloc(size));
>> +		if (mem == NULL)
>>  			return -ENOMEM;
>>  	}
>>  	
>> @@ -43,16 +43,16 @@ int __heapobj_init_private(struct heapobj *hobj,
>> const char *name, else
>>  		snprintf(hobj->name, sizeof(hobj->name), "%p", hobj);
>>  
>> -	ret = heapmem_init(hobj->pool, _mem, size);
>> +	hobj->pool = mem;
>> +	hobj->size = size;
>> +
>> +	ret = heapmem_init(hobj->pool, mem, size);
> 
> ret = -EINVAL

Part of the solution in this patch (on top of the previous one), but more changes are needed for a complete fix:

diff --git a/lib/copperplate/heapobj-heapmem.c b/lib/copperplate/heapobj-heapmem.c
index 124fe564a..3961bd054 100644
--- a/lib/copperplate/heapobj-heapmem.c
+++ b/lib/copperplate/heapobj-heapmem.c
@@ -33,6 +33,7 @@ int __heapobj_init_private(struct heapobj *hobj, const char *name,
 	int ret;
 
 	if (mem == NULL) {
+		size = HEAPMEM_ARENA_SIZE(size); /* Count meta-data in. */
 		mem = __STD(malloc(size));
 		if (mem == NULL)
 			return -ENOMEM;
@@ -60,7 +61,7 @@ int heapobj_init_array_private(struct heapobj *hobj, const char *name,
 			       size_t size, int elems)
 {
 	return __bt(__heapobj_init_private(hobj, name,
-			   HEAPMEM_ARENA_SIZE(size * elems), NULL));
+					   size * elems, NULL));
 }
 
 int heapobj_pkg_init_private(void)

-- 
Philippe.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Segmentation error 6 in rt_heap_create() without --enable-pshared
  2018-11-08  9:17     ` Philippe Gerum
@ 2018-11-08 15:03       ` Henning Schild
  0 siblings, 0 replies; 5+ messages in thread
From: Henning Schild @ 2018-11-08 15:03 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

Am Thu, 8 Nov 2018 10:17:44 +0100
schrieb Philippe Gerum <rpm@xenomai.org>:

> On 11/7/18 4:09 PM, Henning Schild wrote:
> > Am Wed, 7 Nov 2018 14:31:10 +0100
> > schrieb Philippe Gerum <rpm@xenomai.org>:
> >   
> >> On 11/7/18 2:00 PM, Henning Schild via Xenomai wrote:  
> >>> Readding list ...
> >>>     
> >>
> >> Does this help?
> >>
> >> diff --git a/lib/copperplate/heapobj-heapmem.c
> >> b/lib/copperplate/heapobj-heapmem.c index 5c0ce9b2d..124fe564a
> >> 100644 --- a/lib/copperplate/heapobj-heapmem.c
> >> +++ b/lib/copperplate/heapobj-heapmem.c
> >> @@ -33,8 +33,8 @@ int __heapobj_init_private(struct heapobj *hobj,
> >> const char *name, int ret;
> >>  
> >>  	if (mem == NULL) {
> >> -		_mem = __STD(malloc(size));
> >> -		if (_mem == NULL)
> >> +		mem = __STD(malloc(size));
> >> +		if (mem == NULL)
> >>  			return -ENOMEM;
> >>  	}
> >>  	
> >> @@ -43,16 +43,16 @@ int __heapobj_init_private(struct heapobj
> >> *hobj, const char *name, else
> >>  		snprintf(hobj->name, sizeof(hobj->name), "%p",
> >> hobj); 
> >> -	ret = heapmem_init(hobj->pool, _mem, size);
> >> +	hobj->pool = mem;
> >> +	hobj->size = size;
> >> +
> >> +	ret = heapmem_init(hobj->pool, mem, size);  
> > 
> > ret = -EINVAL  
> 
> Part of the solution in this patch (on top of the previous one), but
> more changes are needed for a complete fix:

Ok, that helps. Can you prepare a patch?

Henning

> diff --git a/lib/copperplate/heapobj-heapmem.c
> b/lib/copperplate/heapobj-heapmem.c index 124fe564a..3961bd054 100644
> --- a/lib/copperplate/heapobj-heapmem.c
> +++ b/lib/copperplate/heapobj-heapmem.c
> @@ -33,6 +33,7 @@ int __heapobj_init_private(struct heapobj *hobj,
> const char *name, int ret;
>  
>  	if (mem == NULL) {
> +		size = HEAPMEM_ARENA_SIZE(size); /* Count meta-data
> in. */ mem = __STD(malloc(size));
>  		if (mem == NULL)
>  			return -ENOMEM;
> @@ -60,7 +61,7 @@ int heapobj_init_array_private(struct heapobj
> *hobj, const char *name, size_t size, int elems)
>  {
>  	return __bt(__heapobj_init_private(hobj, name,
> -			   HEAPMEM_ARENA_SIZE(size * elems), NULL));
> +					   size * elems, NULL));
>  }
>  
>  int heapobj_pkg_init_private(void)
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-08 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 13:00 Fw: Segmentation error 6 in rt_heap_create() without --enable-pshared Henning Schild
2018-11-07 13:31 ` Philippe Gerum
2018-11-07 15:09   ` Henning Schild
2018-11-08  9:17     ` Philippe Gerum
2018-11-08 15:03       ` Henning Schild

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.