All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederik Bayart <frederik_bayart@yahoo.co.uk>
To: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] rt_heap_alloc size 0 - syscall 7 denied
Date: Wed, 14 Oct 2015 16:55:37 +0000 (UTC)	[thread overview]
Message-ID: <145395888.622970.1444841737686.JavaMail.yahoo@mail.yahoo.com> (raw)
In-Reply-To: <561E4D93.4090803@xenomai.org>

>On Wednesday, 14 October 2015, 14:41, Philippe Gerum <rpm@xenomai.org> wrote:
>
>On 10/14/2015 02:21 PM, Frederik Bayart wrote:
>>> On Wednesday, 14 October 2015, 12:43, Philippe Gerum <rpm@xenomai.org> wrote:
>>> On 10/14/2015 12:22 PM, Frederik Bayart wrote:
>>>> Hallo,
>>>> I'm using xenomai 3.0 on kernel 3.18.20 (64 bit).
>>>>
>>>> When using single block heap, I'm getting memory allocation problem when calling rt_heap_alloc with size 0. I don't get the error when calling the function with size used in rt_heap_create.
>>>> On the mailing list, I found there has been an issue with this in May : http://www.xenomai.org/pipermail/xenomai/2015-May/034165.html
>>>> Is this still an issue ?
>>>
>>> No, this one is long gone.
>>>
>>>>
>>>> In attachment a test program htest.c + makefile to generate the problem :
>>>>
>>>> $ sudo ./htest 1  ==> use 0
>>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>>> htest.c:79 ERROR: rt_heap_alloc(-12): Cannot allocate memory
>>>>
>>>> $ sudo ./htest 1  ==> use same size as in create
>>>> htest.c:69: heapsize = 70000, usablemem = 70144, usedmem = 0
>>>> htest.c:92: heapsize = 70000, usablemem = 70144, usedmem = 70144
>>>>
>>>
>>> Does this help?
>>>
>>> diff --git a/lib/alchemy/heap.c b/lib/alchemy/heap.c
>>> index 20531e3..146bfa1 100644
>>> --- a/lib/alchemy/heap.c
>>> +++ b/lib/alchemy/heap.c
>>> @@ -442,7 +442,9 @@ int rt_heap_alloc_timed(RT_HEAP *heap,
>>>        p = __mptr(hcb->sba);
>>>        if (p)
>>>            goto done;
>>> -        if (size > 0 && size != hcb->size) {
>>> +        if (size == 0)
>>> +            size = heapobj_size(&hcb->hobj);
>>> +        else if (size != hcb->size) {
>>>            ret = -EINVAL;
>>>            goto done;
>>>
>>>        }
>>>
>>
>> After code reading, could it be that the exception for size == 0 has disappeared in the released code ?
>>
>
>Did you try that patch?

Sorry, I didn't understand that the patch still has to be applied.
So the patch is working, thanks for the quick fix.

However the biggest problem is the denied syscall :

[Xenomai] syscall <7> denied to sysregd[22217]

I'm running the test program as root. Also sysregd is running as root.

root     22292     1  0 16:41 ?        00:00:00 sysregd --daemon --root /var/run/xenomai/root/anon@22289 --anon

So this would be sc_cobalt_thread_setschedparam_ex. So I'm thinking this is called maybe for the main thread shadowing, e.g. for the priority.

If I execute : 
# ./htest –main-prio=15

then I see in /proc/xenomai/sched/threads :

CPU  PID    CLASS  TYPE      PRI   TIMEOUT       STAT       NAME
0  16149  rt     cobalt      0   -             X          htest
0  16152  rt     cobalt      0   -             X          sysregd
0  16154  rt     cobalt      0   -             X          sysregd
0  16156  rt     cobalt      0   -             X          htest


so no prio 15.

The config dump :

# ./htest --dump-config
based on Xenomai/cobalt v3.0 -- 
CONFIG_MMU=1
CONFIG_SMP=1
CONFIG_XENO_BUILD_ARGS=" '--prefix=/usr' '--includedir=/usr/include/xenomai' '--mandir=/usr/share/man' '--with-testdir=/usr/lib/xenomai/testsuite' '--with-core=cobalt' '--enable-smp' '--enable-pshared' '--enable-registry' '--build' 'x86_64-linux-gnu' 'build_alias=x86_64-linux-gnu'"
CONFIG_XENO_BUILD_STRING="x86_64-pc-linux-gnu"
CONFIG_XENO_COBALT=1
CONFIG_XENO_COMPILER="gcc version 4.9.2 (Debian 4.9.2-10) "
CONFIG_XENO_DEFAULT_PERIOD=100000
CONFIG_XENO_FORTIFY=1
CONFIG_XENO_HOST_STRING="x86_64-pc-linux-gnu"
CONFIG_XENO_LORES_CLOCK_DISABLED=1
CONFIG_XENO_PREFIX="/usr"
CONFIG_XENO_PSHARED=1
CONFIG_XENO_RAW_CLOCK_ENABLED=1
CONFIG_XENO_REGISTRY=1
CONFIG_XENO_REGISTRY_ROOT="/var/run/xenomai"
CONFIG_XENO_REVISION_LEVEL=0
CONFIG_XENO_SANITY=1
CONFIG_XENO_TLSF=1
CONFIG_XENO_TLS_MODEL="initial-exec"
CONFIG_XENO_UAPI_LEVEL=14
CONFIG_XENO_VERSION_MAJOR=3
CONFIG_XENO_VERSION_MINOR=0
CONFIG_XENO_VERSION_NAME="Exact Zero"
CONFIG_XENO_VERSION_STRING="3.0"
CONFIG_XENO_X86_VSYSCALL=1
---
CONFIG_XENO_ASYNC_CANCEL is OFF
CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED is OFF
CONFIG_XENO_DEBUG is OFF
CONFIG_XENO_DEBUG_FULL is OFF
CONFIG_XENO_LIBS_DLOPEN is OFF
CONFIG_XENO_MERCURY is OFF
CONFIG_XENO_VALGRIND_API is OFF
CONFIG_XENO_WORKAROUND_CONDVAR_PI is OFF
---
PTHREAD_STACK_DEFAULT=65536

Frederik


  reply	other threads:[~2015-10-14 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 10:22 [Xenomai] rt_heap_alloc size 0 - syscall 7 denied Frederik Bayart
2015-10-14 10:43 ` Philippe Gerum
2015-10-14 12:21   ` Frederik Bayart
2015-10-14 12:41     ` Philippe Gerum
2015-10-14 16:55       ` Frederik Bayart [this message]
2015-10-15  7:56         ` Philippe Gerum

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=145395888.622970.1444841737686.JavaMail.yahoo@mail.yahoo.com \
    --to=frederik_bayart@yahoo.co.uk \
    --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.