All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] native: A 32k stack is not always a 'reasonable' size
Date: Thu, 08 Jul 2010 12:09:55 +0200	[thread overview]
Message-ID: <4C35A3F3.6040005@domain.hid> (raw)
In-Reply-To: <4C35A2B3.9060606@domain.hid>

Gilles Chanteperdrix wrote:
> Philippe Gerum wrote:
>> On Thu, 2010-07-08 at 11:35 +0200, Gilles Chanteperdrix wrote:
>>> +       down_read(&mm->mmap_sem);
>>> +       if (find_vma(mm, addr) == find_vma(mm, regs->ARM_sp))
>>> +               printk(KERN_INFO "FCSE: process %u(%s) probably overflowed stack
>>>  at 0x%08lx.\n",
>>> +                      current->pid, current->comm, regs->ARM_pc);
>>> +       up_read(&mm->mmap_sem);
>>>
>> My understanding is that such code detects faulty references within the
>> _valid_ address space, typically when hitting a page guard area. But I
>> guess that this won't work when treading on stack memory outside of the
>> address space, e.g. below the red zone for instance, isn't it? AFAIU,
>> those things may happen when the heading space of preposterously large
>> stack-based objects are addressed.
> 
> Yes, exactly, but that would have been enough to detect Peter's problem.
> I thought gcc had an option to yell when the objects on stack grow
> beyond some size, but I can not find it.

The option is enabled by the kernel when enabling CONFIG_WARN_FRAME, and
is -Wframe-larger-than
It seems to require gcc 4.4 though.

-- 
					    Gilles.


  reply	other threads:[~2010-07-08 10:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06 19:25 [Xenomai-help] native: A 32k stack is not always a 'reasonable' size Peter Soetens
2010-07-07  9:06 ` Gilles Chanteperdrix
2010-07-07 20:57   ` Peter Soetens
2010-07-07 21:19     ` Gilles Chanteperdrix
2010-07-07 22:31       ` Peter Soetens
2010-07-07 23:08         ` Gilles Chanteperdrix
2010-07-08  8:37           ` Philippe Gerum
2010-07-08  8:58             ` Gilles Chanteperdrix
2010-07-08  9:31               ` Philippe Gerum
2010-07-08  9:35                 ` Gilles Chanteperdrix
2010-07-08  9:58                   ` Philippe Gerum
2010-07-08 10:04                     ` Gilles Chanteperdrix
2010-07-08 10:09                       ` Gilles Chanteperdrix [this message]
2010-07-08 11:52                     ` Gilles Chanteperdrix
2010-07-08  9:50               ` Philippe Gerum
2010-07-08  9:55                 ` Gilles Chanteperdrix
2010-07-08 10:19                   ` Philippe Gerum
2010-07-08 11:47                     ` Gilles Chanteperdrix
2010-07-08 15:01                       ` Philippe Gerum
2010-07-08 16:33                         ` Gilles Chanteperdrix
2010-07-11 13:15 ` Gilles Chanteperdrix

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=4C35A3F3.6040005@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=rpm@xenomai.org \
    --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.