Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 678612 - sys-libs/glibc: __chk_fail undefined
Summary: sys-libs/glibc: __chk_fail undefined
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-22 23:20 UTC by Luke-Jr
Modified: 2019-02-23 19:45 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2019-02-22 23:20:11 UTC
__chk_fail() is defined by LSB, and some "portable" binaries require it. For some reason that doesn't appear to be documented, Gentoo renames it to __stack_chk_fail, breaking compatibility with such binaries.

Is there a reason we can't have __chk_fail aliased to __stack_chk_fail? (Simply renaming it would probably break ABIs all over the place when upgrading..)
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2019-02-23 00:09:03 UTC
(In reply to Luke-Jr from comment #0)
> __chk_fail() is defined by LSB, and some "portable" binaries require it. For
> some reason that doesn't appear to be documented, Gentoo renames it to
> __stack_chk_fail, breaking compatibility with such binaries.

We'll need some evidence. Preferably as a build failure and 'emerge --info' output.

    $ nm -D /lib/libc.so.6 | fgrep __chk_fail
    0000000000117860 T __chk_fail
Comment 2 Luke-Jr 2019-02-23 03:11:47 UTC
(In reply to Sergei Trofimovich from comment #1)
> (In reply to Luke-Jr from comment #0)
> > __chk_fail() is defined by LSB, and some "portable" binaries require it. For
> > some reason that doesn't appear to be documented, Gentoo renames it to
> > __stack_chk_fail, breaking compatibility with such binaries.
> 
> We'll need some evidence. Preferably as a build failure and 'emerge --info'
> output.
> 
>     $ nm -D /lib/libc.so.6 | fgrep __chk_fail
>     0000000000117860 T __chk_fail

Might only apply with USE=hardened, from the looks of it.

The problematic patch is sys-libs/glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c which contains:

#ifdef GENTOO_SSP_HANDLER
void __stack_chk_fail(void)
#else
void __chk_fail(void)
#endif

There is no build failure. The problem is running foreign binaries. For example, http://bitcoinknots.org/files/0.17.x/0.17.1.knots20181229/bitcoin-0.17.1.knots20181229-x86_64-linux-gnu.tar.gz (or any other deterministic-built Bitcoin node binary).
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-02-23 10:16:55 UTC
(In reply to Luke-Jr from comment #2)
> (In reply to Sergei Trofimovich from comment #1)
> > (In reply to Luke-Jr from comment #0)
> > > __chk_fail() is defined by LSB, and some "portable" binaries require it. For
> > > some reason that doesn't appear to be documented, Gentoo renames it to
> > > __stack_chk_fail, breaking compatibility with such binaries.
> > 
> > We'll need some evidence. Preferably as a build failure and 'emerge --info'
> > output.
> > 
> >     $ nm -D /lib/libc.so.6 | fgrep __chk_fail
> >     0000000000117860 T __chk_fail
> 
> Might only apply with USE=hardened, from the looks of it.
> 
> The problematic patch is
> sys-libs/glibc/files/2.25/glibc-2.25-gentoo-chk_fail.c which contains:

Could be it. This change is not applied to stable non-masked glibc versions though.

> There is no build failure. The problem is running foreign binaries.

I still don't see 'emerge --info'. Runtime failure is also fine to post. LD_DEBUG=all <tool-to-run> should shouw missing bindings.
Comment 4 Luke-Jr 2019-02-23 19:45:10 UTC
Updating glibc seems to have resolve the issue.