unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug in stackchk.h
@ 2010-01-06 21:37 Ivan Shcherbakov
  2010-01-17 21:44 ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Shcherbakov @ 2010-01-06 21:37 UTC (permalink / raw)
  To: bug-guile

Hi, All,
 
There  is  a  bug  in  libguile/stackchk.h  file.  In some cases, when
integer  value of the stack pointer is less than stack checking limit,
false positives are produced.

The following code is responsible for the problem:
#  define SCM_STACK_OVERFLOW_P(s)\
   (SCM_STACK_PTR (s) \
    < (SCM_I_CURRENT_THREAD->base - SCM_STACK_LIMIT))

When SCM_I_CURRENT_THREAD->base < SCM_STACK_LIMIT holds,
the  last  part  of  the exception produces an overflow and the entire
expression holds even when no stack overflow occurs.

To fix the problem, the SCM_STACK_OVERFLOW() should be replaced by the
following one:

#  define SCM_STACK_OVERFLOW_P(s)\
   ((SCM_I_CURRENT_THREAD->base - SCM_STACK_PTR (s)) \
    > SCM_STACK_LIMIT)

This  ensures  that  the  difference  between  the  stack base and the
examined   local   variable   address  is  always  computed  correctly
regardless the integer value of the stack pointer.

-- 
Best Regards,
 Ivan Shcherbakov                     mailto:shcherbakov@eit.uni-kl.de
 TU Kaiserslautern, Germany
 Department of Real-Time Systems





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug in stackchk.h
  2010-01-06 21:37 bug in stackchk.h Ivan Shcherbakov
@ 2010-01-17 21:44 ` Neil Jerram
  2010-01-17 21:46   ` Ivan Shcherbakov
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Jerram @ 2010-01-17 21:44 UTC (permalink / raw)
  To: Ivan Shcherbakov; +Cc: bug-guile

Ivan Shcherbakov <shcherbakov@eit.uni-kl.de> writes:

> Hi, All,
>  
> There  is  a  bug  in  libguile/stackchk.h  file.  In some cases, when
> integer  value of the stack pointer is less than stack checking limit,
> false positives are produced.
>
> The following code is responsible for the problem:
> #  define SCM_STACK_OVERFLOW_P(s)\
>    (SCM_STACK_PTR (s) \
>     < (SCM_I_CURRENT_THREAD->base - SCM_STACK_LIMIT))
>
> When SCM_I_CURRENT_THREAD->base < SCM_STACK_LIMIT holds,
> the  last  part  of  the exception produces an overflow and the entire
> expression holds even when no stack overflow occurs.
>
> To fix the problem, the SCM_STACK_OVERFLOW() should be replaced by the
> following one:
>
> #  define SCM_STACK_OVERFLOW_P(s)\
>    ((SCM_I_CURRENT_THREAD->base - SCM_STACK_PTR (s)) \
>     > SCM_STACK_LIMIT)
>
> This  ensures  that  the  difference  between  the  stack base and the
> examined   local   variable   address  is  always  computed  correctly
> regardless the integer value of the stack pointer.

That all makes sense, but are you seeing this problem in practice?

Thanks,
        Neil




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug in stackchk.h
  2010-01-17 21:44 ` Neil Jerram
@ 2010-01-17 21:46   ` Ivan Shcherbakov
  0 siblings, 0 replies; 3+ messages in thread
From: Ivan Shcherbakov @ 2010-01-17 21:46 UTC (permalink / raw)
  To: Neil Jerram; +Cc: bug-guile

Hi, Neil,

>That all makes sense, but are you seeing this problem in practice?
Yes, it caused false positives on a MSYS (Windows) build of guile.

-- 
Best regards,
 Ivan Shcherbakov                     mailto:shcherbakov@eit.uni-kl.de
 TU Kaiserslautern, Germany
 Department of Real-Time Systems





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-17 21:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 21:37 bug in stackchk.h Ivan Shcherbakov
2010-01-17 21:44 ` Neil Jerram
2010-01-17 21:46   ` Ivan Shcherbakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).