public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Winchester <kjwinchester@gmail.com>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: linux-next: WARNING: at kernel/panic.c:375 __stack_chk_test+0x50/0x54()
Date: Thu, 01 May 2008 19:37:42 -0300	[thread overview]
Message-ID: <481A4636.8050209@gmail.com> (raw)
In-Reply-To: <20080430002727.00db8e63@linux.intel.com>

Arjan van de Ven wrote:
> On Wed, 30 Apr 2008 21:24:27 -0300
> Kevin Winchester <kjwinchester@gmail.com> wrote:
> 
>> Arjan van de Ven wrote:
>>> Kevin Winchester wrote:
>>>> Hi Arjan,
>>>>
>>>> There doesn't seem to be an entry in MAINTAINERS for stack
>>>> protector, but your signoff was on the last stack protector
>>>> related commit I could find, so it's probably a good bet.
>>>>
>>>> I get the following in my dmesg after testing linux-next with the
>>>> stack protector turned on.  This is an x86-64 UP box if that
>>>> helps.  It appears to be related to the test for the feature (or
>>>> perhaps that is supposed to happen when the feature is tested, I'm
>>>> not sure...).  Config below.
>>>>
>>> the important question is: exactly what gcc are you using? (and if
>>> you use a distro gcc, which distro)
>>>
>>> second question would be, what does the following command give?
>>>
>>> echo "int foo(void) { char X[200]; return 3; }" | $1 -S -xc -c -O0
>>> -mcmodel=kernel -fstack-protector - -o -
>>>
>>> (this is the command from scripts/gcc-x86_64-has-stack-protector.sh
>>> that the kernel uses to test at compiletime if you have stack
>>> protector support)
>> Ubuntu Hardy Heron
>>
>> kevin@alekhine:~$ gcc --version
>> gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
>> Copyright (C) 2007 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There
>> is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
>> PARTICULAR PURPOSE.
>>
>>
>> kevin@alekhine:~$ echo "int foo(void) { char X[200]; return 3; }" |
>> $1 -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - bash: -S:
>> command not found
>>
>> I assume that $1 was supposed to be gcc, so how about:
> 
> eh woops yes
> 
>> kevin@alekhine:~/linux/linux-2.6/scripts$ sh
>> gcc-x86_64-has-stack-protector.sh gcc something something
>>
>> So I would assume that means I pass...
> 
> 
> I would rather really like to see the assembly output this thing spits; to see if your compiler behaves sanely.
> (Some distros tend to badly patch their gcc unfortunately and this may break the stack protector feature)

Sure, here we go:

kevin@alekhine:~$ echo "int foo(void) { char X[200]; return 3; }" | gcc -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o -
        .file   ""
        .text
.globl foo
        .type   foo, @function
foo:
.LFB2:
        pushq   %rbp
.LCFI0:
        movq    %rsp, %rbp
.LCFI1:
        subq    $208, %rsp
.LCFI2:
        movq    %gs:40, %rax
        movq    %rax, -8(%rbp)
        xorl    %eax, %eax
        movl    $3, %eax
        movq    -8(%rbp), %rdx
        xorq    %gs:40, %rdx
        je      .L3
        call    __stack_chk_fail
.L3:
        leave
        ret
.LFE2:
        .size   foo, .-foo
        .section        .eh_frame,"a",@progbits
.Lframe1:
        .long   .LECIE1-.LSCIE1
.LSCIE1:
        .long   0x0
        .byte   0x1
        .string ""
        .uleb128 0x1
        .sleb128 -8
        .byte   0x10
        .byte   0xc
        .uleb128 0x7
        .uleb128 0x8
        .byte   0x90
        .uleb128 0x1
        .align 8
.LECIE1:
.LSFDE1:
        .long   .LEFDE1-.LASFDE1
.LASFDE1:
        .long   .LASFDE1-.Lframe1
        .quad   .LFB2
        .quad   .LFE2-.LFB2
        .byte   0x4
        .long   .LCFI0-.LFB2
        .byte   0xe
        .uleb128 0x10
        .byte   0x86
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI1-.LCFI0
        .byte   0xd
        .uleb128 0x6
        .align 8
.LEFDE1:
        .ident  "GCC: (GNU) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)"
        .section        .note.GNU-stack,"",@progbits

Does that help?

-- 
Kevin Winchester

  reply	other threads:[~2008-05-01 22:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-30 23:58 linux-next: WARNING: at kernel/panic.c:375 __stack_chk_test+0x50/0x54() Kevin Winchester
2008-05-01  0:01 ` Arjan van de Ven
2008-05-01  0:24   ` Kevin Winchester
2008-04-30  7:27     ` Arjan van de Ven
2008-05-01 22:37       ` Kevin Winchester [this message]
2008-05-01 11:33         ` Arjan van de Ven
2008-05-03 23:22           ` Kevin Winchester
2008-05-06 19:49             ` Arjan van de Ven
2008-05-06 20:34               ` David Miller
2008-05-06 23:09                 ` Kevin Winchester
2008-05-06 23:10                   ` Arjan van de Ven
2008-05-06 23:32                   ` Arjan van de Ven
2008-05-06 23:35                     ` Kevin Winchester
2008-05-06 23:38                       ` Arjan van de Ven

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=481A4636.8050209@gmail.com \
    --to=kjwinchester@gmail.com \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox