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,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13805 invoked from network); 10 Jan 2024 15:59:45 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 10 Jan 2024 15:59:45 -0000 Received: (qmail 5263 invoked by uid 550); 10 Jan 2024 15:58:10 -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 5227 invoked from network); 10 Jan 2024 15:58:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704902371; x=1705507171; darn=lists.openwall.com; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=+OLP/z16vJGE71K7JfsMULgpfSVvat3XQy66NFs7UgY=; b=iVLN+G1C7tfj2343QHPet8ZFvro00EBhj5YRVcIyqiY/DZ9nuSHeEhmBEMbRNGZp3Y fd4l3iwSy/437i87pDhYMkFKIysU4M2X9ybfelxHL+NzoN7LM4kdjJ4dLx6wTl4lbUdD q4smgMsoRYOJPNVLadvz8sSCTE2dDg/nymC+DDg6a8nqq4KZMNFPM9seCI62HT80v/HZ r+7Rx0Mrv2aWdiLIsDifvhAODI2hdTQORZ71BaWlhsdjNO2vsXy+O3ZvLKl+/S8p2ZAI PdaLzS3PLOFtZp/FwzZtd4Xbf5imFJ0M3++GItNMmADRDecoJwyGNJgicSD7iArPU6k0 EJSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704902371; x=1705507171; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+OLP/z16vJGE71K7JfsMULgpfSVvat3XQy66NFs7UgY=; b=VdDAD2cWBhpWnfz9AZNfWtjLpcglZMG+JUE+4EdE5G8KcBl9+ZfhegzLVEHU6atAs7 kA8tD9+RjQfBDbYTSPoqiPKhNmUARF9JqiXemztoHe17kxpPAfkeERBj/LxW+P01lqpz UQtst6tUaS8ZWC3oHxlxEZW8pIT/IozPWiRbN5gTIxp3XTkOqJWgORVK3KoYjl953iCS e7RcUkPxtvBlPs916B67pJN2Ski6b3w8xubwzv9PWcT7whfr7Wxei41ksPuq0tC4/O7G 2+EXfg+KmzpDAaf5iXz3YJITpZ3tCt1QtzjUOu7dqfdaAdg8drGGL9JMDBYTi/2JN1R6 7uiQ== X-Gm-Message-State: AOJu0YyGvS1uRyHeXFDX/5WY/JGEBCNXzxDe5K1oGkofN0m8fV84J2Da 7upyQxaVNXStofu0lf3d2HP+tpzC59IgzMjevSo= X-Google-Smtp-Source: AGHT+IFFhh4f/ze5UW3fcHga7yNa5b0B/wcYvvEHW9SpudRQPVqsZGOqdcK34Hath8UrVACcB1xTObcWCrLNiIGhAWc= X-Received: by 2002:a25:ac18:0:b0:dbd:a328:1c2f with SMTP id w24-20020a25ac18000000b00dbda3281c2fmr1127421ybi.41.1704902371110; Wed, 10 Jan 2024 07:59:31 -0800 (PST) MIME-Version: 1.0 References: <20231221222513.799557a1@ncopa-desktop.lan> <20240104144811.GO1427497@port70.net> In-Reply-To: <20240104144811.GO1427497@port70.net> From: Cody Wetzel Date: Wed, 10 Jan 2024 09:59:18 -0600 Message-ID: To: Cody Wetzel , Natanael Copa , musl@lists.openwall.com, Markus Wichmann Content-Type: multipart/alternative; boundary="00000000000034f144060e998488" Subject: Re: [musl] Segmentation fault musl 1.2.4 --00000000000034f144060e998488 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable So maybe I'm not understanding how gdb works or is used. I'm getting no meaningful output even though these commands should result in a segmentation fault. > / # gdb > Segmentation fault > / # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args ls -l /tmp > GNU gdb (GDB) 12.1 > Copyright (C) 2022 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 "armv7-alpine-linux-musleabihf". > 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 ls... > (No debugging symbols found in ls) > (gdb) > quit > / # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args cd /tmp > GNU gdb (GDB) 12.1 > Copyright (C) 2022 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 "armv7-alpine-linux-musleabihf". > 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"... > cd: No such file or directory. > (gdb) > quit > / # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args apk -h /tmp > GNU gdb (GDB) 12.1 > Copyright (C) 2022 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 "armv7-alpine-linux-musleabihf". > 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 apk... > (No debugging symbols found in apk) > (gdb) bt > No stack. > (gdb) disas $pc-40,+80 > No registers. > (gdb) info reg > The program has no registers now. On Thu, Jan 4, 2024 at 8:48=E2=80=AFAM Szabolcs Nagy wrote= : > * Cody Wetzel [2024-01-03 11:20:29 -0600]: > > Hello musl team, > > > > I tried getting a core dump but I'm not sure if I'm doing something > wrong... > > > > / # cat /proc/sys/kernel/core_pattern/tmp/core-%e-%s-%u-%g-%p-%t/ # > > apk upgrade busybox > > --repository=3Dhttps://dl-cdn.alpinelinux.org/alpine/v3.18/main > > --repository=3Dhttps://dl-cdn.alpinelinux.org/alpine/v3.18/communityfet= ch > > > https://dl-cdn.alpinelinux.org/alpine/v3.18/community/armv7/APKINDEX.tar.= gzfetch > > > https://dl-cdn.alpinelinux.org/alpine/v3.18/main/armv7/APKINDEX.tar.gzfet= ch > > > https://dl-cdn.alpinelinux.org/alpine/v3.17/main/armv7/APKINDEX.tar.gzfet= ch > > > https://dl-cdn.alpinelinux.org/alpine/v3.17/community/armv7/APKINDEX.tar.= gz(1/3) > > Upgrading busybox (1.35.0-r29 -> 1.36.1-r5)Executing > > busybox-1.36.1-r5.post-upgrade(2/3) Upgrading busybox-binsh > > (1.35.0-r29 -> 1.36.1-r5)(3/3) Upgrading ssl_client (1.35.0-r29 -> > > 1.36.1-r5)Executing busybox-1.36.1-r5.triggerOK: 5 MiB in 15 packages/ > > # apk upgrade musl > > --repository=3Dhttps://dl-cdn.alpinelinux.org/alpine/v3.18/main > > --repository=3Dhttps://dl-cdn.alpinelinux.org/alpine/v3.18/community(1/= 1) > > Upgrading musl (1.2.3-r5 -> 1.2.4-r2)OK: 5 MiB in 15 packages/ # apk > > upgrade rust --repository=3D > https://dl-cdn.alpinelinux.org/alpine/v3.18/main > > --repository=3D > https://dl-cdn.alpinelinux.org/alpine/v3.18/communitySegmentation > > fault/ # apk -hSegmentation fault/ # ls /tmp/core*Segmentation fault/ > > # cd /tmp/tmp # lsSegmentation fault > > i'd > > # cp /lib/ld-musl-armhf.so.1 /tmp > # apk add gdb musl-dbg apk-tools-static > > then upgrade musl using apk.static, then debug via > > # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args ls -l /tmp > > or analyze a core dump, you can always install more debug tools > via apk.static and run commands using the old ld-musl-armhf.so.1 > > in gdb, you want to do > > bt > disas $pc-40,+80 > info reg > info proc map > > as a starting point and post the results. > > strace output can be useful too as well as readelf -aW of ld.so > depending on what is going on. > --=20 Cody Wetzel codyawetzel@gmail.com (402)490-9242 --00000000000034f144060e998488 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

So maybe I'm not understanding how gdb= works or is used. I'm getting no meaningful output even though these = commands should result in a segmentation fault.

/ # gdb
= Segmentation= fault
/ # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args ls -l /tm= p
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Softwa= re Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later= <http://gnu.org/licenses/g= pl.html>
This is free software: you are free to change an= d redistribute it.
There is NO WARRANTY, to the extent permitted= by law.
Type "show copying" and "show warranty&q= uot; for details.
This GDB was configured as "armv7-alpine= -linux-musleabihf".
Type "show configuration" fo= r configuration details.
For bug reporting instructions, please= see:
<ht= tps://www.gnu.org/software/gdb/bugs/>.
Find the GDB manu= al and other documentation resources online at:
<http://www.gnu.org/soft= ware/gdb/documentation/>.
For help, type "help".
Type "apropos word"= ; to search for commands related to "word"...
Reading= symbols from ls...
(No debugging symbols found in ls)
(gdb)
quit
/ # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args cd /tmp<= br>GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software= Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &l= t;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&q= uot; for details.
This GDB was configured as "armv7-alpine= -linux-musleabihf".
Type "show configuration" fo= r configuration details.
For bug reporting instructions, please= see:
<ht= tps://www.gnu.org/software/gdb/bugs/>.
Find the GDB manu= al and other documentation resources online at:
<http://www.gnu.org/soft= ware/gdb/documentation/>.
For help, type "help".
Type "apropos word"= ; to search for commands related to "word"...
cd: No = such file or directory.
(gdb)
quit
/ # /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args apk -h /= tmp
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Soft= ware Foundation, Inc.
License GPLv3+: GNU GPL version 3 or late= r <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 permi= tted by law.
Type "show copying" and "show warra= nty" for details.
This GDB was configured as "armv7-a= lpine-linux-musleabihf".
Type "show configuration&quo= t; for configuration details.
For bug reporting instructions, p= lease see:
<https://www.gnu.org/software/gdb/bugs/>.
<= span lang=3D"plaintext" class=3D"gmail-line" id=3D"gmail-LC55">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 apk...
(No debugging symbols found in apk)
(gdb) bt
No stack.
(gdb) disas $pc-40,+80No registers.
(gdb) info reg
<= span lang=3D"plaintext" class=3D"gmail-line" id=3D"gmail-LC67">The program = has no registers now.

On Thu, Jan 4, 2024 = at 8:48=E2=80=AFAM Szabolcs Nagy <nsz@= port70.net> wrote:
* Cody Wetzel <codyawetzel@gmail.com> [2024-01-03 11:20:29 -0600]:
> Hello musl team,
>
> I tried getting a core dump but I'm not sure if I'm doing some= thing wrong...
>
> / # cat /proc/sys/kernel/core_pattern/tmp/core-%e-%s-%u-%g-%p-%t/ # > apk upgrade busybox
> --repository=3Dhttps://dl-cdn.alpinelinux.org/a= lpine/v3.18/main
> --repository=3Dhttps://dl-cdn.alpinel= inux.org/alpine/v3.18/communityfetch
> https://dl-cdn.= alpinelinux.org/alpine/v3.18/community/armv7/APKINDEX.tar.gzfetch
> https://dl-cdn.alpin= elinux.org/alpine/v3.18/main/armv7/APKINDEX.tar.gzfetch
> https://dl-cdn.alpin= elinux.org/alpine/v3.17/main/armv7/APKINDEX.tar.gzfetch
> https://dl-cdn.= alpinelinux.org/alpine/v3.17/community/armv7/APKINDEX.tar.gz(1/3)
> Upgrading busybox (1.35.0-r29 -> 1.36.1-r5)Executing
> busybox-1.36.1-r5.post-upgrade(2/3) Upgrading busybox-binsh
> (1.35.0-r29 -> 1.36.1-r5)(3/3) Upgrading ssl_client (1.35.0-r29 -&g= t;
> 1.36.1-r5)Executing busybox-1.36.1-r5.triggerOK: 5 MiB in 15 packages/=
> # apk upgrade musl
> --repository=3Dhttps://dl-cdn.alpinelinux.org/a= lpine/v3.18/main
> --repository=3Dhttps://dl-cdn.alpinel= inux.org/alpine/v3.18/community(1/1)
> Upgrading musl (1.2.3-r5 -> 1.2.4-r2)OK: 5 MiB in 15 packages/ # ap= k
> upgrade rust --repository=3Dhttps://dl-cdn.alpi= nelinux.org/alpine/v3.18/main
> --repository=3Dhttps://dl-cdn.= alpinelinux.org/alpine/v3.18/communitySegmentation
> fault/ # apk -hSegmentation fault/ # ls /tmp/core*Segmentation fault/<= br> > # cd /tmp/tmp # lsSegmentation fault

i'd

# cp /lib/ld-musl-armhf.so.1 /tmp
# apk add gdb musl-dbg apk-tools-static

then upgrade musl using apk.static, then debug via

# /tmp/ld-musl-armhf.so.1 /usr/bin/gdb --args ls -l /tmp

or analyze a core dump, you can always install more debug tools
via apk.static and run commands using the old ld-musl-armhf.so.1

in gdb, you want to do

bt
disas $pc-40,+80
info reg
info proc map

as a starting point and post the results.

strace output can be useful too as well as readelf -aW of ld.so
depending on what is going on.


--
Co= dy Wetzel
cod= yawetzel@gmail.com
(402)490-9242
--00000000000034f144060e998488--