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 9936BC433FE 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 2769261BD3 for ; Mon, 15 Nov 2021 20:12:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2769261BD3 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 1mmiKN-00041m-7t; Mon, 15 Nov 2021 15:11:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.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 1mmWP3-0002Go-6B for kernelnewbies@kernelnewbies.org; Mon, 15 Nov 2021 02:27:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636961264; 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=/QIVc+nbzX84mfyAVji1Rg26TbFRw2MwoGHsu+d4/dM=; b=H4nr2/6nSn3Fs9cfSHOrhfbUvlJ7MCNB59njA9JrjoPM374bE8GuUet0+7MQKRDgIQ5NJw mdxaytZecJkhGVxe8wXKHA4GcduN74fu/50fD/GR7AkPKTmxYZ1H61fhjDk+T5pY5K+4mL TVUCCcqIGfh/btLTKVTL6K8+rZiW1J4= 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-127-q4Y9ZzSqNeu5HGFMMCcmfg-1; Mon, 15 Nov 2021 02:27:38 -0500 X-MC-Unique: q4Y9ZzSqNeu5HGFMMCcmfg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E944F1018720; Mon, 15 Nov 2021 07:27:35 +0000 (UTC) Received: from localhost (ovpn-13-7.pek2.redhat.com [10.72.13.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68B09196E5; Mon, 15 Nov 2021 07:27:29 +0000 (UTC) Date: Mon, 15 Nov 2021 15:27:26 +0800 From: Baoquan He To: Dongliang Mu Subject: Re: Help needed in getting kernel dump in QEMU VM Message-ID: <20211115072726.GB21646@MiWiFi-R3L-srv> References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 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. 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