From: Thomas Gleixner <tglx@linutronix.de>
To: "Eric W. Biederman" <ebiederm@xmission.com>, linux-arch@vger.kernel.org
Cc: "Tejun Heo" <tj@kernel.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Al Viro" <viro@ZenIV.linux.org.uk>,
"Jens Axboe" <axboe@kernel.dk>,
"Linus Torvalds" <torvalds@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>,
stable@vger.kernel.org, "Максим Кутявин" <maximkabox13@gmail.com>
Subject: Re: [PATCH 1/7] kthread: Don't allocate kthread_struct for init and umh
Date: Tue, 10 May 2022 16:38:27 +0200 [thread overview]
Message-ID: <87fslhpi58.ffs@tglx> (raw)
In-Reply-To: <20220506141512.516114-1-ebiederm@xmission.com>
On Fri, May 06 2022 at 09:15, Eric W. Biederman wrote:
> * the init task will end up wanting to create kthreads, which, if
> * we schedule it before we create kthreadd, will OOPS.
> */
> - pid = kernel_thread(kernel_init, NULL, CLONE_FS);
> + pid = user_mode_thread(kernel_init, NULL, CLONE_FS);
So init does not have PF_KTHREAD set anymore, which causes this to go
sideways with a NULL pointer dereference in get_mm_counter() on next:
get_mm_counter include/linux/mm.h:1996 [inline]
get_mm_rss include/linux/mm.h:2049 [inline]
task_nr_scan_windows.isra.0+0x23/0x120 kernel/sched/fair.c:1123
task_scan_min kernel/sched/fair.c:1144 [inline]
task_scan_start+0x6c/0x400 kernel/sched/fair.c:1150
task_tick_numa kernel/sched/fair.c:2944 [inline]
task_tick_fair+0xaeb/0xef0 kernel/sched/fair.c:11186
scheduler_tick+0x20a/0x5e0 kernel/sched/core.c:5380
https://lore.kernel.org/lkml/0000000000008a9fbb05dea76400@google.com
because the fence in task_tick_numa():
if ((curr->flags & (PF_EXITING | PF_KTHREAD)) || work->next != work)
return;
is not longer sufficient. It needs also to bail if !curr->mm.
I'm worried that there are more of these issues lurking. Haven't looked
yet.
Thanks,
tglx
next prev parent reply other threads:[~2022-05-10 15:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87mtfu4up3.fsf@email.froward.int.ebiederm.org>
2022-05-06 14:15 ` [PATCH 1/7] kthread: Don't allocate kthread_struct for init and umh Eric W. Biederman
[not found] ` <CANpfEhNAQvazzCSN-dVgYmwNSRjqOrqZF0_j7GPLbCdEkogzSg@mail.gmail.com>
2022-05-06 20:53 ` Eric W. Biederman
2022-05-10 14:38 ` Thomas Gleixner [this message]
2022-05-10 15:14 ` Eric W. Biederman
2022-05-11 17:41 ` Eric W. Biederman
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=87fslhpi58.ffs@tglx \
--to=tglx@linutronix.de \
--cc=axboe@kernel.dk \
--cc=ebiederm@xmission.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maximkabox13@gmail.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--cc=torvalds@linuxfoundation.org \
--cc=vincent.guittot@linaro.org \
--cc=viro@ZenIV.linux.org.uk \
/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