linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ammar Faizi <ammarfaizi2@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Yury Norov <yury.norov@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Linux fsdevel Mailing List <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: x86_64/kvm: kernel hangs on poweroff
Date: Thu, 28 Jul 2022 19:52:10 +0700	[thread overview]
Message-ID: <6ea35895-7dd7-29e9-b7a0-bdc25307dfb0@gmail.com> (raw)
In-Reply-To: <CAHk-=wjroqb0Hr9-1BCATjSuBdfdkWS6qqFaLXrwFCsHvgGH_g@mail.gmail.com>

On 7/26/22 2:02 AM, Linus Torvalds wrote:
> On Mon, Jul 25, 2022 at 11:40 AM Yury Norov <yury.norov@gmail.com> wrote:
>>> [   22.162259] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
>>> [   22.163539] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.19.0-rc6 #198
>>> [   22.164327] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014
>>> [   22.164327] Call Trace:
>>> [   22.164327]  <TASK>
>>> [   22.164327]  dump_stack_lvl+0x34/0x44
>>> [   22.164327]  panic+0x107/0x28a
>>> [   22.164327]  do_exit.cold+0x15/0x15
>>> [   22.164327]  ? sys_off_notify+0x3e/0x60
>>> [   22.164327]  __do_sys_reboot+0x1df/0x220
>>> [   22.164327]  ? vfs_writev+0xc7/0x190
>>> [   22.164327]  ? virtio_crypto_ctrl_vq_request+0xd0/0xd0
>>> [   22.164327]  ? fpregs_assert_state_consistent+0x1e/0x40
>>> [   22.164327]  do_syscall_64+0x3b/0x90
>>> [   22.164327]  entry_SYSCALL_64_after_hwframe+0x46/0xb0
>>> [   22.164327] RIP: 0033:0x7f42b4118443
>>> [   22.164327] Code: 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 89 fa be 69 19 12 28 bf ad de e1 fe b8 a9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 8b 15 f9 c9 0d 00 f7 d8
> 
> That's literally the "exit()" system call.

I took a look and it turned out it's not the "exit()" system call.

The disassembly is:

    0:    64 89 01                 mov    %eax,%fs:(%rcx)
    3:    48 83 c8 ff              or     $0xffffffffffffffff,%rax
    7:    c3                       ret
    8:    66 2e 0f 1f 84 00 00     cs nopw 0x0(%rax,%rax,1)
    f:    00 00 00
   12:    0f 1f 44 00 00           nopl   0x0(%rax,%rax,1)
   17:    89 fa                    mov    %edi,%edx
   19:    be 69 19 12 28           mov    $0x28121969,%esi
   1e:    bf ad de e1 fe           mov    $0xfee1dead,%edi
   23:    b8 a9 00 00 00           mov    $0xa9,%eax
   28:    0f 05                    syscall
   2a:*   48 3d 00 f0 ff ff        cmp    $0xfffffffffffff000,%rax        <-- trapping instruction

The syscall is with orig %rax being 0xa9 (169 in dec). That is
the reboot system call. The problem here is that the reboot
system call calls do_exit(0) with @current being the init.

So I think the way to investigate it is take a look at kernel/reboot.c,
understand why did you end up in do_exit(0) path. Hope that helps.

-- 
Ammar Faizi


      reply	other threads:[~2022-07-28 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 21:18 x86_64/kvm: kernel hangs on poweroff Yury Norov
2022-07-25 18:39 ` Yury Norov
2022-07-25 19:02   ` Linus Torvalds
2022-07-28 12:52     ` Ammar Faizi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ea35895-7dd7-29e9-b7a0-bdc25307dfb0@gmail.com \
    --to=ammarfaizi2@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).