[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#865469: marked as done (libc6-dev: a program crashes if it is statically linked against OpenSSL)



Your message dated Tue, 6 Sep 2022 21:13:03 +0200
with message-id <YxebvzA9e+CbycA4@aurel32.net>
and subject line Re: Bug#865469: libc6-dev: a program crashes if it is statically linked against OpenSSL
has caused the Debian Bug report #865469,
regarding libc6-dev: a program crashes if it is statically linked against OpenSSL
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
865469: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865469
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-dev
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

Programs can't be statically linked against OpenSSL in Debian Stretch.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Try to compile this program with this command:
gcc -static hello.c -lssl -lcrypto -ldl -pthread

#include <stdio.h>
#include <stdlib.h>
#include <openssl/ssl.h>

int main(void)
{
        OpenSSL_add_ssl_algorithms();
        printf("Hello World!\n");
        return 0;
}

   * What was the outcome of this action?

If you run the statically linked program, you get a crash in glibc startup
code:
#0  0x0000000000000000 in ?? ()
#1  0x00000000006296c6 in __register_frame_info.part.4 ()
#2  0x00000000004017fd in frame_dummy ()
#3  0x000000000058c2d7 in __libc_csu_init ()
#4  0x000000000058b95b in generic_start_main ()
#5  0x000000000058bc3e in __libc_start_main ()
#6  0x000000000040172a in _start ()

   * What outcome did you expect instead?

The compiled program should work.



-- System Information:
Debian Release: 9.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.72 (SMP w/12 CPU cores; PREEMPT)
Locale: LANG=cs_CZ.utf8, LC_CTYPE=cs_CZ.utf8 (charmap=UTF-8), LANGUAGE=cs_CZ.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

--- End Message ---
--- Begin Message ---
Version: 2.34-1

On 2017-08-20 19:12, Aurelien Jarno wrote:
> control: forcemerge 872727 -1
> 
> On 2017-06-21 20:48, Mikulas Patocka wrote:
> > Package: libc6-dev
> > Severity: normal
> > 
> > Dear Maintainer,
> > 
> > *** Reporter, please consider answering these questions, where appropriate ***
> > 
> >    * What led up to the situation?
> > 
> > Programs can't be statically linked against OpenSSL in Debian Stretch.
> > 
> >    * What exactly did you do (or not do) that was effective (or
> >      ineffective)?
> > 
> > Try to compile this program with this command:
> > gcc -static hello.c -lssl -lcrypto -ldl -pthread
> > 
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <openssl/ssl.h>
> > 
> > int main(void)
> > {
> >         OpenSSL_add_ssl_algorithms();
> >         printf("Hello World!\n");
> >         return 0;
> > }
> > 
> >    * What was the outcome of this action?
> > 
> > If you run the statically linked program, you get a crash in glibc startup
> > code:
> > #0  0x0000000000000000 in ?? ()
> > #1  0x00000000006296c6 in __register_frame_info.part.4 ()
> > #2  0x00000000004017fd in frame_dummy ()
> > #3  0x000000000058c2d7 in __libc_csu_init ()
> > #4  0x000000000058b95b in generic_start_main ()
> > #5  0x000000000058bc3e in __libc_start_main ()
> > #6  0x000000000040172a in _start ()
> > 
> >    * What outcome did you expect instead?
> > 
> > The compiled program should work.
> 
> This is an upstream issue, due to two changes:
> 1) libssl is now linked with pthread
> 2) libssl now try to run getaddrinfo or gethostbyname
> 
> This trigger the following bug:
> https://sourceware.org/bugzilla/show_bug.cgi?id=21975
> 
> As a workaround you might want to link your binary against libssl1.0
> instead and without -pthread.

Since glibc 2.34, libpthread has been integrated into libc. As a side
effect this fixes this bug. I am therefore closing this bug.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: