From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125143 invoked by alias); 6 Jul 2018 13:08:03 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 125051 invoked by uid 89); 6 Jul 2018 13:08:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:PHrt, H*r:74.6.132, H*c:alternative, H*x:5.0 X-HELO: sonic314-13.consmr.mail.bf2.yahoo.com Received: from sonic314-13.consmr.mail.bf2.yahoo.com (HELO sonic314-13.consmr.mail.bf2.yahoo.com) (74.6.132.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 13:08:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1530882479; bh=LXIUjUU7Q4pDVLG2me9gNXF/SzAnDaURzZ9bXi0SHBU=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=SOFX0hRyQExJ13PRczyP5jngDTjTBrRMCe39JlZR90KIDpJFmsZG1NHvhU8oowvHFiiXO9I4ITiWOnUQOf5E82FsRvyWWPj+qUkyQTA4Ge9AcPcqY+gtcqUeGa0EjZU6p+zbFO0qQKQ0whSTG9gVLS/7Cj0voIcCKrJ5uP+5D/NLyR9f3amAUYi4DItJ12zxOyYhKPgGqOauKaV2vOHKaXKm22lnM9K/jgbk5om29JBQiddQQX/DWHC8QoDYwe3I42bpvTJJNnCUCFzODKsUQ4y6fxP/NhVBlOdCSwbCAz//7Ae2nvPAYTBB3Puhy1WWzIS/3dnwOhIjR5vrHgIT4Q== Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.bf2.yahoo.com with HTTP; Fri, 6 Jul 2018 13:07:59 +0000 Date: Fri, 06 Jul 2018 13:08:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" , Pedro Alves Message-ID: <1883587662.54335.1530882474281@mail.yahoo.com> In-Reply-To: References: <1377359320.54438.1530847991768.ref@mail.yahoo.com> <1377359320.54438.1530847991768@mail.yahoo.com> Subject: Re: Viewing the address of an array in gdb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00021.txt.bz2 Yes you are right. It picked the glibc symbol name "buffer".=20 No matters. I will change the name. I thought there is something wrong with= the buffer I defined. Thank you very much. Regards, Mahmood=20 On Friday, July 6, 2018, 4:36:41 PM GMT+4:30, Pedro Alves wrote:=20 If you can't change the program, you can work around this by unloading the shared library symbols, so that gdb sees the program's symbol again.=C2=A0 E.g.: (gdb) start Temporary breakpoint 1 at 0x40048b Starting program: /home/pedro/tmp/buffer=20 Temporary breakpoint 1, 0x000000000040048b in main () (gdb) info symbol &buffer buffer in section .bss of /lib64/libc.so.6 (gdb) nosharedlibrary=20 (gdb) info symbol &buffer buffer in section .bss (gdb) x /30x=C2=A0 &buffer 0x601040 :=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x000= 00000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x601050 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x601060 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x601070 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x601080 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x601090 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x6010a0 :=C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0= =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 0x6010b0:=C2=A0 =C2=A0 =C2=A0 0x00000000=C2=A0 =C2=A0 =C2=A0 0x00000000 (gdb)=20 Thanks, Pedro Alves =20=20 >From gdb-return-46510-listarch-gdb=sources.redhat.com@sourceware.org Fri Jul 06 13:08:51 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 127911 invoked by alias); 6 Jul 2018 13:08:51 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 127897 invoked by uid 89); 6 Jul 2018 13:08:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:PHrt, H*c:alternative, H*x:5.0, H*c:HHHHH X-HELO: sonic301-3.consmr.mail.bf2.yahoo.com Received: from sonic301-3.consmr.mail.bf2.yahoo.com (HELO sonic301-3.consmr.mail.bf2.yahoo.com) (74.6.129.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 13:08:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1530882528; bh=G2ZoKKb+xKZcJ5aa+WJ/3GRCMo2FSKj66wOZNOQXhrM=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=YD6TOIK/ZHQKX8DD7zAH0bvwaMKknthMbZP+sGHxNlVzdMYpUS+0Ef9O87Uev0IeVFkXrnFJFxPxFP/Uk/rEkU8f/RzulCIif5ULqzuyuuk2pLbrNtdeBRLcZvQmeVp3Sij88jC5RoV8K/lHYA4DzdN+i5OQ/KZFK3p/7mtaH6TLL/KlzAcOSxI17KEDvpLyJrin8gWtOVL+eCUS6YURVl6U1FIIrBPOatit3X+O/fvjQn+IyWwTjkzKbj1Nqc4YBAquE2oN5pzaWdxRrcik4iL8+TdvjPb7U3iu1eFs1Xn9clLxTac6ErOb0a07QXu1kBg43Gzjlu3j9yVW/7FP0g== Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.bf2.yahoo.com with HTTP; Fri, 6 Jul 2018 13:08:48 +0000 Date: Fri, 06 Jul 2018 13:08:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" , Pedro Alves Message-ID: <1251589382.60449.1530882523908@mail.yahoo.com> In-Reply-To: References: <1839186466.17059.1530875705518.ref@mail.yahoo.com> <1839186466.17059.1530875705518@mail.yahoo.com> <111043354.25205.1530876761267@mail.yahoo.com> Subject: Re: debugging a callq command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00022.txt.bz2 Content-length: 614 Right. Something happened in callq.=20 Thank you very much. Regards, Mahmood=20 On Friday, July 6, 2018, 4:18:39 PM GMT+4:30, Pedro Alves wrote:=20=20 =20 On 07/06/2018 12:32 PM, Mahmood Naderan via gdb wrote: something else while the program receives seg fault. Are you maybe confusing stepi with nexti?=C2=A0 nexti steps over the call instruction, and then it sounds like something crashes within the called routine at 0x7fffffffde70.=C2=A0 Try "stepi" to follow the full instruction flow instead, and it will probably crash at the same instruction. Thanks, Pedro Alves =20=20 >From gdb-return-46511-listarch-gdb=sources.redhat.com@sourceware.org Sat Jul 07 16:15:58 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 25674 invoked by alias); 7 Jul 2018 16:15:32 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 25438 invoked by uid 89); 7 Jul 2018 16:15:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=35, SIGSEGV, crashes, H*c:PHrt X-HELO: sonic316-13.consmr.mail.bf2.yahoo.com Received: from sonic316-13.consmr.mail.bf2.yahoo.com (HELO sonic316-13.consmr.mail.bf2.yahoo.com) (74.6.130.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Jul 2018 16:15:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1530980101; bh=CY313Hbk2DQbJK4TKttzHT2vvSls6qYI/Sjwh9RtMYA=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=AWZBZV69A/Vc7MQfnLzZ78CJhmPSVoetJgP4I+NdiYUq0qVYO82X50SFLzxuMgwKtqx35+KixAjLxTdf10+WFYzZJO/pWn/NGF+1bzHF6dEryu4zkJ+Ng9LJqu1MXpGbTJKqEveaA0yslDXgBePjqyPRigkgEchthpCa0lEP59wK3rwZVFFrKSM2doW6Ywipa3tkSNoliLoUQzbB1cBOr6s313YwE/9iW/AAjz2SFw4FGJWO6g4ACrZiltE85O1iFTHJsSd8Cl5KzsgFdyFdtSk4FHD9TbrnEQ1UwHNU1Nn2r54UzxFyiptqKEJB7FewhS5DGuMpNNPyg27BRbZ4Mw== Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Sat, 7 Jul 2018 16:15:01 +0000 Date: Sat, 07 Jul 2018 16:15:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" Message-ID: <1810093935.481654.1530980099373@mail.yahoo.com> Subject: Debugging issue with -m32 program MIME-Version: 1.0 References: <1810093935.481654.1530980099373.ref@mail.yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00023.txt.bz2 Content-length: 2295 Hello, I have compiled a simple c program with -m32 option. Thing is that when I w= ant to copy some data into an array, it crashes=20 Breakpoint 1, main (argc=3D1, argv=3D0xffffd154) at vuln.c:35 35=C2=A0=C2=A0 =C2=A0=C2=A0 strcpy( dest, buffer ); (gdb) p &buffer[0] $1 =3D 0xffffcfb5 '\220' , "\061\300Ph//shh/bin\211\343P\= 211\342S\211\341\260\v=CD=80", '\220' , "P\336\377\377\37= 7\177" (gdb) p &dest[0] $2 =3D 0xffffd02c "\020\334\377", (gdb) x/100x 0xffffcfb5 0xffffcfb5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfc5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfd5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfe5:=C2=A0=C2=A0 =C2=A00xc0319090=C2=A0=C2=A0 =C2=A00x2f2f6850=C2=A0= =C2=A0 =C2=A00x2f686873=C2=A0=C2=A0 =C2=A00x896e6962 0xffffcff5:=C2=A0=C2=A0 =C2=A00xe28950e3=C2=A0=C2=A0 =C2=A00xb0e18953=C2=A0= =C2=A0 =C2=A00x9080cd0b=C2=A0=C2=A0 =C2=A00x90909090 0xffffd005:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffd015:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffd025:=C2=A0=C2=A0 =C2=A00xffffde50=C2=A0=C2=A0 =C2=A00x10007fff=C2=A0= =C2=A0 =C2=A00x00f7ffdc=C2=A0=C2=A0 =C2=A00x5cf7ffca 0xffffd035:=C2=A0=C2=A0 =C2=A00xe0ffffd1=C2=A0=C2=A0 =C2=A00xb7000000=C2=A0= =C2=A0 =C2=A00xe0f7f047=C2=A0=C2=A0 =C2=A00x90f7ffdd 0xffffd045:=C2=A0=C2=A0 =C2=A00x00ffffd0=C2=A0=C2=A0 =C2=A00x00000000=C2=A0= =C2=A0 =C2=A00x00000000=C2=A0=C2=A0 =C2=A00x2c000000 (gdb) next Program received signal SIGSEGV, Segmentation fault. 0x56555655 in main (argc=3D,=20 =C2=A0=C2=A0=C2=A0 argv=3D) at vuln.c:37 37=C2=A0=C2=A0 =C2=A0} Without specifying -m32, there is no problem. I wonder why it tries to acce= ss 0x90909090. There is some problem with 32/64 bit data. Regards, Mahmood >From gdb-return-46512-listarch-gdb=sources.redhat.com@sourceware.org Mon Jul 09 07:19:15 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 53954 invoked by alias); 9 Jul 2018 07:19:14 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 53933 invoked by uid 89); 9 Jul 2018 07:19:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=segmentation, strcpy, 37, H*c:PHrt X-HELO: sonic316-15.consmr.mail.bf2.yahoo.com Received: from sonic316-15.consmr.mail.bf2.yahoo.com (HELO sonic316-15.consmr.mail.bf2.yahoo.com) (74.6.130.125) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jul 2018 07:19:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1531120750; bh=gVOs3t+88yOPq7Wt4VD+KOWVMxcPTM8gTjZUlkozW7w=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=iz4+pkblroiJIclJORoAOOsyJaW3RzX1cLRUqaGQlQZvCZfD6M3B4VmiKC/r5n2R72nBDfqrkt6Uc7Km+gk8rVKAb6yq4IwcUpcx6ilBKU0kHV7YRR77LP2NZG9hkE/wAgwEFNe9i5SQjzbIimAPRUXq97A84vBF8wWoiS5XyKL24Fw/oWYP8DcfxGw7u8J8Gm9sHeZKA8/CrVeKipGG7mRk0+wkY4eu5NvuevyPFNBqEY95MepABRLcwHBpPnfu+J2XqZHzP8YFMf+Lu9cwrCKl2hrAbeBOxkNALTx38jw3Yf1cZsfddn03RlEXKDxmPxjS32YO4kUvwyE024z2tQ== Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Mon, 9 Jul 2018 07:19:10 +0000 Date: Mon, 09 Jul 2018 07:19:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" Message-ID: <1899779916.938872.1531120747010@mail.yahoo.com> In-Reply-To: <1810093935.481654.1530980099373@mail.yahoo.com> References: <1810093935.481654.1530980099373.ref@mail.yahoo.com> <1810093935.481654.1530980099373@mail.yahoo.com> Subject: Re: Debugging issue with -m32 program MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00024.txt.bz2 Content-length: 2450 No idea? Regards, Mahmood=20 On Saturday, July 7, 2018, 8:46:01 PM GMT+4:30, Mahmood Naderan via gdb= wrote:=20=20 =20 Hello, I have compiled a simple c program with -m32 option. Thing is that when I w= ant to copy some data into an array, it crashes=20 Breakpoint 1, main (argc=3D1, argv=3D0xffffd154) at vuln.c:35 35=C2=A0=C2=A0 =C2=A0=C2=A0 strcpy( dest, buffer ); (gdb) p &buffer[0] $1 =3D 0xffffcfb5 '\220' , "\061\300Ph//shh/bin\211\343P\= 211\342S\211\341\260\v=CD=80", '\220' , "P\336\377\377\37= 7\177" (gdb) p &dest[0] $2 =3D 0xffffd02c "\020\334\377", (gdb) x/100x 0xffffcfb5 0xffffcfb5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfc5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfd5:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffcfe5:=C2=A0=C2=A0 =C2=A00xc0319090=C2=A0=C2=A0 =C2=A00x2f2f6850=C2=A0= =C2=A0 =C2=A00x2f686873=C2=A0=C2=A0 =C2=A00x896e6962 0xffffcff5:=C2=A0=C2=A0 =C2=A00xe28950e3=C2=A0=C2=A0 =C2=A00xb0e18953=C2=A0= =C2=A0 =C2=A00x9080cd0b=C2=A0=C2=A0 =C2=A00x90909090 0xffffd005:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffd015:=C2=A0=C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090=C2=A0= =C2=A0 =C2=A00x90909090=C2=A0=C2=A0 =C2=A00x90909090 0xffffd025:=C2=A0=C2=A0 =C2=A00xffffde50=C2=A0=C2=A0 =C2=A00x10007fff=C2=A0= =C2=A0 =C2=A00x00f7ffdc=C2=A0=C2=A0 =C2=A00x5cf7ffca 0xffffd035:=C2=A0=C2=A0 =C2=A00xe0ffffd1=C2=A0=C2=A0 =C2=A00xb7000000=C2=A0= =C2=A0 =C2=A00xe0f7f047=C2=A0=C2=A0 =C2=A00x90f7ffdd 0xffffd045:=C2=A0=C2=A0 =C2=A00x00ffffd0=C2=A0=C2=A0 =C2=A00x00000000=C2=A0= =C2=A0 =C2=A00x00000000=C2=A0=C2=A0 =C2=A00x2c000000 (gdb) next Program received signal SIGSEGV, Segmentation fault. 0x56555655 in main (argc=3D,=20 =C2=A0=C2=A0=C2=A0 argv=3D) at vuln.c:37 37=C2=A0=C2=A0 =C2=A0} Without specifying -m32, there is no problem. I wonder why it tries to acce= ss 0x90909090. There is some problem with 32/64 bit data. Regards, Mahmood=20=20 >From gdb-return-46513-listarch-gdb=sources.redhat.com@sourceware.org Mon Jul 09 12:14:25 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 45415 invoked by alias); 9 Jul 2018 12:14:24 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 45397 invoked by uid 89); 9 Jul 2018 12:14:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=onward, segv, gdbsourcewareorg, H*r:192.168.10 X-HELO: resqmta-po-12v.sys.comcast.net Received: from resqmta-po-12v.sys.comcast.net (HELO resqmta-po-12v.sys.comcast.net) (96.114.154.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jul 2018 12:14:22 +0000 Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-12v.sys.comcast.net with ESMTP id cUmJfeqOOVNwlcV3bffmIR; Mon, 09 Jul 2018 12:14:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1531138459; bh=xxk7+kWRbuVEziEU7ONymGMmK84VqH8wAJuNePKjRpE=; h=Received:Received:From:Content-Type:Mime-Version:Subject:Date:To: Message-Id; b=F8lplggcr4jBS8Hq2uTXb34r35Jl9LLKE6euwkj7v8lkHYJcwe4vGStgaRFJcj8te brPCg59rX8WuAhqSM35t77fa0j84OM70XBrB0DeghaOIwFZoKdbfBcvL3Yplo9uPwa LEC6LdueJVOvIWZoAT/jKojJL8rscsWYKBkbOXVcyFyjTfbfpmkCcgJj2Doout2Cdx pSza3mUqo9c4h5yEqHZNyElzOoqYOpfqE+AxI8HEWtioBLY8DpRdV2eMFWvDbh+zib IgiJg72drjtYmuI28Laey70VdHgdlrk+EBNfcU2Y+vLsrPSN4pGrVdGOZ3Gp+BLKvW PtREsAeCMUldw== Received: from [192.168.10.125] ([73.60.223.101]) by resomta-po-01v.sys.comcast.net with ESMTPA id cV3afpkdYVGSOcV3bfcR2s; Mon, 09 Jul 2018 12:14:19 +0000 From: Paul Koning Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: Debugging issue with -m32 program Date: Mon, 09 Jul 2018 12:14:00 -0000 References: <1810093935.481654.1530980099373.ref@mail.yahoo.com> <1810093935.481654.1530980099373@mail.yahoo.com> <1899779916.938872.1531120747010@mail.yahoo.com> To: Mahmood Naderan , "gdb@sourceware.org" In-Reply-To: <1899779916.938872.1531120747010@mail.yahoo.com> Message-Id: <2E370BA9-E695-4557-AE57-20E68561ACCE@comcast.net> X-SW-Source: 2018-07/txt/msg00025.txt.bz2 Content-length: 2179 > On Jul 9, 2018, at 3:19 AM, Mahmood Naderan via gdb = wrote: >=20 > ... > Hello, > I have compiled a simple c program with -m32 option. Thing is that when I= want to copy some data into an array, it crashes=20 >=20 >=20 > Breakpoint 1, main (argc=3D1, argv=3D0xffffd154) at vuln.c:35 > 35 strcpy( dest, buffer ); > (gdb) p &buffer[0] > $1 =3D 0xffffcfb5 '\220' , "\061\300Ph//shh/bin\211\343= P\211\342S\211\341\260\v=CD=80", '\220' , "P\336\377\377\= 377\177" > (gdb) p &dest[0] > $2 =3D 0xffffd02c "\020\334\377", > (gdb) x/100x 0xffffcfb5 > 0xffffcfb5: 0x90909090 0x90909090 0x90909090 0x90909090 > 0xffffcfc5: 0x90909090 0x90909090 0x90909090 0x90909090 > 0xffffcfd5: 0x90909090 0x90909090 0x90909090 0x90909090 > 0xffffcfe5: 0xc0319090 0x2f2f6850 0x2f686873 0x896e6962 > 0xffffcff5: 0xe28950e3 0xb0e18953 0x9080cd0b 0x90909090 > 0xffffd005: 0x90909090 0x90909090 0x90909090 0x90909090 > 0xffffd015: 0x90909090 0x90909090 0x90909090 0x90909090 > 0xffffd025: 0xffffde50 0x10007fff 0x00f7ffdc 0x5cf7ffca > 0xffffd035: 0xe0ffffd1 0xb7000000 0xe0f7f047 0x90f7ffdd > 0xffffd045: 0x00ffffd0 0x00000000 0x00000000 0x2c000000 > (gdb) next >=20 > Program received signal SIGSEGV, Segmentation fault. > 0x56555655 in main (argc=3D,=20 > argv=3D) at vuln.c:37 > 37 } >=20 >=20 >=20 >=20 > Without specifying -m32, there is no problem. I wonder why it tries to ac= cess 0x90909090. There is some problem with 32/64 bit data. If "argc" is not used in "main" -- or at least not from this point onward -= - then the compiler can reuse that register for other purposes. That is pr= obably what is happening here. Note that this explains the messages in the= traceback, but that isn't the reason for the SEGV. The SEGV is an issue i= n your program. Did you overwrite memory by strcpy to an output that's too= small? paul >From gdb-return-46514-listarch-gdb=sources.redhat.com@sourceware.org Mon Jul 09 19:43:01 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 124700 invoked by alias); 9 Jul 2018 19:43:01 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 124229 invoked by uid 89); 9 Jul 2018 19:43:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:HHHHHHH, HTo:D*comcast.net, H*c:PHrt, Hx-languages-length:678 X-HELO: sonic311-14.consmr.mail.bf2.yahoo.com Received: from sonic311-14.consmr.mail.bf2.yahoo.com (HELO sonic311-14.consmr.mail.bf2.yahoo.com) (74.6.131.124) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jul 2018 19:42:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1531165378; bh=f+CLTdvUYf/3UJbxUqlYcUYyjYNIXwYFIb4ovLMkNRo=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=q58Iurj6E70YXPDgLT18buajDFADbNdTRWMINH4PhYm7qnjugCee4UTXHniBdpzjfsdoNf6YkceRVBK3MLEvOd79LDqYIvF9wDYbbQdsJVUpmqRoc9Vw5r4di3pbihHH90n7+8VgDSc0efCOyN8/xNXscLhIvtOh/zzgWUDt8xAEmJfuEEyzgjln5TyI4QfYZSvTkF0n6SUDyeEf/B1Mm7XqPTgET6E460P7KliK2lNQ0MqqqGh69qE/zuT57BQkQIku5zb5q2l7rGkqJkTQi2BGItIZ1TO7vWBJLANSsKLVclvPd+G4I3tVB34Lb8gryXuQ1TThXWcDgbSTLjxBzg== Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Mon, 9 Jul 2018 19:42:58 +0000 Date: Mon, 09 Jul 2018 19:43:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" , Paul Koning Message-ID: <1134645069.1279850.1531165376015@mail.yahoo.com> In-Reply-To: <2E370BA9-E695-4557-AE57-20E68561ACCE@comcast.net> References: <1810093935.481654.1530980099373.ref@mail.yahoo.com> <1810093935.481654.1530980099373@mail.yahoo.com> <1899779916.938872.1531120747010@mail.yahoo.com> <2E370BA9-E695-4557-AE57-20E68561ACCE@comcast.net> Subject: Re: Debugging issue with -m32 program MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00026.txt.bz2 Content-length: 321 >Did you overwrite memory by strcpy to an output that's too small? Indeed yes. But not too small. The buffer is more than 100 characters while dest is 100 characters. The question is why the same program, without specifying -m32, works actually?! Which one is correct behavior? Crash or not crash?! Regards, Mahmood