Live data from Hacker News

Boot Naked Linux

nick.zoic.org

11–20 of 60 posts

Re: Boot Naked Linux

#11
post #3

I... fail to see the point of running just one process. If it's just a PoC, then: 1) I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. 2) To print some text or run a simple program, I belive DOS without a memory manager would be even faster. 3) It takes 1s to boot linux, but an ordinary PC takes 10s to get to that linux. Even U-boot on…

> I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. Do you remember any details that would let me search for it? Because that does sound cool, and even maybe useful; the thought has certainly crossed my mind that a router or VPN box doesn't really get a lot of use out of userspace... Although maybe it's worth keeping for control/configu…

IIRC, it ran a script as init process that set up the network cards, set up iptables, etc. and then just exited. Kernel would panic (the "init was killed" panic), but the network would still be functional. Automatic reboot on panic was disabled.

To reconfigure, the admin would simply reset it and start the system with "init=/something/else" as kernel parameter that booted to a normal userspace.

Re: Boot Naked Linux

#13
post #11

Earlier quoted context omitted.

> I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. Do you remember any details that would let me search for it? Because that does sound cool, and even maybe useful; the thought has certainly crossed my mind that a router or VPN box doesn't really get a lot of use out of userspace... Although maybe it's worth keeping for control/configu…

IIRC, it ran a script as init process that set up the network cards, set up iptables, etc. and then just exited. Kernel would panic (the "init was killed" panic), but the network would still be functional. Automatic reboot on panic was disabled. To reconfigure, the admin would simply reset it and start the system with "init=/something/else" as kernel parameter that booted to a normal userspace.

Oh, clever; I didn't know you could make Linux panic but keep running.

Re: Boot Naked Linux

#14
post #3

I... fail to see the point of running just one process. If it's just a PoC, then: 1) I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. 2) To print some text or run a simple program, I belive DOS without a memory manager would be even faster. 3) It takes 1s to boot linux, but an ordinary PC takes 10s to get to that linux. Even U-boot on…

> I... fail to see the point of running just one process.

It makes sense if you got some legacy piece of hardware that has extremely limited resources, both in terms of RAM and storage. Write your code in Go and you don't even need libc any more.

Re: Boot Naked Linux

#15
Cool article! I'm working on a tangentially related issue requiring microVMs inside isolated infrastructure environments. Latency isn't really my main priority, but I am always tempted by any option to minimize attack surface. I wonder what it would take to replace the host block mount in this configuration with `vsock` for all communications between the host and guest microVM? Then you could avoid any files being mounted on the host at all while still enabling, e.g., one-way egress to a pre-signed S3 URL via a private VPC endpoint. Very cool article!

Re: Boot Naked Linux

#18
post #3

I... fail to see the point of running just one process. If it's just a PoC, then: 1) I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. 2) To print some text or run a simple program, I belive DOS without a memory manager would be even faster. 3) It takes 1s to boot linux, but an ordinary PC takes 10s to get to that linux. Even U-boot on…

> I... fail to see the point of running just one process. It makes sense if you got some legacy piece of hardware that has extremely limited resources, both in terms of RAM and storage. Write your code in Go and you don't even need libc any more.

At that point, it would seem that an RTOS would be even more efficient - and if multithreading is not necessary, then just run it on bare metal.

Re: Boot Naked Linux

#19

Cool article! I'm working on a tangentially related issue requiring microVMs inside isolated infrastructure environments. Latency isn't really my main priority, but I am always tempted by any option to minimize attack surface. I wonder what it would take to replace the host block mount in this configuration with `vsock` for all communications between the host and guest microVM? Then you could avoid any files being mo…

Amazon Nitro Enclave does pretty much this, the guest has one method of communication, via vsock, and it's up to you to build the pipes on either side.

It's a huge PITA in practice because whatever you want to run inside some enclave usually ends up being a 'normal program' that needs to talk TCP/IP over sockets... so your vsock I/O becomes a weird mix between a TUN proxy or a SOCKS5 local listener inside the VM that tunnels through vsock.

For example, I have the Windows NT 3.50 kernel compiling from scratch with virtio-net drivers, it's fairly straightforward for me to add a bus driver that runs over vsock inside Nitro Enclave that exposes itself (o,o) as a NIC then handle the tunneling logic in a usermode process in the host - but I don't uderstand the point of why you would do that when you already have sufficient attestation methods that don't require you to do vsock isolation.

Re: Boot Naked Linux

#20
post #3

I... fail to see the point of running just one process. If it's just a PoC, then: 1) I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. 2) To print some text or run a simple program, I belive DOS without a memory manager would be even faster. 3) It takes 1s to boot linux, but an ordinary PC takes 10s to get to that linux. Even U-boot on…

> I remember seeing a linux firewall/gateway set up to run with just the kernel, without any userspace at all. Completely unhackable. Do you remember any details that would let me search for it? Because that does sound cool, and even maybe useful; the thought has certainly crossed my mind that a router or VPN box doesn't really get a lot of use out of userspace... Although maybe it's worth keeping for control/configu…

> control/configuration/debugging

This is one of several major arguments made against unikernels in that famous Triton rant from a decade ago:

https://tritondatacenter.com/blog/unikernels-are-unfit-for-p...

Basically, even if your application _can_ run as the kernel, and it's desirable for it to run with kernel-level permissions, do you really want production to be a world without strace and iotop and the like?

Post reply on HN