News for hackers. Stuff that matters.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by unmole on Tuesday July 20, 2021 @01:08PM (#27896380)
Wait how does a user space daemon exhausting its stack lead to a kernel panic?
Re:size_t-to-int vulnerability in Linux’s filesystem layer by comex on Tuesday July 20, 2021 @01:20PM (#27896520)
Because the kernel intentionally panics [1] if the init process would otherwise exit in any way – whether because it called exit(), it was killed, or, in this case, it crashed.

This is likely because Unix semantics treat the init process specially: any process whose parent dies is re-parented to the init process. It's not clear what should happen to these processes if the init process itself went away, so the kernel just gives up.

[1] https://elixir.bootlin.com/linux/latest/source/kernel/exit.c...

Re:size_t-to-int vulnerability in Linux’s filesystem layer by Denvercoder9 on Tuesday July 20, 2021 @04:29PM (#27898878)
I wonder if just restarting PID1 could be viable alternative?
Re:size_t-to-int vulnerability in Linux’s filesystem layer by jerf on Tuesday July 20, 2021 @04:33PM (#27898921)
It's generally dangerous to restart PID1 in an enviroment where, by definition, something happened to PID1 that it wasn't expecting. The state of the system is now unreliable, and it's exactly the sort of unreliable in exactly the right place that tends to lead to whopping security issues. Far too easy to end up with "Crash PID1 with 'blah blah blah', then when it restarts it ends up doing bad things X & Y".
Re:size_t-to-int vulnerability in Linux’s filesystem layer by cameronh90 on Tuesday July 20, 2021 @05:59PM (#27899919)
Perhaps a distinction here can be made between running as a server OS and a desktop OS.

In a server I generally want a crash immediately. But on a desktop I'd rather it limp along and give me a chance to finish writing my Hackernews post.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by bigiain on Tuesday July 20, 2021 @08:15PM (#27900826)
I'd rather push the other way on that. We should treat desktops with as much security paranoia at servers.

I'd much rather _not_ have my desktop "limp along" in a poorly understood and probably exploitable fashion while the malware gets a chance to finish encrypting all my files...

If that costs the world the "benefit" of my shared wisdom in a half written Hackernews post, I'm good with that.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by lanstin on Tuesday July 20, 2021 @09:35PM (#27901318)
I run a a lot more untrusted code on my laptop than on my cloud servers. Likewise for work, even more so as I don’t myself trust the spyware/malware they jam on the laptops.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by jerf on Wednesday July 21, 2021 @09:16AM (#27905804)
Basically, there's no solution at this level of granularity. One can also argue that the desktop is where the most important stuff is that we least want hacked, e.g., your family photos, documents, other stuff with a high priority of not being backed up, so we must treat security even higher than a server at this point.

I call these the "already lost" situations. You've already lost, we're just arguing about how to distribute the lossage. While those discussions aren't completely pointless, it is important to keep it clear in our head we're arguing about how to pick up the bodies at a crash site and not how to prevent the crash in the first place; it's a different mindset.

Despite some moderately-justified mockery in the other messages in this thread, the answer really is "just don't crash and have secure code here", which is to say, "don't lose". It's exceeding hard to write and it's a very high bar, but at the same time, it's very difficult to imagine how to secure a single system when you can't even stipulate a core of trusted software exists. If you don't even have a foundation, you're not going to build a secure structure. In this case, by "secure" I don't just mean security, but also, functionality and everything else.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by londons_explore on Tuesday July 20, 2021 @06:36PM (#27900191)
On a server I'd usually want it to limp along too... Better fire an alert but keep happy customers than cause a massive outage just because of someone's overly strict checkfail...

It depends really what your server does, and what the consequences of it doing the wrong thing are.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by bigiain on Tuesday July 20, 2021 @08:23PM (#27900878)
If the consequences of one server wedging itself is a "massive outage" and "unhappy customers", then you probably don't really care about that outage or those customers. If you don't have enough redundancy and alerting and automated disaster recovery to keep your customer facing shit up when one server panics, you're just relying on luck to keep your customers happy.

Fire an alert, remove that server from the load balancer, and fix the problem without your customers even noticing.

Or make sure if you're running a hobby-project architected platform that your customer expectations and SLAs are clear up front, and let it go down until Monday morning when you'll get around to fixing it.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by michaelmrose on Tuesday July 20, 2021 @07:36PM (#27900566)
Or just don't put stuff that crashes in pid1
Re:size_t-to-int vulnerability in Linux’s filesystem layer by modshatereality on Tuesday July 20, 2021 @10:31PM (#27901718)
seriously, if you're doing allocations in pid1 you fucked up.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by afc on Tuesday July 20, 2021 @08:52PM (#27901054)
Yeah, great idea: rather than worry about how to deal with software bugs, just never have bugs...
Re:size_t-to-int vulnerability in Linux’s filesystem layer by a1369209993 on Wednesday July 21, 2021 @01:36AM (#27902688)
Exactly. This is why systemd is a terrible design. The fastest and most secure code, that never crashes and never needs patching, is code that doesn't exist.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by michaelmrose on Tuesday July 20, 2021 @09:07PM (#27901147)
runit.c is 330 lines of code

Keeping it small and simple to minimize bugs is perfectly viable and reasonable.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by dirkt on Wednesday July 21, 2021 @12:26AM (#27902323)
A better alternative would be to keep PID1 as simple as possible, and do anything more complex in a subprocess.

Systemd of course goes in the opposite direction: It assimilates as much functionality as possible from the OS into systemd (though to be fair, not all into PID1).

Re:size_t-to-int vulnerability in Linux’s filesystem layer by monocasa on Tuesday July 20, 2021 @01:17PM (#27896491)
PID 1 is special in Unix systems. As the parent of all other processes (and child to none) it's not clear to the kernel what should happen when it exits.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by mjevans on Tuesday July 20, 2021 @06:45PM (#27900254)
Poorly designed security architecture and division of labor. A more idealized init / systemd would have all of the execution flow of PID 1 mathematically provably correct, and correspondingly have as small a footprint as possible there. All additional functions would run under one or more child processes (where the bulk of systemd would execute).
Re:size_t-to-int vulnerability in Linux’s filesystem layer by bigiain on Tuesday July 20, 2021 @08:30PM (#27900921)
"Lets put the graphics drivers in ring 0, for better performance!" -- Windows NT architects, 1996

"Ummm, lets not do that, it's not such a great idea..." -- Windows Vista team, 2006

Re:size_t-to-int vulnerability in Linux’s filesystem layer by fomine3 on Wednesday July 21, 2021 @12:15AM (#27902261)
Initial Windows NT uses user mode graphic driver, then NT 4.0 move it kernel mode.

https://docs.microsoft.com/en-us/previous-versions//cc750820...

Re:size_t-to-int vulnerability in Linux’s filesystem layer by bigiain on Wednesday July 21, 2021 @01:41AM (#27902712)
Yep. In about '96.

(Well, it came out late '96, so I suppose a bunch of that was actually done in '95.)

Re:size_t-to-int vulnerability in Linux’s filesystem layer by Spivak on Tuesday July 20, 2021 @10:43PM (#27901791)
Different trade offs for different eras and different constraints.
Re:size_t-to-int vulnerability in Linux’s filesystem layer by failwhaleshark on Wednesday July 21, 2021 @12:06AM (#27902219)
Systemd is a swiss-army-kitchen-sink-knife monolith of brittle complexity.

A proper init system similar to runit or s6 would be written in something safer (minimum unsafe) like Rust, be modular, simpler, follow UNIX philosophy, and not try to do everything in one process. Microkernel-style.

Re:size_t-to-int vulnerability in Linux’s filesystem layer by paulddraper on Tuesday July 20, 2021 @03:16PM (#27897947)
Because it's PID 1.