From: Jan Kiszka <jan.kiszka@web.de>
To: "Marc Strämke" <marc.straemke@eltropuls.de>,
"Gilles Chanteperdrix" <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Hang/Reboot when using CONFIG_CC_STACKPROTECTOR_REGULAR
Date: Fri, 01 May 2015 10:15:31 +0200 [thread overview]
Message-ID: <55433623.3000401@web.de> (raw)
In-Reply-To: <3872595.UY9zmVq9KM@eltrolinux48.eltroad.eltropuls>
On 2015-04-30 17:17, Marc Strämke wrote:
> Am Donnerstag, 30. April 2015, 17:14:42 schrieb Gilles Chanteperdrix:
>>> I compared the disassembly of xnarch_switch_to with and without the
>>> option
>>> set. That does like fine to me (even though i do not fully understand each
>>> line..). The CANARY_SWITCH gets inserted correctly in to the
>>> do_switch_threads inline function.
>>
>> I guess the next step is to look at what this *_REGULAR option adds
>> to CONFIG_CC_STACKPROTECTOR in the kernel code, and see if it does
>> not add something more to switch_to that we should add to
>> xnarch_switch_to.
>
> This will probably take a bit of time on my side...
>
> Thank you for your help Gilles, I might have something more to say or ask next
> week...
Reproduced and quickly debugged in KVM: The switch code was just broken
regarding argument numbering when the protector is on. This fixes it
(will push a patch soon):
diff --git a/kernel/cobalt/arch/x86/thread.c b/kernel/cobalt/arch/x86/thread.c
index 1b73b0d..2c2574a 100644
--- a/kernel/cobalt/arch/x86/thread.c
+++ b/kernel/cobalt/arch/x86/thread.c
@@ -57,12 +57,12 @@ static inline void do_switch_threads(struct xnarchtcb *out_tcb,
__asm__ __volatile__("pushfl\n\t"
"pushl %%ebp\n\t"
- "movl %6,%%ecx\n\t"
+ "movl %[spp_out_ptr],%%ecx\n\t"
"movl %%esp,(%%ecx)\n\t"
- "movl %7,%%ecx\n\t"
+ "movl %[ipp_out_ptr],%%ecx\n\t"
"movl $1f,(%%ecx)\n\t"
- "movl %8,%%ecx\n\t"
- "movl %9,%%edi\n\t"
+ "movl %[spp_in_ptr],%%ecx\n\t"
+ "movl %[ipp_in_ptr],%%edi\n\t"
"movl (%%ecx),%%esp\n\t"
"pushl (%%edi)\n\t"
__CANARY_SWITCH
@@ -76,10 +76,10 @@ static inline void do_switch_threads(struct xnarchtcb *out_tcb,
"+a"(outproc),
"+d"(inproc)
__CANARY_OUTPUT
- : "m"(out_tcb->spp),
- "m"(out_tcb->ipp),
- "m"(in_tcb->spp),
- "m"(in_tcb->ipp)
+ : [spp_out_ptr] "m"(out_tcb->spp),
+ [ipp_out_ptr] "m"(out_tcb->ipp),
+ [spp_in_ptr] "m"(in_tcb->spp),
+ [ipp_in_ptr] "m"(in_tcb->ipp)
__CANARY_INPUT
: "memory");
}
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150501/64ff7520/attachment.sig>
next prev parent reply other threads:[~2015-05-01 8:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-30 14:33 [Xenomai] Hang/Reboot when using CONFIG_CC_STACKPROTECTOR_REGULAR Marc Strämke
2015-04-30 14:41 ` Gilles Chanteperdrix
2015-04-30 14:44 ` Marc Strämke
2015-04-30 14:53 ` Gilles Chanteperdrix
2015-04-30 15:03 ` Marc Strämke
2015-04-30 15:12 ` Marc Strämke
2015-04-30 15:14 ` Gilles Chanteperdrix
2015-04-30 15:17 ` Marc Strämke
2015-05-01 8:15 ` Jan Kiszka [this message]
2015-05-02 15:31 ` Marc Strämke
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=55433623.3000401@web.de \
--to=jan.kiszka@web.de \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=marc.straemke@eltropuls.de \
--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.