4 ms·
Isn't that link showing the opposite? That sudo is really large and systemd isn't? They even compare systemd with wpa_supplicant and it turns out they are the s
by mzi 2y ago
Isn't that link showing the opposite? That sudo is really large and systemd isn't? They even compare systemd with wpa_supplicant and it turns out they are the same size.
- rstuart4133 2y agoNot really. I'm not going the effort of breaking it down like he did, so just looking at total lines in the source calculated with "wc -l $(find . -type f)": sudo: 284,103 systemd: 1,981,535
- logicprog 2y agoI find your comment here sadly indicative of the level of discussion around systemd from its haters. Your metric is utterly misleading not only because you're almost certainly counting non-code files, but more crucially, because the systemd repository contains the code for *sixty-nine* entirely separate binaries, separate tools under the overall systemd project umbrella, so counting their collective code size as if it is the code base of one single gigantic tool, a single gigantic program that compiles into a single gigantic binary, with all the interweaving that implies, is just disingenuous at best. That number does not represent the size of a single attack surface area, and pretending it does is nonsensical. It's like pulling in the source of all of gnu and doing a line count. And for the record, I've actually done this properly, cloning the systemd repository and then reading the documentation to figure out what directories and source files did what, and assembled a list of the directories and source files that represented just systemd-the-init-system, and got about 240,000 lines of code. And remember, it won't actually be systemd the init system that will be replacing sudo, it will be systemd-run, which is a separate binary, with a separate memory space, and a separate permissions model, that merely communicates with systemd the init system to get certain things done. I guarantee you it's probably smaller than the code base of sudo, and this architecture, as LP points out if you actually read his thread on mastodon, far better represents the methodology of running things with at least privilege and privilege separation and so on, because instead of having the binary that is called from unprivileged space managing transitioning itself into privileged space and then doing things, instead the binary always stays unprivileged and just communicates via a strictly defined IPC protocol that gives it no direct abikity to do anything with a process that was already privileged instead, that can decide what to do on its own. Let me leave you with this quote: > If you build systemd with all configuration options enabled you will build 69 individual binaries. These binaries all serve different tasks, and are neatly separated for a number of reasons. For example, we designed systemd with security in mind, hence most daemons run at minimal privileges (using kernel capabilities, for example) and are responsible for very specific tasks only, to minimize their security surface and impact. Also, systemd parallelizes the boot more than any prior solution. This parallization happens by running more processes in parallel. Thus it is essential that systemd is nicely split up into many binaries and thus processes. In fact, many of these binaries[1] are separated out so nicely, that they are very useful outside of systemd, too. > A package involving 69 individual binaries can hardly be called monolithic. What is different from prior solutions however, is that we ship more components in a single tarball, and maintain them upstream in a single repository with a unified release cycle. https://0pointer.de/blog/projects/the-biggest-myths.html https://0pointer.de/blog/projects/the-biggest-myths.html
- rstuart4133 2y agoTwo things: - Non code files were counted for both sudo and systemd. That's because I'm lazy, not because I think it influences the result one way or the other (I don't what effect it would have). - Separate binaries are not separate logical entities. Pointing to separate binaries is a misdirection. systemd is a set of binaries cooperating using RPC (dbus) to yield something bigger than any single binary. The biggest hint they are interconnected is they are in one source ball for a reason: so these binaries can share a lot of code and interact in complex ways. As for systemd-run being "a separate binary, with a separate memory space, and a separate permissions model", those things didn't protect openssh being hit with the XZ Utils hack via systemd. An unexpected interconnection is more than enough. systemd abounds with interconnections. Being tightly interconnected often gives you greater functionality, and in the case of Run0 I suspect that is going to be a big win because systemd has a lot of process isolation mechanisms built in. But complex interconnected systems achilles heel is security, and that's definitely true here.
- jchw 2y ago> Separate binaries are not separate logical entities. They're separate programs, sometimes essentially completely independent, sometimes sharing almost no code at all. For example, systemd-init does not have dependencies on all of the other programs, or vice versa. You can use the systemd-boot bootloader without using systemd's init daemon. You can use the systemd init daemon without using the systemd-boot bootloader. Having separate release tarballs isn't some special distinction that makes things more "logically separate". Besides, isn't this a goalpost shift of epic proportions? > That is a bit rich coming from the author of systemd, which must be in the running for one of the largest bodies of code that must run as root The point in indicting the size of systemd was the code that runs as root, but the wc line count is counting tons of stuff that not only doesn't all run as root, but some of it doesn't even run under Linux. > those things didn't protect openssh being hit with the XZ Utils hack via systemd A lot has already been said about this before, but the systemd library that they included in the Debian and Fedora patches to OpenSSH is by far one of the smallest surface areas of any of the runtime dependencies. A bit ago, when I ran libtree on sshd, I got this: $ libtree `which sshd` /run/current-system/sw/bin/sshd ├── libgssapi_krb5.so.2 [runpath] │ ├── libkrb5.so.3 [runpath] │ │ ├── libk5crypto.so.3 [runpath] │ │ │ ├── libkrb5support.so.0 [runpath] │ │ │ │ ├── libkeyutils.so.1 [runpath] │ │ │ │ └── libresolv.so.2 [runpath] │ │ │ ├── libkeyutils.so.1 [runpath] │ │ │ └── libresolv.so.2 [runpath] │ │ ├── libcom_err.so.3 [runpath] │ │ │ ├── libkrb5support.so.0 [runpath] │ │ │ ├── libkeyutils.so.1 [runpath] │ │ │ └── libresolv.so.2 [runpath] │ │ ├── libkrb5support.so.0 [runpath] │ │ ├── libkeyutils.so.1 [runpath] │ │ └── libresolv.so.2 [runpath] │ ├── libk5crypto.so.3 [runpath] │ ├── libcom_err.so.3 [runpath] │ ├── libkrb5support.so.0 [runpath] │ ├── libkeyutils.so.1 [runpath] │ └── libresolv.so.2 [runpath] ├── libkrb5.so.3 [runpath] ├── libcom_err.so.3 [runpath] ├── libk5crypto.so.3 [runpath] ├── libz.so.1 [runpath] ├── libcrypto.so.3 [runpath] │ └── libpthread.so.0 [runpath] ├── libldns.so.3 [runpath] │ ├── libssl.so.3 [runpath] │ │ ├── libcrypto.so.3 [runpath] │ │ └── libpthread.so.0 [runpath] │ └── libcrypto.so.3 [runpath] └── libpam.so.0 [runpath] └── libaudit.so.1 [runpath] And that's just what you can see by looking at the shared objects, there might be more at runtime. You would have to ignore mountains of rationality in order to come to the conclusion that systemd was remotely reasonably "at fault" for what happened with the xz incident. Not only that, even prior to the xz incident, systemd had already fixed the problem that lead to the xz exploit, it just wasn't shipping in Debian or Fedora yet; that's most likely why the xz backdoor had to be rushed into the next releases in the first place, because the window of opportunity was closing.