Re: [PATCH 2/2] init: ensure that /dev/null is (nearly) always available in initramfs

Askar Safin <[email protected]> Tue, 24 Feb 2026 00:18:48 +0300
Newsgroups org.kernel.vger.initramfs,dev.linux.lists.patches,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kbuild,org.kernel.vger.linux-kernel
Message-ID <CAPnZJGDDFrOObdxa70nSS0bqXQ0zqRPnKWLRFUBCj-FtnkpPtg@mail.gmail.com>
On Mon, Feb 23, 2026 at 4:15=E2=80=AFAM Rob Landley <[email protected]> wrote=
:
> Are you saying it's reoccurred, or that you plan to run a 5 year old
> userspace with a current kernel?

I was not aware about this. Okay, I agree that /dev/null is not needed.

> (Although I can't say I've regression tested an init task statically
> linked against bionic launching itself in an empty chroot recently
> either.

I tested current Android NDK LTS. I found that if stdin/stdout/stderr
already opened, then bionic binary will not crash if /dev/null is absent.
It will not crash even if PID is not 1 (so chroot should work).
But I didn't test what happens if stdin/stdout/stderr are closed.
So, assuming you already somehow got /dev/console, then
/dev/null is not needed.

According to code, bionic binary should work even if stdin/stdout/stderr ar=
e
closed, assuming that PID is 1.

--
Askar Safin