Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Apr 2012 00:02:13 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        Jeremie Le Hen <jlh@FreeBSD.org>
Cc:        vd@FreeBSD.org, johans@FreeBSD.org, Juergen Lock <nox@jelal.kn-bremen.de>, freebsd-ports@FreeBSD.org
Subject:   Re: -fstack-protector again (rpm4, BROKEN textproc/libextractor)
Message-ID:  <20120428220213.GA95932@triton8.kn-bremen.de>
In-Reply-To: <20120428214610.GC27994@felucia.tataz.chchile.org>
References:  <20111209175652.GA27334@triton8.kn-bremen.de> <20120428214610.GC27994@felucia.tataz.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 28, 2012 at 11:46:10PM +0200, Jeremie Le Hen wrote:
> Hi Juergen,
Hi!
> 
> Please Cc: me when replying.
> 
> On Fri, Dec 09, 2011 at 06:56:52PM +0100, Juergen Lock wrote:
> > Hi!
> > 
> >  I got a report that textproc/libextractor was marked BROKEN on
> > i386 which one of my ports uses, so with the help of swill's tb
> > (I don't really use i386 myself here anymore so thanx for that :)
> > I took a look.  The failed libextractor log seem to be this one:
> > 
> > 	http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/e.8.20110914141638/libextractor-0.6.2_4.log
> > 
> >  The problem:
> > 
> > [...]
> > checking for rpmReadPackageFile in -lrpm... no
> > [...]
> > ===>  Building package for libextractor-0.6.2_4
> > tar: lib/libextractor/libextractor_rpm.la: Cannot stat: No such file or directory
> > tar: lib/libextractor/libextractor_rpm.so: Cannot stat: No such file or directory
> > tar: Error exit delayed from previous errors.
> > pkg_create: make_dist: tar command failed with code 256
> > *** Error code 1
> > [...]
> > 
> >  The config.log from swill's tb reveals:
> > 
> > [...]
> > configure:19183: checking for rpmReadPackageFile in -lrpm
> > configure:19208: cc -o conftest -fno-strict-aliasing -O2 -pipe -fno-strict-alias
> > ing -I/usr/local/include  -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib/qt4
> >  conftest.c -lrpm   >&5
> > /usr/local/lib/librpm.so: undefined reference to `__stack_chk_fail_local'
> > configure:19208: $? = 1
> > configure: failed program was:
> > | /* confdefs.h */
> > | #define PACKAGE_NAME "libextractor"
> > | #define PACKAGE_TARNAME "libextractor"
> > | #define PACKAGE_VERSION "0.6.2"
> > | #define PACKAGE_STRING "libextractor 0.6.2"
> > | #define PACKAGE_BUGREPORT "bug-libextractor@gnu.org"
> > | #define PACKAGE_URL ""
> > | #define PACKAGE "libextractor"
> > | #define VERSION "0.6.2"
> > | #define STDC_HEADERS 1
> > | #define HAVE_SYS_TYPES_H 1
> > | #define HAVE_SYS_STAT_H 1
> > | #define HAVE_STDLIB_H 1
> > | #define HAVE_STRING_H 1
> > | #define HAVE_MEMORY_H 1
> > | #define HAVE_STRINGS_H 1
> > | #define HAVE_INTTYPES_H 1
> > | #define HAVE_STDINT_H 1
> > | #define HAVE_UNISTD_H 1
> > | #define __EXTENSIONS__ 1
> > | #define _ALL_SOURCE 1
> > | #define _GNU_SOURCE 1
> > | #define _POSIX_PTHREAD_SEMANTICS 1
> > | #define _TANDEM_SOURCE 1
> > | #define HAVE_DLFCN_H 1
> > | #define LT_OBJDIR ".libs/"
> > | #define LT_MODULE_EXT ".so"
> > | #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH"
> > | #define LT_DLSEARCH_PATH "/lib:/usr/lib"
> > | #define HAVE_LIBDL 1
> > | #define HAVE_DLERROR 1
> > | #define HAVE_LIBDLLOADER 1
> > | #define error_t int
> > | #define __error_t_defined 1
> > | #define HAVE_PRELOADED_SYMBOLS 1
> > | #define HAVE_LTDL 1
> > | #define HAVE_UNISTD_H 1
> > | #define HAVE_DIRENT_H 1
> > | #define HAVE_CLOSEDIR 1
> > | #define HAVE_OPENDIR 1
> > | #define HAVE_READDIR 1
> > | #define HAVE_STRLCAT 1
> > | #define HAVE_STRLCPY 1
> > | #define LT_LIBEXT "a"
> > | #define SOMEBSD 1
> > | #define HAVE_LIBC_R 1
> > | #define HAVE_ICONV 1
> > | #define ICONV_CONST const
> > | #define LOCALEDIR "/usr/local/share/locale"
> > | #define ISOLOCALEDIR "/usr/share/locale"
> > | #define HAVE_FSEEKO 1
> > | #define HAVE_LIBSTDC__ 1
> > | #define HAVE_LANGINFO_H 1
> > | #define HAVE_VORBIS_VORBISFILE_H 1
> > | #define HAVE_VORBISFILE 1
> > | #define HAVE_FLAC_ALL_H 1
> > | #define HAVE_FLAC 1
> > | #define HAVE_FLAC 1
> > | #define HAVE_ZLIB_H 1
> > | #define HAVE_ZLIB 1
> > | #define HAVE_BZLIB_H 1
> > | #define HAVE_LIBBZ2 1
> > | /* end confdefs.h.  */
> > | 
> > | /* Override any GCC internal prototype to avoid an error.
> > |    Use char because int might match the return type of a GCC
> > |    builtin and then its argument prototype would still apply.  */
> > | #ifdef __cplusplus
> > | extern "C"
> > | #endif
> > | char rpmReadPackageFile ();
> > | int
> > | main ()
> > | {
> > | return rpmReadPackageFile ();
> > |   ;
> > |   return 0;
> > | }
> > configure:19217: result: no
> > [...]
> > 
> >  So the problem is this:
> > 
> > /usr/local/lib/librpm.so: undefined reference to `__stack_chk_fail_local'
> > 
> > which according to list archives happens/can happen [1] when one
> > links code built with -fstack-protector to code that wasn't, and
> > archivers/rpm4's configure script autodetects that the compiler
> > supports -fstack-protector and then proceeds to using it:
> > 
> > [...]
> > checking supported compiler flags... 
> >    -fno-strict-aliasing
> >    -fstack-protector
> > checking for special C compiler options needed for large files... no
> > [...]
> > 
> >  ..while libextractor's doesn't.  So I came up with this (untested)
> > patch for archivers/rpm4: (maintainers Cc'd, of course we'd want a
> > PORTREVISION bump there too.)
> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /home/pcvs/ports/archivers/rpm4/Makefile,v
> > retrieving revision 1.38
> > diff -u -p -r1.38 Makefile
> > --- Makefile	7 Oct 2011 14:33:17 -0000	1.38
> > +++ Makefile	9 Dec 2011 17:24:09 -0000
> > @@ -101,6 +101,16 @@ LIB_DEPENDS+=	lzma:${PORTSDIR}/archivers
> >  .endif
> >  
> >  post-patch:
> > +# disable -fstack-protector on i386 as that causes librpm clients
> > +# not using -fstack-protector faling to link there, like the autoconf
> > +# check in textproc/libextractor:
> > +#	http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/e.8.20110914141638/libextractor-0.6.2_4.log
> > +#	[...] checking for rpmReadPackageFile in -lrpm... no [...]
> > +# (for some reason only 8/i386 is affected, 7/i386 and 8/amd64 are not.)
> > +.if ${ARCH} == "i386"
> > +	${REINPLACE_CMD} -e '/cflags_to_try=/s/-fstack-protector//' \
> > +		${WRKSRC}/configure
> > +.endif
> >  	${REINPLACE_CMD} -e '/^pkgconfigdir/s:/:data/:' \
> >  		-e 's:\.\./\.\./bin/::' ${WRKSRC}/Makefile.in
> >  	${REINPLACE_CMD} -e 's/(hpux)/& || defined(__FreeBSD__)/' \
> > 
> >  Thoughts?  (Or should something like that even be done globally in
> > Mk/ since there are surely more ports affected?)
> 
> Sorry I'm not subscribed to the -ports@ mailing-list.  I knew that this
> problem existed but I wasn't aware of any occurence of it.
> 
> I think this patch could solve the problem, I intend to commit it to head
> in the next days.
> 
>     http://people.freebsd.org/~jlh/libc_ssp_nonshared.diff
> 
> 
> > PS: [1] for some reason only 8/i386 is affected, 7/i386 and 8/amd64 are not.
> 
> I don't know why amd64 doesn't have the problem though.
> 
> 
> According to the subject, it seems it's not the first time it occured.
> Can you point other occurences of this?

Back when I looked at this I searched the list archives for
__stack_chk_fail_local and got several hits:

	http://freebsd.markmail.org/search/?q=__stack_chk_fail_local+order%3Adate-backward

 So the patch would be very welcome I suppose... :)

	Juergen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120428220213.GA95932>