The following reply was made to PR library/6182; it has been noted by GNATS. From: Mark Kettenis <mark.kettenis@xs4all.nl> To: henry@precheur.org Cc: gnats@openbsd.org, bugs@cvs.openbsd.org Subject: Re: library/6182: Bad catclose declaration cause corruption on amd64 Date: Sat, 4 Jul 2009 23:02:29 +0200 (CEST) > Date: Sat, 4 Jul 2009 13:17:27 -0700 > From: Henry Precheur <henry@precheur.org> > In src/lib/libc/nls/_catclose.c _catclose is declared this way: > > extern int _catclose(nl_catd); > > nl_catd is a type, but since the type is not declared in _catclose.c, > the compiler assumes that nl_catd is an integer. Eh, nl_catd is declared in <nl_types.h>, which is included right before that declaration. > Since pointers and integers have a different size on > amd64, it can cause corruptions on amd64. Here is a gdb backtrace > demonstrating the problem: > > #0 _catclose (catd=0x2) at /usr/src/lib/libc/nls/catclose.c:42 > No locals. > #1 0x000000020e7d95f8 in __num2string (num=2, sign=1, setid=1, > buf=0x20ec2dbe0 "No such file or directory", buflen=255, list=0x20e9f8940, max=91, > def=0x20e8f1019 "Unknown error: ") at /usr/src/lib/libc/string/strerror_r.c:106 > ret = 0 > len = 25 > catd = 0x202b1c020 > > catd value is not the same in strerror_r and _catclose. You're fooled by the fact that GCC generates incomplete debug information. GDB managed to stop inside the function prologue and at that point the stack slot that is going to hold the local copy of the catd argument isn't filled yet. If you step (2 times) to get out of the prologue and into the body of the function, you'll see that the catd value is the same after all. Cheers, Mark
| david | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Eric Sandeen | Re: [RFC] Heads up on sys_fallocate() |
| Filippos Papadopoulos | Re: INITIO scsi driver fails to work properly |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | [PATCH take 2] pkt_sched: Protect gen estimators under est_lock. |
| Natalie Protasevich | [BUG] New Kernel Bugs |
