[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADyq12xRZfafeu1PVxB1G9zTgThB0W5nok2eXPFLC+T28-b-Bg@mail.gmail.com>
Date: Fri, 29 Sep 2023 20:25:42 -0400
From: Brian Geffon <bgeffon@...gle.com>
To: Kees Cook <keescook@...omium.org>
Cc: Christian Brauner <brauner@...nel.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Matthias Kaehlcke <mka@...omium.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Frederic Weisbecker <frederic@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pid: Allow frozen userspace to reboot from non-init pid ns
On Fri, Sep 29, 2023 at 4:09 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Fri, Sep 29, 2023 at 01:44:42PM -0400, Brian Geffon wrote:
> > When the system has a frozen userspace, for example, during hibernation
> > the child reaper task will also be frozen. Attmepting to deliver a
> > signal to it to handle the reboot(2) will ultimately lead to the system
> > hanging unless userspace is thawed.
> >
> > This change checks if the current task is the suspending task and if so
> > it will allow it to proceed with a reboot from the non-init pid ns.
>
> I don't know the code flow too well here, but shouldn't init_pid_ns
> always be doing the reboot regardless of anything else?
I think the point of this is, normally the reaper is runnable and so
an appropriate signal will be delivered allowing them to also clean up
[2]. In our case, they won't be runnable and doing this wouldn't make
sense.
>
> Also how is this syscall running if current is frozen? This feels weird
> to me... shouldn't the frozen test be against pid_ns->child_reaper
> instead of current?
The task which froze the system won't be frozen to make sure this
happens it will have the flag PF_SUSPEND_TASK added, so we know if we
have this flag we're the only running user space task [1].
>
> -Kees
I hope my understanding is correct and it makes sense. Thanks for
taking the time to review.
Brian
1. https://elixir.bootlin.com/linux/latest/source/kernel/power/process.c#L130
2. https://elixir.bootlin.com/linux/latest/source/kernel/pid_namespace.c#L327
>
> --
> Kees Cook
Powered by blists - more mailing lists