Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 11 Jan 2021 22:31:21 +0530
From: Sagar Tiwari <fctorial@...il.com>
To: musl@...ts.openwall.com
Subject: 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:

<pre>
$ gdb out/sm
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

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 <msg1> "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 <msg1> "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]

</pre>

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.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.