Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95395 - Applications using ncurses segfault at startup
Summary: Applications using ncurses segfault at startup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Embedded Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-07 16:23 UTC by René Rhéaume (a.k.a. repzilon, rener)
Modified: 2005-09-05 13:38 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
strace output for top (strace.top.txt,3.96 KB, text/plain)
2005-06-07 16:25 UTC, René Rhéaume (a.k.a. repzilon, rener)
Details
strace output for nano (crashing) (strace.nano.txt,5.34 KB, text/plain)
2005-06-07 16:25 UTC, René Rhéaume (a.k.a. repzilon, rener)
Details
strace output for nano (not crashing) (strace.nano-2.txt,10.58 KB, text/plain)
2005-06-07 16:26 UTC, René Rhéaume (a.k.a. repzilon, rener)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description René Rhéaume (a.k.a. repzilon, rener) 2005-06-07 16:23:51 UTC
I updated ncurses to version 5.4-r6 on 2005-06-05. Since then, I cannot run top
at all and nano often refuses to start. I cannot explain why nano work sometimes.

Reproducible: Sometimes
Steps to Reproduce:
1. top; nano

Actual Results:  
The follwing was printed on the console:
Jun  6 18:09:40 [kernel] grsec: signal 11 sent to /bin/nano[nano:32435]
uid/euid:0/0 gid/egid:0/0, parent /bin/bash[bash:4683] uid/euid:0/0 gid/egid:0/0
Jun  6 18:09:40 [kernel] grsec: denied resource overstep by requesting 4096 for
RLIMIT_CORE against limit 0 for /bin/nano[nano:32435] uid/euid:0/0 gid/egid:0/0,
parent /bin/bash[bash:4683] uid/euid:0/0 gid/egid:0/0
Segmentation fault

Expected Results:  
Nano and top should start correctly.

Gentoo Base System version 1.4.16
Portage 2.0.51.19 (uclibc/x86/hardened, gcc-3.3.5-20050130, uclibc-0.9.27-r0,
2.4.30-hardened-r1 i686)
=================================================================
System uname: 2.4.30-hardened-r1 i686 AMD Athlon(tm) XP 2500+
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 21 2005, 20:49:38)]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.9.5, 1.7.9-r1, 1.5, 1.6.3, 1.4_p6, 1.8.5-r3
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.4.22-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-pipe -O2 -march=pentium3 -mcpu=athlon-xp -fomit-frame-pointer"
CHOST="i686-pc-linux-uclibc"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-pipe -O2 -march=pentium3 -mcpu=athlon-xp -fomit-frame-pointer
-fconserve-space"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache digest distlocks noclean nodoc
noinfo sandbox sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="http://gentoo.osuosl.org
http://www.ibiblio.org/pub/Linux/distributions/gentoo http://adelie.polymtl.ca/
http://gentoo.seren.com/gentoo ftp://gentoo.mirrors.tds.net/gentoo"
LANG="fr_CA"
LC_ALL="fr_CA"
LDFLAGS="-Wl,-O1 -Wl,--sort-common"
MAKEOPTS="-j2 -s"
PKGDIR="/usr/local/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="x86 16bit 3dfx 3dnow 3dnowext a52 aac apm asm async bidi bitmap-fonts
blender-game bmp bootsplash bzip2 cap cdparanoia cdr chroot cjk cracklib crypt
curl dga dhcp dlloader droproot dv dvd dvdr dvdread encode exif expat faad flac
ftp gatos gd-external gif glep gpm gtk2 hal hardened hardenedphp immqt-bc innodb
ipv6 jack jit jpeg justify kdeenablefinal kdexdeltas lcms libclamav lm_sensors
logitech-mouse lzw mad md5sum mdb minimal mmx mmx2 mozdevelop mozp3p mozsvg mp3
mpeg4 msn multicall native ncurses noplugin ogg oggvorbis openal oscar oss pcre
pdflib pic png posix readline sharedmem speex spell sql sqlite sse ssl
subversion svg svgz sysvipc tcpmd5 theora threads truetype truetype-fonts uclibc
ucs2 unicode usb userlocales utf8 v4l vanilla vim-pager voodoo3 vorbis xine xml2
xpm xrandr xscreensaver xv xvmc zlib userland_GNU kernel_linux elibc_uclibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LINGUAS
Comment 1 René Rhéaume (a.k.a. repzilon, rener) 2005-06-07 16:25:27 UTC
Created attachment 60806 [details]
strace output for top
Comment 2 René Rhéaume (a.k.a. repzilon, rener) 2005-06-07 16:25:54 UTC
Created attachment 60807 [details]
strace output for nano (crashing)
Comment 3 René Rhéaume (a.k.a. repzilon, rener) 2005-06-07 16:26:16 UTC
Created attachment 60808 [details]
strace output for nano (not crashing)
Comment 4 René Rhéaume (a.k.a. repzilon, rener) 2005-06-07 16:28:46 UTC
I also tried to downgrade to ncurses 5.4-r5 and it did not work. Maybe it is
related to the GCC update I performed on the same day.
Comment 5 SpanKY gentoo-dev 2005-06-07 18:30:24 UTC
drop the unicode stuff and rebuild ncurses/nano/etc...
Comment 6 René Rhéaume (a.k.a. repzilon, rener) 2005-06-10 03:04:49 UTC
I emerged ncurses without unicode, then nano and it still segfaulted most of the
time.

I consider my system as broken. I will format the root partition this weekend
and go through the 3 stages again :-(. This time, I will enforce the following
rule: anything that has bootstrap or build in their IUSE must NEVER be
re-emerged again.
Comment 7 SpanKY gentoo-dev 2005-08-30 22:21:04 UTC
ok i found the issue

nano passes (size_t)-1 to strncmp() as the length parameter in its internal
history routines

default uClibc build enables arch-specific optimized string functions

the i386-optimized strncmp function starts off with a 'js count'

count here is an unsigned 0xFFFFFFFF ... however, the asm interprets that as a
signed value and hence the sign bit is set ... so the first thing strncmp() does
is check the sign bit and if it is set, exit and return 0

since nano relies on the value of strncmp to determine what to do with its
memory and strncmp is always returning true, it starts to dereference memory
incorrectly and kill itself

workaround atm is to disable arch-specific optimized string functions
Comment 8 SpanKY gentoo-dev 2005-09-05 00:35:21 UTC
fixed in cvs
Comment 9 Brian Jackson (RETIRED) gentoo-dev 2005-09-05 13:38:08 UTC
yay, it's fixed

/me humps spanky