Re: [GIT PULL] remove ksys_mount() and ksys_dup()

From: Jesse Barnes
Date: Tue Dec 17 2019 - 17:21:17 EST


On Tue, Dec 17, 2019 at 12:40 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Dec 17, 2019 at 11:33 AM Jesse Barnes <jsbarnes@xxxxxxxxxx> wrote:
> >
> > Still debugging, but this causes a panic in console_on_rootfs() when we try to dup the fds for stderr and stdout.
>
> Duh.
>
> That series was incredibly buggy, and there's another bug in there.
>
> I think this should fix it:
>
> diff --git a/init/main.c b/init/main.c
> index ec3a1463ac69..1ecfd43ed464 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -1163,7 +1163,7 @@ void console_on_rootfs(void)
>
> /* Open /dev/console in kernelspace, this should never fail */
> file = filp_open("/dev/console", O_RDWR, 0);
> - if (!file)
> + if (IS_ERR(file))
> goto err_out;
>
> /* create stdin/stdout/stderr, this should never fail */
>
> and yes,that particular problem only triggers when you have some odd
> root filesystem without a /dev/console. Or a kernel config that
> doesn't have those devices enabled at all.
>
> I delayed pulling it for a couple of days, but the branch was not in
> linux-next, so my delay didn't make any difference, and all these
> things only became obvious after I pulled. And while it was all
> horribly buggy, it was only buggy for the "these cases don't happen in
> a normal distro" case, so the regular use didn't show them.
>
> My bad. I shouldn't have pulled this, but it all looked very obvious
> and trivial.

Oh I should have caught that too, I was looking right at it...

But anyway it looks like a nice cleanup with a few more fixes.
Hopefully we can get there soon...

Thanks,
Jesse