]> www.infradead.org Git - users/jedix/linux-maple.git/commit
init: Deal with the init process being a user mode process
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 11 Apr 2022 14:58:26 +0000 (09:58 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Sat, 7 May 2022 14:01:59 +0000 (09:01 -0500)
commit68d85f0a33b0cbfe4921485160ff75ea7a081215
treef9ffafb6c1f77ebb3f239766ddd1a1e99f418aa3
parent5bd2e97c868a8a44470950ed01846cab6328e540
init: Deal with the init process being a user mode process

It is silly for user_mode_thread to leave PF_KTHREAD set
on the resulting task.  Update the init process so that
it does not care if PF_KTHREAD is set or not.

Ensure do_populate_rootfs flushes all delayed fput work by calling
task_work_run.  In the rare instance that async_schedule_domain calls
do_populate_rootfs synchronously it is possible do_populate_rootfs
will be called directly from the init process.  At which point fput
will call "task_work_add(current, ..., TWA_RESUME)".  The files on the
initramfs need to be completely put before we attempt to exec them
(which is before the code enters userspace).  So call task_work_run
just in case there are any pending fput operations.

Link: https://lkml.kernel.org/r/20220506141512.516114-5-ebiederm@xmission.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
init/initramfs.c