Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A9D6C433EF for ; Fri, 22 Apr 2022 23:37:18 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1ni2pf-0001nM-Qr; Fri, 22 Apr 2022 19:36:59 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1ni2pd-0001mP-Dk for kernelnewbies@kernelnewbies.org; Fri, 22 Apr 2022 19:36:58 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 23 Apr 2022 08:36:52 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id 2cf4d19d62633c14; Sat, 23 Apr 2022 08:36:52 +0900 DKIM-Signature: a=rsa-sha256; b=hw1lULt8HCs6PSkXuOhCu8Vc6v+MgqGowZhVEmT5jj1ILHsqebTnOVmLoZa4lawa4+CqTZtn4c +2MdHLzY2wk1FfswO8G89ziRhG0gNueonIU3pk7NL3MkS/JZyWSfykH7EofFznEc+Z5M4ct9cy3c HXKjmZyO66QpklIsi2LDAPm9YHTn39l0hR1uqAVeNy+so3hW1JfiZwTckafk2KsK5qUg+aC8Hx0Z Un8v0UeKAljk6j9KPymz/xWRA3j2yKrX8GA7Q98iwPZ4Ilv7WjvZK7AViy+lIdVfBdpsHUPe85UA B+X9qI16Z3lnPz/fObWNvdFNy6oTTFPoN0s9O0UA==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=QWEkRrp2/sya7UFX+vMOpzqHoVaF9MbFh0CoUcPwDZQ=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id 0faf70fa62633c14; Sat, 23 Apr 2022 08:36:52 +0900 From: "Chan Kim" To: "'Mulyadi Santosa'" References: <025301d85642$901587b0$b0409710$@etri.re.kr> In-Reply-To: Subject: RE: Backtrace stopped: previous frame identical to this frame (corrupt stack?) , even with fresh qemu and linux build Date: Sat, 23 Apr 2022 08:36:51 +0900 Message-ID: <029601d856a1$d7f39d60$87dad820$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFPLp18aYBONOzwXR7Hstxska+yGwIDRNTbrf7JNVA= Content-Language: ko Cc: 'qemu-devel' , 'kernelnewbies' X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5343085846827853564==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============5343085846827853564== Content-Type: multipart/alternative; boundary="----=_NextPart_000_0297_01D856ED.47DC56D0" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_0297_01D856ED.47DC56D0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, Mulyadi Thank you for replying. I found CONFIG_DEBUG_FRAME_POINTER, CONFIG_DEBUG_INFO are already set by = default. And I tried adding CONFIG_DEBUG_KERNEL, CONFIG_KGDB, CONFIG_GDB_SCRIPTS, = CONFIG_STACKTRACE all to no avail. Regards, Chan =20 From: Mulyadi Santosa =20 Sent: Friday, April 22, 2022 11:53 PM To: Chan Kim Cc: qemu-devel ; kernelnewbies = Subject: Re: Backtrace stopped: previous frame identical to this frame = (corrupt stack?) , even with fresh qemu and linux build =20 =20 =20 On Fri, Apr 22, 2022 at 7:30 PM Chan Kim > wrote: Hello all, Really strange thing happening here.. I can't see the full stack trace = with 'bt' command in gdb. So I tried with fresh linux-5.10.122 source and qemu-6.2.0 source and = it's happening too! (it's happening when I do combinations with linux 5.10.0 and qemu-5.1.0. = But it's not happening with linux-5.4.21) I would be grateful if somebody could check if this happens to other = people or just me. 1. download linux-5.1.122 tarball from https://www.kernel.org/=20 2. uncompress it and set env variable ARCH=3Darm64, CROSS_COMPILE=3Daarch64-none-elf- , do "make defconfig" and "make = -j`nproc` Image" 3. download qemu-6.2.0 from https://www.qemu.org/ 4. uncompress it and do "mkdir build" "cd build" "../configure --target-list=3Daarch64-softmmu --enable-debug" 5. run qemu and wait for debugger to attach. qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine virt,gic-version=3Dmax,secure=3Doff,virtualization=3Dtrue -cpu max = -kernel linux-5.10.112/arch/arm64/boot/Image -m 2G -nographic -netdev user,id=3Dvnet,hostfwd=3D:127.0.0.1:0-:22,tftp=3D/srv/tftp -device virtio-net-pci,netdev=3Dvnet -machine iommu=3Dsmmuv3 --append = "root=3D/dev/ram init=3D/init nokaslr earlycon ip=3Ddhcp hugepages=3D16" -s -S 6. run debugger, do "aarch64-none-elf-gdb linux-6.10.112/vmlinux -x\ =20 It has been long time since I compiled linux kernel but I guess, either = you need to compile kernel with enabled frame pointer, and/or you need = to enable debug symbol embedded into final kernel image. cmiiw =20 gdb_script" (gdb_script content :=20 target remote :1234 layout src b start_kernel b __driver_attach ) Now, in gdb, when you press 'c' twice, it'll stop at the first __driver_attach. (first one stops at start_kernel). When you are at __attach_driver, type 'bt'. See if you see the full = function stack trace. This is what I see.=20 (gdb) bt #0 __driver_attach (dev=3D0xffff000002582810, data=3D0xffff800011dc2358 ) at drivers/base/dd.c:1060 #1 0xffff8000107a3ed0 in bus_for_each_dev (bus=3D, start=3D, data=3D0xffff800011dc2358 , fn=3D0xffff8000107a6f60 <__driver_attach>) at drivers/base/bus.c:305 #2 0xd6d78000107a5c58 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt = stack?) I used to see more thatn 20 stacks trace but strangely I see only two.=20 I can still see many stacks for linux-5.4.21 that I was working with in = the past.=20 Could anyone check if this happens to anyone? I think if I add BLK_DEV_RAM and set initramfs.cpio.gz in the linux = build, the kernel will boot ok to the shell prompt. Only the gdb can't show the stack levels. My OS : ubuntu-20.04 5.13.0-35-generic $ aarch64-none-elf-gdb --version GNU gdb (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) 10.1.90.20201028-git 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. Thank you. Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org = https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --=20 regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com =20 training: mulyaditraining.blogspot.com = =20 ------=_NextPart_000_0297_01D856ED.47DC56D0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Hi, Mulyadi

Thank you for replying.

I found CONFIG_DEBUG_FRAME_POINTER, = CONFIG_DEBUG_INFO are already set by default.

And I tried adding CONFIG_DEBUG_KERNEL, = CONFIG_KGDB, CONFIG_GDB_SCRIPTS, CONFIG_STACKTRACE all to no = avail.

Regards,

Chan

 

From:<= /b> Mulyadi = Santosa <mulyadi.santosa@gmail.com>
Sent: Friday, April = 22, 2022 11:53 PM
To: Chan Kim = <ckim@etri.re.kr>
Cc: qemu-devel = <qemu-devel@nongnu.org>; kernelnewbies = <kernelnewbies@kernelnewbies.org>
Subject: Re: Backtrace = stopped: previous frame identical to this frame (corrupt stack?) , even = with fresh qemu and linux build

 

 

 

On Fri, Apr 22, 2022 at 7:30 PM = Chan Kim <ckim@etri.re.kr> = wrote:

Hello all,

Really strange thing happening here.. I = can't see the full stack trace with
'bt' command in gdb.
So I = tried with fresh linux-5.10.122 source and qemu-6.2.0 source and = it's
happening too!
(it's happening when I do combinations with = linux 5.10.0 and qemu-5.1.0. But
it's not happening with = linux-5.4.21)

I would be grateful if somebody could check if this = happens to other people
or just me.

1. download linux-5.1.122 = tarball from https://www.kernel.org/
2. uncompress it and = set env variable ARCH=3Darm64,
CROSS_COMPILE=3Daarch64-none-elf- , do = "make defconfig" and "make -j`nproc`
Image"
3. = download qemu-6.2.0 from https://www.qemu.org/
4. uncompress it and do = "mkdir build" "cd build" = "../configure
--target-list=3Daarch64-softmmu = --enable-debug"
5. run qemu and wait for debugger to = attach.
qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 = -machine
virt,gic-version=3Dmax,secure=3Doff,virtualization=3Dtrue = -cpu max -kernel
linux-5.10.112/arch/arm64/boot/Image -m 2G = -nographic = -netdev
user,id=3Dvnet,hostfwd=3D:127.0.0.1:0-:22,tftp=3D/srv/tftp = -device
virtio-net-pci,netdev=3Dvnet -machine iommu=3Dsmmuv3 --append = "root=3D/dev/ram
init=3D/init nokaslr earlycon ip=3Ddhcp = hugepages=3D16" -s -S
6. run debugger, do = "aarch64-none-elf-gdb linux-6.10.112/vmlinux = -x\

 

It has been long time since I = compiled linux kernel but I guess, either you need to compile kernel = with enabled frame pointer, and/or you need to enable debug symbol = embedded into final kernel image. = cmiiw

 

gdb_script"
(gdb_script content :
target remote = :1234
layout src
b start_kernel
b = __driver_attach
)

Now, in gdb, when you press 'c' twice, it'll = stop at the first
__driver_attach. (first one stops at = start_kernel).
When you are at __attach_driver, type 'bt'. See if you = see the full function
stack trace.
This is what I see.
(gdb) = bt
#0  __driver_attach (dev=3D0xffff000002582810, = data=3D0xffff800011dc2358
<dummy_regulator_driver+40>)
 =   at drivers/base/dd.c:1060
#1  0xffff8000107a3ed0 in = bus_for_each_dev (bus=3D<optimized out>,
start=3D<optimized = out>,
    data=3D0xffff800011dc2358 = <dummy_regulator_driver+40>,
fn=3D0xffff8000107a6f60 = <__driver_attach>)
    at = drivers/base/bus.c:305
#2  0xd6d78000107a5c58 in ?? = ()
Backtrace stopped: previous frame identical to this frame (corrupt = stack?)

I used to see more thatn 20 stacks trace but strangely I = see only two.
I can still see many stacks for linux-5.4.21 that I = was working with in the
past.
Could anyone check if this happens = to anyone?
I think if I add BLK_DEV_RAM and set initramfs.cpio.gz in = the linux build,
the kernel will boot ok to the shell prompt.
Only = the gdb can't show the stack levels.

My OS : ubuntu-20.04  = 5.13.0-35-generic

$ aarch64-none-elf-gdb --version
GNU gdb = (GNU Toolchain for the A-profile Architecture = 10.2-2020.11
(arm-10.16)) 10.1.90.20201028-git
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.

Thank you.
Chan = Kim





______________________________________________= _
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernel= newbies



-- =

regards,

Mulyadi Santosa
Freelance Linux trainer = and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

<= /div>
------=_NextPart_000_0297_01D856ED.47DC56D0-- --===============5343085846827853564== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============5343085846827853564==--