From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96E74C433F5 for ; Mon, 15 Nov 2021 20:12:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 26E2D61BD2 for ; Mon, 15 Nov 2021 20:12:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 26E2D61BD2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mmiKS-00043W-H7; Mon, 15 Nov 2021 15:11:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mmXJW-00060v-6f for kernelnewbies@kernelnewbies.org; Mon, 15 Nov 2021 03:26:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636964764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uMmVw1qtGWcyVOFn2ipdA4TLoCYtINAXKL3mYcm/bp4=; b=GsSyoa4+/JZGyYgyOCqA3c1TEaMtY9QmSANc1kmV+v12mwdkLT1yjavzUIY6cx/JmixMRd tmqPQpQKhxKK/UPv9MIRdQOuMYz3Lrl0wD10LE9wtsAf2AvwVNZI+7QPg0xlHyLiCbhI8X c85Pw1+rH9+bg7n8lcTulxVcHIADGlE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-AXmc9fxvOceZo0aMXvbFPg-1; Mon, 15 Nov 2021 03:26:01 -0500 X-MC-Unique: AXmc9fxvOceZo0aMXvbFPg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 399741006AA5; Mon, 15 Nov 2021 08:26:00 +0000 (UTC) Received: from localhost (ovpn-13-7.pek2.redhat.com [10.72.13.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AD26ADCD; Mon, 15 Nov 2021 08:25:53 +0000 (UTC) Date: Mon, 15 Nov 2021 16:25:50 +0800 From: Baoquan He To: Dongliang Mu Subject: Re: Help needed in getting kernel dump in QEMU VM Message-ID: <20211115082550.GC21646@MiWiFi-R3L-srv> References: <20211115072726.GB21646@MiWiFi-R3L-srv> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bhe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Mailman-Approved-At: Mon, 15 Nov 2021 15:11:41 -0500 Cc: Valdis =?utf-8?Q?Kl=C4=93tnieks?= , kernelnewbies , kexec@lists.infradead.org, syzkaller , Vivek Goyal , Dave Young , Dmitry Vyukov 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On 11/15/21 at 03:49pm, Dongliang Mu wrote: > On Mon, Nov 15, 2021 at 3:27 PM Baoquan He wrote: > > > > Hi, > > > > On 11/13/21 at 10:40am, Dongliang Mu wrote: > > > Hi all KDUMP maintainers, > > > > > > I would like to generate a kernel dump within QEMU VM. > > > > > > 1. I reproduced the kernel crash [1] in QEMU VM. The QEMU startup > > > script is as follows: > > > > > > qemu-system-x86_64 \ > > > -kernel $KERNEL/arch/x86/boot/bzImage \ > > > -append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"\ > > > -hda $IMAGE/stretch.img \ > > > -net user,hostfwd=tcp::10021-:22 -net nic \ > > > -enable-kvm \ > > > -nographic \ > > > -m 2G \ > > > -smp 2 \ > > > -pidfile vm.pid \ > > > 2>&1 | tee vm.log > > > > > > The stretch.img is generated by Syzkaller script [1]. -kernel option > > > is convenient for loading any other kernels. > > > > > > 2. As the .config already has the essential > > > configuration(CONFIG_KEXEC, CONFIG_CRASH_DUMP, CONFIG_DEBUG_INFO), I > > > did not change this configuration file. > > > > > > 3. I installed kdump-tools crash kexec-tools makedumpfile > > > linux-image-4.9.0-13-amd64 in the stretch.img. Here I installed > > > linux-image-4.9.0-13-amd64 because there is no default kernel in /boot > > > directory. And to make kdump-tools working, I modify > > > /etc/default/kdump-tools in the following: > > > > > > KDUMP_INITRD=/boot/initrd.img-4.9.0-13-amd64 > > > KDUMP_KERNEL=/boot/vmlinuz-4.9.0-13-amd64 > > > > What distros are you using? Asking this because I am sure you are not > > using Fedora/RHEL OS. The implementation of kdump tools is different in > > each distros, even though the mechanims in kdump code is the same. > > > > I am using Debian stretch as the guest OS. So kdump-tools kexec > makedumpfile is all from Debian. Then I would sugest asking in a Debian/ubuntu forum or mailing list, figure out if the configuration or setting is correct. I never try Debian OS, can't help, sorry. > > > When we try to get help from upstream, considering and asking good question > > is very important for getting quick response and effective help. > > > > Thanks > > Baoquan > > > > > > > > 4. I append "crashkernel=384M-:128M" to the command line in the > > > startup script of QEMU. > > > > > > 5. After rebooting, kdump service can start successfully, and the > > > kdump-config shows: > > > > > > root@syzkaller:~# kdump-config show > > > DUMP_MODE: kdump > > > USE_KDUMP: 1 > > > KDUMP_SYSCTL: kernel.panic_on_oops=1 > > > KDUMP_COREDIR: /var/crash > > > crashkernel addr: 0x77000000 > > > /boot/vmlinuz-4.9.0-13-amd64 > > > kdump initrd: > > > /boot/initrd.img-4.9.0-13-amd64 > > > current state: ready to kdump > > > > > > kexec command: > > > /sbin/kexec -p --command-line="earlyprintk=serial oops=panic > > > panic_on_warn=1 nmi_watchdog=panic panic=86400 net.ifnames=0 > > > sysctl.kernel.hung_task_all_cpu_backtrace=1 ima_policy=tcb > > > kvm-intel.nested=1 nf-conntrack-ftp.ports=20000 > > > nf-conntrack-tftp.ports=20000 nf-conntrack-sip.ports=20000 > > > nf-conntrack-irc.ports=20000 nf-conntrack-sane.ports=20000 > > > vivid.n_devs=16 vivid.multiplanar=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2 > > > netrom.nr_ndevs=16 rose.rose_ndevs=16 spec_store_bypass_disable=prctl > > > numa=fake=2 nopcid dummy_hcd.num=8 binder.debug_mask=0 > > > rcupdate.rcu_expedited=1 root=/dev/sda console=ttyS0 vsyscall=native > > > watchdog_thresh=55 workqueue.watchdog_thresh=140 console=ttyS0 > > > root=/dev/sda debug earlyprintk=serial slub_debug=QUZ irqpoll > > > nr_cpus=1 nousb systemd.unit=kdump-tools.service > > > ata_piix.prefer_ms_hyperv=0" --initrd=/boot/initrd.img-4.9.0-13-amd64 > > > /boot/vmlinuz-4.9.0-13-amd64 > > > > > > 6. When I execute the PoC, the current kernel crashes and then reboots > > > into the dump-capture kernel. However, the kernel log shows, it is in > > > emergency mode, > > > > > > You are in emergency mode. After logging in, type "journalctl -xb" to view > > > system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to > > > try again to boot into default mode. > > > > > > Finally, I would like to ask several questions: > > > 1) is the emergency mode due to the incorrect command line? > > > 2) is this the right way to generate kernel dump from QEMU VM? > > > 3) Any comments on the above procedures? > > > > > > Thanks very much in advance. > > > > > > [1] general protection fault in reiserfs_security_init > > > (https://syzkaller.appspot.com/bug?id=8abaedbdeb32c861dc5340544284167dd0e46cde) > > > > > > [2] https://github.com/google/syzkaller/blob/master/tools/create-image.sh > > > > > > -- > > > My best regards to you. > > > > > > No System Is Safe! > > > Dongliang Mu > > > > > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies