From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 18374 invoked from network); 11 Jan 2021 17:01:37 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 11 Jan 2021 17:01:37 -0000 Received: (qmail 3288 invoked by uid 550); 11 Jan 2021 17:01:35 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3258 invoked from network); 11 Jan 2021 17:01:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=azfq8+7I0P3tsnsg+I2kreP6H39shDjbkh3oegjqWoc=; b=o2momk4qYhW84YgxVeUcyDfZXvvBalWTTvLYY3Ac4NjPEDIJFy2QfCcEagoHKcklQ2 48iX8bl/nDaFtzUNHmi6nOb4N6Yx1WOcJqU0uAmD+oYqO5LlNhRt4EWbyDZlGlzkDOXK eeBATZXNbSGOu5Ydn3qRuJqPsI9nVMlFlr4x8amO+i8g4rBy3meAwIc5lIEH8njI2jux PrFu9h1JVvijmmdRBc0zbsJQof1pFuBpiHQE9dc1PxREJBp+c20ajARF8PFLF08P5dKt uo0ktUKGU8I17OZUAOL1nyqbxCQBqh5diydxKWztw7aFG8YNyiUrAhEe2aFfeqdlSLeG LauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=azfq8+7I0P3tsnsg+I2kreP6H39shDjbkh3oegjqWoc=; b=Df9AQwvdlsGFf/A9Pnq+36QX6Gad5M4q+6GuhK+nv15wKSMhR8u/IlFgGkp716iMei ztnCpd7jadaRysGcBITnjgRJMw+gALoZMLy6rnJUAsotqiuwoGIeRhx6iRPKqUrZdouE lLCXCidaM+qvnPpu3ZNZ0B6bWSMEahV7vGkM2YTJcg3CdvNF5XfmFswzrHfFxbrmmMnE mVvL64GhAJqWih+O1FqXJPeJPAWWfhitK9bCEMRZURdXdNNkM/4pA+vequNCpyDA6uyE dtI5OQa4wHGnO8BfDk2O52o6ceyVo9Upsvo7i0TKjD5NVAvVgbXuKyZ6eldW5aZOTg0d h1Qg== X-Gm-Message-State: AOAM533/UulHD0piSHDnPoMHzfEAtks+VZWklQgNBUgpqxsX3Bl22Tbh lxE710Jpejf8Zs3Pfn4rHxCAQIu0aURDwHM1Cd2/89ixjQ== X-Google-Smtp-Source: ABdhPJxauhNdUOqliCk5pHVUXGUws0VWahJEqZh5sn4EqyyGqrkxNgq0Xanv41UxzZGdO33hfrwh+kvFe75LsmEBlaM= X-Received: by 2002:a05:600c:255:: with SMTP id 21mr554459wmj.69.1610384482899; Mon, 11 Jan 2021 09:01:22 -0800 (PST) MIME-Version: 1.0 From: Sagar Tiwari Date: Mon, 11 Jan 2021 22:31:21 +0530 Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" Subject: [musl] printf segfaults on recent musl versions Hi, Apologies if this isn't a support forum for musl. I couldn't find any such portal online. I'm trying to compile a program with musl libc. Dynamically linked version of this program works fine, but the statically linked version segfaults whenever `printf` is invoked. This is how a debugging session looks like:
$ gdb out/sm
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
    .

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from out/sm...
(gdb) b printf
Breakpoint 1 at 0x100ac: file src/stdio/printf.c, line 5.
(gdb) r
Starting program: /home/fctorial/src/pgs/c/out/sm

Breakpoint 1, printf (fmt=0x1004f  "hello world from printf\n")
at src/stdio/printf.c:5
5       {
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x000000000001010a in printf (fmt=0x1004f  "hello world from
printf\n") at src/stdio/printf.c:5
5       {
(gdb) quit
A debugging session is active.

        Inferior 1 [process 25984] will be killed.

Quit anyway? (y or n) EOF [assumed Y]

This issue appears when linking with recent musl versions (within an year). 1.0.0 doesn't have this issue. I can call other functions like 'rand', 'strlen' without any issue. `printf` and `puts` are segfaulting.