All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Bradley Morgan <include@grrlz.net>
Cc: akpm@linux-foundation.org,  brauner@kernel.org,
	 peterz@infradead.org, oleg@redhat.com,  tglx@kernel.org,
	 npiggin@gmail.com, pasha.tatashin@soleen.com,  kees@kernel.org,
	 stable@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+8fdf0d8e10bdde1c2e88@syzkaller.appspotmail.com
Subject: Re: [PATCH] reboot: enable IRQs before do_exit in the halt and power off fallback
Date: Sun, 12 Jul 2026 21:54:36 -0500	[thread overview]
Message-ID: <87tsq3vbtf.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20260712125300.31501-1-include@grrlz.net> (Bradley Morgan's message of "Sun, 12 Jul 2026 12:52:59 +0000")

Bradley Morgan <include@grrlz.net> writes:

> The reboot syscall calls do_exit(0) after kernel_halt() or
> kernel_power_off().  Those are expected to stop the machine and not
> return.  When they do return (no PM info, power off failed), the
> shutdown path has already disabled interrupts: native_machine_shutdown()
> calls local_irq_disable() on x86, and do_exit() then hits its
> WARN_ON(irqs_disabled()) at kernel/exit.c:930.
>
> do_exit only warns by design; make_task_dead() is the path that fixes
> the IRQs disabled state (commit 001c28e57187 ("exit: Detect and fix irq
> disabled state in oops")).  The reboot fallback is not an oops and wants
> a clean do_exit, so enable IRQs at the two call sites instead, matching
> the make_task_dead pattern.

I think this is fixing symptoms not the actual cause.

How does kernel_halt or kernel_power_off manage to return?

If they aren't supposed to return changing the code to call
make_task_dead to indicate you are on an error path is probably
the better fix.

Eric

> Splat from syzbot:
>
>   ACPI: PM: Preparing to enter system sleep state S5
>   kvm: exiting hardware virtualization
>   reboot: Power down
>   ------------[ cut here ]------------
>   irqs_disabled()
>   WARNING: kernel/exit.c:930 at do_exit+0x1cf7/0x2ae0 kernel/exit.c:930, CPU#0: init/6193
>   CPU: 0 UID: 0 PID: 6193 Comm: init Tainted: G             L      syzkaller #0 PREEMPT(full)
>   Tainted: [L]=SOFTLOCKUP
>   Call Trace:
>    <TASK>
>    __do_sys_reboot+0x36e/0x400 kernel/reboot.c:784
>    do_syscall_64+0x115/0x840 arch/x86/entry/syscall_64.c:94
>    entry_SYSCALL_64_after_hwframe+0x77/0x7f
>    </TASK>
>
> Fixes: 001c28e57187 ("exit: Detect and fix irq disabled state in oops")
> Reported-by: syzbot+8fdf0d8e10bdde1c2e88@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=8fdf0d8e10bdde1c2e88
> Closes: https://lore.kernel.org/all/69f5ec0c.050a0220.312cd3.0023.GAE@google.com/T/
> Cc: stable@vger.kernel.org
> Signed-off-by: Bradley Morgan <include@grrlz.net>
> ---
>  kernel/reboot.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index bed6967bfa96..7e8ebb470721 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -777,10 +777,20 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
>  
>  	case LINUX_REBOOT_CMD_HALT:
>  		kernel_halt();
> +		/* kernel_halt() was expected to not return. */
> +		if (irqs_disabled()) {
> +			pr_info("reboot: halt returned with irqs disabled\n");
> +			local_irq_enable();
> +		}
>  		do_exit(0);
>  
>  	case LINUX_REBOOT_CMD_POWER_OFF:
>  		kernel_power_off();
> +		/* kernel_power_off() was expected to not return. */
> +		if (irqs_disabled()) {
> +			pr_info("reboot: power off returned with irqs disabled\n");
> +			local_irq_enable();
> +		}
>  		do_exit(0);
>  		break;

  reply	other threads:[~2026-07-13  2:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12 12:52 [PATCH] reboot: enable IRQs before do_exit in the halt and power off fallback Bradley Morgan
2026-07-13  2:54 ` Eric W. Biederman [this message]
2026-07-13  5:57   ` Bradley Morgan
2026-07-13 19:48   ` Oleg Nesterov

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=87tsq3vbtf.fsf@email.froward.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=include@grrlz.net \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@gmail.com \
    --cc=oleg@redhat.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+8fdf0d8e10bdde1c2e88@syzkaller.appspotmail.com \
    --cc=tglx@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.