From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] Handle SIGILL when kernel compiled without Xenomai.
Date: Mon, 22 Sep 2008 14:03:05 +0200 [thread overview]
Message-ID: <48D78979.6000902@domain.hid> (raw)
In-Reply-To: <48D776C5.1020209@domain.hid>
Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Hi,
>>>>
>>>> on some (all ?) platforms, we get a SIGILL when trying to emit the first
>>> I don't see this on x86, though.
>>>
>>>> Xenomai syscall, instead of the -ENOSYS return value. This patches
>>>> handles the SIGILL by printing an error message and exiting.
>>>>
>>>> Index: include/asm-generic/bits/bind.h
>>>> ===================================================================
>>>> --- include/asm-generic/bits/bind.h (revision 4175)
>>>> +++ include/asm-generic/bits/bind.h (working copy)
>>>> @@ -9,6 +9,7 @@
>>>> #include <signal.h>
>>>> #include <pthread.h>
>>>> #include <fcntl.h>
>>>> +#include <setjmp.h>
>>>> #include <sys/ioctl.h>
>>>> #include <sys/mman.h>
>>>> #include <asm/xenomai/syscall.h>
>>>> @@ -17,6 +18,8 @@ __attribute__ ((weak))
>>>> pthread_key_t xeno_current_key;
>>>> __attribute__ ((weak))
>>>> pthread_once_t xeno_init_current_key_once = PTHREAD_ONCE_INIT;
>>>> +__attribute__ ((weak))
>>>> +jmp_buf xeno_sigill_jmpbuf;
>>>>
>>>> __attribute__ ((weak))
>>>> void xeno_set_current(void)
>>>> @@ -99,13 +102,28 @@ static void unmap_sem_heap(unsigned long
>>>> }
>>>> #endif /* CONFIG_XENO_FASTSEM */
>>>>
>>>> +void __attribute__((weak)) xeno_sigill_handler(int sig)
>>>> +{
>>>> + siglongjmp(xeno_sigill_jmpbuf, 1);
>>>> +}
>>>> +
>>> Just one question: Can we safely assume that sigsetjmp&siglongjump are
>>> always available, also in uclibc environments e.g.?
>> Ok. We can use setjmp/longjmp and assume that only SIGILL is masked at
>> the longjmp call site ?
>
> Hmm, good question. But maybe this is a non-issue and sig{set|long}jmp
> is actually always available (these days). On first glance, ucLibc seems
> to have an implementation.
We can also manually save and restore the signal mask.
>
> Alternative idea: What about defining a common xenomai_does_not_exist
> service that warns and terminates? It could be called it both on ENOSYS
> and from the signal handler.
Yes, but in the xeno_bind_skin_opt case, we are expected to return a
status, and not exit. So, longjmp is the only way... Unless we accept to
exit in the SIGILL case.
--
Gilles.
prev parent reply other threads:[~2008-09-22 12:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-21 20:01 [Xenomai-core] Handle SIGILL when kernel compiled without Xenomai Gilles Chanteperdrix
2008-09-22 8:25 ` Philippe Gerum
2008-09-22 15:32 ` Gilles Chanteperdrix
2008-09-22 18:18 ` Gilles Chanteperdrix
2008-09-28 14:31 ` Philippe Gerum
2008-09-28 14:39 ` Gilles Chanteperdrix
2008-09-28 14:49 ` Philippe Gerum
2008-09-22 9:14 ` Jan Kiszka
2008-09-22 9:21 ` Gilles Chanteperdrix
2008-09-22 10:43 ` Jan Kiszka
2008-09-22 12:03 ` Gilles Chanteperdrix [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=48D78979.6000902@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@domain.hid \
--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.