NetBSD Problem Report #47120
From www@NetBSD.org Wed Oct 24 16:37:40 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id B29E063E480
for <gnats-bugs@gnats.NetBSD.org>; Wed, 24 Oct 2012 16:37:39 +0000 (UTC)
Message-Id: <20121024163738.794AD63CA81@www.NetBSD.org>
Date: Wed, 24 Oct 2012 16:37:38 +0000 (UTC)
From: sdaoden@gmail.com
Reply-To: sdaoden@gmail.com
To: gnats-bugs@NetBSD.org
Subject: libc alloca(3) seems to fail
X-Send-Pr-Version: www-1.0
>Number: 47120
>Category: lib
>Synopsis: libc alloca(3) seems to fail
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 24 16:40:00 +0000 2012
>Last-Modified: Thu Oct 25 13:20:02 +0000 2012
>Originator: Steffen
>Release: 6.0
>Organization:
>Environment:
NetBSD nbsd6 6.0 NetBSD 6.0 (GENERIC) i386
(running an old VirtualBox: 4.1.8, r75467)
>Description:
When compiled in a way that gcc(1) builtin alloca() is used the program doesn't show any error, but if the libc version is used the returned buffer is trashed in an otherwise unmodified environment.
>How-To-Repeat:
Download S-nail(1), branch *next* (or http://sourceforge.net/projects/s-nail/files/s-nail-current.tar.gz/download).
Sorry but i don't know any other way to reproduce this error.
Run "$ make DESTDIR=bad CFLAGS='-O2 -std=c89' install; make distclean; make DESTDIR=good CFLAGS='-O3 -std=c89' install".
Run "$ MAILRC=/dev/null {bad,good}/usr/local/bin/s-nail -nf" and simply "p" the mail of the following minimal mailbox (any mail did in tests though):
From S-Postman Thu May 10 20:40:54 2012
From: <1234567890@abc.com>
To: <recei@ver.com>
Subject: Example mail
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
I agree it has nothing to do with tz, so wouldn't it have been more conside=
rate not to send it?
>Fix:
>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc:
Subject: Re: lib/47120: libc alloca(3) seems to fail
Date: Wed, 24 Oct 2012 13:44:33 -0400
On Oct 24, 4:40pm, sdaoden@gmail.com (sdaoden@gmail.com) wrote:
-- Subject: lib/47120: libc alloca(3) seems to fail
| >Number: 47120
| >Category: lib
| >Synopsis: libc alloca(3) seems to fail
| >Confidential: no
| >Severity: critical
| >Priority: high
| >Responsible: lib-bug-people
| >State: open
| >Class: sw-bug
| >Submitter-Id: net
| >Arrival-Date: Wed Oct 24 16:40:00 +0000 2012
| >Originator: Steffen
| >Release: 6.0
| >Organization:
| >Environment:
| NetBSD nbsd6 6.0 NetBSD 6.0 (GENERIC) i386
| (running an old VirtualBox: 4.1.8, r75467)
| >Description:
| When compiled in a way that gcc(1) builtin alloca() is used the program doesn't show any error, but if the libc version is used the returned buffer is trashed in an otherwise unmodified environment.
| >How-To-Repeat:
| Download S-nail(1), branch *next* (or http://sourceforge.net/projects/s-nail/files/s-nail-current.tar.gz/download).
| Sorry but i don't know any other way to reproduce this error.
|
| Run "$ make DESTDIR=bad CFLAGS='-O2 -std=c89' install; make distclean; make DESTDIR=good CFLAGS='-O3 -std=c89' install".
|
| Run "$ MAILRC=/dev/null {bad,good}/usr/local/bin/s-nail -nf" and simply "p" the mail of the following minimal mailbox (any mail did in tests though):
|
Looks like a compiler bug. Only affecting i386. -O0 -O2 breaks -O3 works.
On the other hand the code needs to be fixed to pass:
-Wall -Wmissing-prototypes -Wstrict-prototypes -Wextra -Wswitch -Wpointer-arith -Wshadow -Wcast-qual
and it does not.
christos
From: "T.SHIOZAKI" <tshiozak@bsdclub.org>
To: gnats-bugs@NetBSD.org, christos@zoulas.com
Cc: lib-bug-people@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org,
sdaoden@gmail.com
Subject: Re: lib/47120: libc alloca(3) seems to fail
Date: Thu, 25 Oct 2012 03:23:33 +0900 (JST)
> | Download S-nail(1), branch *next* (or http://sourceforge.net/projects/s-nail/files/s-nail-current.tar.gz/download).
> | Sorry but i don't know any other way to reproduce this error.
> |
> | Run "$ make DESTDIR=bad CFLAGS='-O2 -std=c89' install; make distclean; make DESTDIR=good CFLAGS='-O3 -std=c89' install".
> |
> | Run "$ MAILRC=/dev/null {bad,good}/usr/local/bin/s-nail -nf" and simply "p" the mail of the following minimal mailbox (any mail did in tests though):
> |
>
> Looks like a compiler bug. Only affecting i386. -O0 -O2 breaks -O3 works.
> On the other hand the code needs to be fixed to pass:
> -Wall -Wmissing-prototypes -Wstrict-prototypes -Wextra -Wswitch -Wpointer-arith -Wshadow -Wcast-qual
>
> and it does not.
Maybe -fomit-frame-pointer is implied. What about -fno-omit-frame-pointer?
---
Takuya SHIOZAKI
From: "Joerg Sonnenberger" <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47120 CVS commit: src/lib/libc
Date: Wed, 24 Oct 2012 20:14:56 +0000
Module Name: src
Committed By: joerg
Date: Wed Oct 24 20:14:56 UTC 2012
Modified Files:
src/lib/libc: shlib_version
Log Message:
Remove alloca when we get a chance to avoid issues like PR lib/47120.
With an modern optimising compiler, backend integration is necessary as
soon as frame pointers are optional.
To generate a diff of this commit:
cvs rdiff -u -r1.235 -r1.236 src/lib/libc/shlib_version
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: netbsd-bugs@netbsd.org, lib-bug-people@netbsd.org,
gnats-admin@netbsd.org
Subject: Re: lib/47120: libc alloca(3) seems to fail
Date: Wed, 24 Oct 2012 23:44:58 +0200
christos@zoulas.com (Christos Zoulas) wrote:
|| Run "$ make DESTDIR=bad CFLAGS='-O2 -std=c89' install; make distclean; \
|. make DESTDIR=good CFLAGS='-O3 -std=c89' install".
||
|| Run "$ MAILRC=/dev/null {bad,good}/usr/local/bin/s-nail -nf" and simply \
|. "p" the mail of the following minimal mailbox (any mail did in tests \
|. though):
|
| Looks like a compiler bug. Only affecting i386. -O0 -O2 breaks -O3 works.
| On the other hand the code needs to be fixed to pass:
| -Wall -Wmissing-prototypes -Wstrict-prototypes -Wextra -Wswitch \
|-Wpointer-arith -Wshadow -Wcast-qual
|
| and it does not.
And suddenly,
-pedantic is not half the -pedantic it used to be...
there's a shadow hanging over me...
oh, i can no longer believe..
in -pedanticI
| christos
--steffen
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, sdaoden@gmail.com
Cc:
Subject: Re: lib/47120: libc alloca(3) seems to fail
Date: Wed, 24 Oct 2012 18:29:29 -0400
On Oct 24, 9:50pm, sdaoden@gmail.com (Steffen "Daode" Nurpmeso) wrote:
-- Subject: Re: lib/47120: libc alloca(3) seems to fail
We've been discussing this issue programs that use alloca(3) should use
the compiler-supplied version not the libc supplied one. I've added a warning
about uses of alloca(3) from libc so in current, programs that use the libc
alloca(3) will get a warning. I've also updated the man page for alloca(3).
christos
From: Steffen "Daode" Nurpmeso <sdaoden@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: netbsd-bugs@netbsd.org, lib-bug-people@netbsd.org,
gnats-admin@netbsd.org
Subject: Re: lib/47120: libc alloca(3) seems to fail
Date: Thu, 25 Oct 2012 15:16:57 +0200
christos@zoulas.com (Christos Zoulas) wrote:
|The following reply was made to PR lib/47120; it has been noted by GNATS.
|
|From: christos@zoulas.com (Christos Zoulas)
|To: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
| gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, sdaoden@gmail.com
|Cc:
|Subject: Re: lib/47120: libc alloca(3) seems to fail
|Date: Wed, 24 Oct 2012 18:29:29 -0400
|
| On Oct 24, 9:50pm, sdaoden@gmail.com (Steffen "Daode" Nurpmeso) wrote:
| -- Subject: Re: lib/47120: libc alloca(3) seems to fail
|
| We've been discussing this issue programs that use alloca(3) should use
| the compiler-supplied version not the libc supplied one. I've added a \
|warning
| about uses of alloca(3) from libc so in current, programs that use the \
|libc
| alloca(3) will get a warning. I've also updated the man page for \
|alloca(3).
|
| christos
Ok, i've switched mine to only look for __builtin_alloca() and
fall back to malloc(3) otherwise.
--steffen
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.