3 ms·
This is definitely a Lennart Poettering post: it advocates for a change that will break existing code, and then says that said code "should probably be consider
by josephcsible 6y ago
This is definitely a Lennart Poettering post: it advocates for a change that will break existing code, and then says that said code "should probably be considered just buggy".
- xyzzy_plugh 6y agoHe's arguing that it already is buggy, and I agree. The fact that select doesn't work on more than 1024 fds is terrible. It's incredibly easy to break things by changing the limits. Bumping FD limits is extremely common. I'm honestly surprised I've never run into this first hand, but perhaps I wouldn't have noticed even if I had. Sure, Lennart is perhaps the Antichrist of Linux, but I'm pretty positive he's the Antichrist we need. The long-lived fear of breaking existing code is certainly valid, but at the same time, why not try and see what will break before we write something off. It's often not much. It's practically the only way for us to shed the crufty bits, and boy are there a lot of those.
- phone8675309 6y agoLennart can't be the Antichrist of Linux because the antichrist is beloved by all. :-)
- moises_silva 6y ago> The fact that select doesn't work on more than 1024 fds is terrible. Pedantic clarification, but it's worse than that. It doesn't work on any fd with a value higher than FD_SETSIZE (default is 1024) - 1. You could be working with single fd with a value of 1024 and it would not work. On the bright side you can extend this limit pretty easily, but it's certainly a good reason to avoid select whenever possible.
- phendrenad2 6y agoTo be clear - he's not advocating for a change to Linux or systemd. He's reiterating an already commonly accepted best practice going forward. ...which unfortunately due to the Linux ecosystem, where people apparently like to inject code into running processes (https://skarnet.org/software/nsss/nsswitch.html https://skarnet.org/software/nsss/nsswitch.html) (can't imagine this is brittle at all), can cause your program to break if someone injects a module that doesn't ALSO follow this best practice into your program.
- tadfisher 6y agoSee also: PAM, probably a much more enticing target. I wonder if something like the eBPF compiler could be repurposed here, to generate lightweight "binaries" for a configuration that can be linked without needing to dynamically link their own dependencies at runtime.
- LukeShu 6y agoFew programs load PAM modules, essentially all programs load NSS modules.
- dale_glass 6y agoI really hope Poettering decides to fix PAM too. It's well overdue. IMO PAM should be replaced with a daemon. This way all the code that deals with authentication can be isolated into its own process, and my screensaver doesn't need root access to check my password against /etc/shadow. It'll also simplify SELinux settings.
- jvreeland 6y agoI mean we've known for a while select is broken that code is probably buggy and insecure. https://sourceware.org/bugzilla/show_bug.cgi?id=10352#c1 https://sourceware.org/bugzilla/show_bug.cgi?id=10352#c1 https://marc.info/?l=bugtraq&m=110660879328901 https://marc.info/?l=bugtraq&m=110660879328901
- toast0 6y agoWhat's changing here that breaks existing code? I'm not a Linux person, but select requiring help to work beyond FD 1023 isn't new. It also happens on FreeBSD and MacOS, so either you recompile your software (including glibc on linux, apparently) with a bigger FD_SETSIZE, or you use one of the better than select interfaces that doesn't care. If you tuned your FD limit higher, you're already on the hook for knowing about it. Keeping the default soft limit of 1024 means that programs that don't fiddle with the soft limit can have a working select, and programs that do fiddle with the soft limit should know better. Auto tuning the hard limit to something appropriately sized seems reasonable, but fiddling with the soft limit may end up with this select problem, so it's nice that they didn't fiddle with it. Also, I'm deeply surprised to be defending Mr. Poettering, but in this case, he's right.