public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Jesse Barnes <jsbarnes@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] remove ksys_mount() and ksys_dup()
Date: Wed, 18 Dec 2019 13:37:12 +0000	[thread overview]
Message-ID: <20191218133712.GK4203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20191218075119.GA186397@light.dominikbrodowski.net>

On Wed, Dec 18, 2019 at 08:51:19AM +0100, Dominik Brodowski wrote:
> On Tue, Dec 17, 2019 at 10:57:43PM +0000, Al Viro wrote:
> > Seriously, these parts of init/* ought to be treated as userland code
> > that runs in kernel mode mostly because it's too much PITA to arrange
> > building a static ELF binary and linking it into the image.
> 
> Well, we have had the infrastructure for fork_usermode_blob() in the kernel
> since May 2018, though it is not really used so far (the bpfilter blob is
> just reporting its existence, and not doing anything substantial). Probably,
> significant parts of init/* could be migrated to such a blob. Would that be
> an alternative generally preferred, or is its dependence on CC_CAN_LINK a
> showstopper?

Well...  everything from default_rootfs/populate_rootfs call (incidentally,
stuff starting to leak into rootfs_initcall level shouldn't be mixed
with those two, but that's a separate story) and on to the end of
kernel_init_freeable() could be forked; the other bit (actual execve
attempts in the end of kernel_init()) must be in PID 1.

The problem is not just CC_CAN_LINK, it's the damn size of binaries...

> FWIW, non-initramfs boot code is considered to be "legacy" since 2.6.16, see
> filesystems/ramfs-rootfs-initramfs.txt:
> 
> | Today (2.6.16), initramfs is always compiled in, but not always used.  The
> | kernel falls back to legacy boot code that is reached only if initramfs does
> | not contain an /init program.  The fallback is legacy code, there to ensure a
> | smooth transition and allowing early boot functionality to gradually move to
> | "early userspace" (I.E. initramfs).
> |
> | ...
> |
> | This kind of complexity (which inevitably includes policy) is rightly handled
> | in userspace.  Both klibc and busybox/uClibc are working on simple initramfs
> | packages to drop into a kernel build.
> |
> | The klibc package has now been accepted into Andrew Morton's 2.6.17-mm tree.
> | The kernel's current early boot code (partition detection, etc) will probably
> | be migrated into a default initramfs, automatically created and used by the
> | kernel build.
> 
> That plan seems to have been obsoleted long ago, right?

klibc is not in mainline and I hadn't heard of attempts to get it into the
kernel git tree for quite a few years.  Whether this "just call sys_...()
instead of doing normal syscalls" is a stopgap measure until that happens
or something more permanent, the effect is the same - not poking in the
kernel internals from code with lousy test coverage...

  reply	other threads:[~2019-12-18 13:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 18:14 [GIT PULL] remove ksys_mount() and ksys_dup() Dominik Brodowski
2019-12-12 18:14 ` [PATCH 1/5] devtmpfs: use do_mount() instead of ksys_mount() Dominik Brodowski
2019-12-12 18:14 ` [PATCH 2/5] initrd: " Dominik Brodowski
2019-12-12 18:14 ` [PATCH 3/5] init: " Dominik Brodowski
2019-12-16  9:45   ` Borislav Petkov
2019-12-16  9:51     ` Dominik Brodowski
2019-12-16 10:19       ` Borislav Petkov
2019-12-12 18:14 ` [PATCH 4/5] init: unify opening /dev/console as stdin/stdout/stderr Dominik Brodowski
2019-12-12 18:14 ` [PATCH 5/5] fs: remove ksys_dup() Dominik Brodowski
2019-12-15 19:50 ` [GIT PULL] remove ksys_mount() and ksys_dup() Linus Torvalds
2019-12-15 20:50 ` pr-tracker-bot
     [not found]   ` <CAJmaN=ksaH5AgRUdVPGWKZzjEinU+goaCqedH1PW6OmKYc_TuA@mail.gmail.com>
2019-12-17 19:37     ` Greg Kroah-Hartman
2019-12-17 20:05       ` Jesse Barnes
2019-12-17 20:40     ` Linus Torvalds
2019-12-17 22:21       ` Jesse Barnes
2019-12-17 22:57         ` Al Viro
2019-12-17 23:23           ` Al Viro
2019-12-18  7:51           ` Dominik Brodowski
2019-12-18 13:37             ` Al Viro [this message]
2019-12-17  5:17 ` [PATCH 4/5] init: unify opening /dev/console as stdin/stdout/stderr youling257
2019-12-17  6:42   ` Dominik Brodowski
2019-12-17  9:33     ` youling 257
2019-12-17 21:14       ` Linus Torvalds
2019-12-18  4:10         ` youling 257
2019-12-18  8:03           ` Dominik Brodowski
2019-12-18 21:50         ` youling 257
2019-12-19  7:08           ` Dominik Brodowski
2019-12-19  9:34             ` youling 257

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=20191218133712.GK4203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsbarnes@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=mingo@kernel.org \
    --cc=rafael@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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