Recently posted comments
Rethinking race-free process signaling
Posted Apr 11, 2019 7:04 UTC (Thu) by wahern (subscriber, #37304)In reply to: Rethinking race-free process signaling by rweikusat2
Parent article: Rethinking race-free process signaling
Once all the boilerplate code is in place it's seems like alot of unnecessary complexity compared to having started with something like a signalfd or eventfd. OTOH, for some things, such as catching SIGSEGV to extend mmap'd stack data structures, or to interrupt and switch program flow without tight, language-level integration of components, the old semantics are indispensable.
Threading semantics compound the headaches. But as for cancelations in particular--I don't think anybody defends the idea any longer. It's almost a strawman at this point as few if applications actually use them and implementations effectively disclaim liability. I'm surprised there's no movement to remove cancellations from implementations, POSIX, or both.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 6:55 UTC (Thu) by nilsmeyer (guest, #122604)In reply to: Microsoft research: A fork() in the road by Cyberax
Parent article: Microsoft Research: A fork() in the road
Is that conjecture or can you back up that claim with data? That might make for an interesting research project.
> A special checkpoint/restore functionality for people who NEED it explicitly (see: Redis) would be much better.
That's an interesting idea, is there an implementation of that in any OS? The problem is as long as you don't have a critical mass of systems implementing the new semantics you'll still have to use fork() and then the question quickly becomes whether or not it's worthwhile to cover other cases.
> After all, why should this very niche use dictate the design of the OS?
Compatibility with existing software.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 6:48 UTC (Thu) by nilsmeyer (guest, #122604)In reply to: Microsoft research: A fork() in the road by roc
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 11, 2019 6:42 UTC (Thu) by nilsmeyer (guest, #122604)In reply to: Microsoft research: A fork() in the road by sjfriedl
Parent article: Microsoft Research: A fork() in the road
Isn't that how teaching works, at least in the beginning?
A backdoor in a popular Ruby gem
Posted Apr 11, 2019 6:36 UTC (Thu) by nilsmeyer (guest, #122604)In reply to: A backdoor in a popular Ruby gem by eru
Parent article: A backdoor in a popular Ruby gem
Microsoft research: A fork() in the road
Posted Apr 11, 2019 6:35 UTC (Thu) by pabs (subscriber, #43278)Parent article: Microsoft Research: A fork() in the road
A backdoor in a popular Ruby gem
Posted Apr 11, 2019 6:23 UTC (Thu) by eru (subscriber, #2753)In reply to: A backdoor in a popular Ruby gem by NYKevin
Parent article: A backdoor in a popular Ruby gem
You are describing a "CI" setup for reproducible builds. That can actually also be a carrot for developers involved in large code bases like browsers or LibreOffice, where building on the developers desktop might take hours.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 6:22 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)In reply to: Microsoft research: A fork() in the road by joncb
Parent article: Microsoft Research: A fork() in the road
Most of the fork() stuff is used for simple fork+exec. Which is totally dumb.
A special checkpoint/restore functionality for people who NEED it explicitly (see: Redis) would be much better.
After all, why should this very niche use dictate the design of the OS?
Microsoft research: A fork() in the road
Posted Apr 11, 2019 5:38 UTC (Thu) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by pbonzini
Parent article: Microsoft Research: A fork() in the road
So after fork(), when there is only one thread in the child, it just creates its own new locks and synchronisation primatives and off it goes. No reinitialisation or destroying is needed in the child.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 5:32 UTC (Thu) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by epa
Parent article: Microsoft Research: A fork() in the road
One thing this can break is Valgrind, which creates some high numbered descriptors above the normal ulimit(). By testing the ulimit you can avoid closing these. Other libraries and tools may not be so lucky though, so an O_NOCLOEXEC maybe better, and it's actually a O_NOCLOFORK that would be best.
Working with UTF-8 in the kernel
Posted Apr 11, 2019 5:01 UTC (Thu) by lysse (guest, #3190)In reply to: Working with UTF-8 in the kernel by nix
Parent article: Working with UTF-8 in the kernel
Microsoft research: A fork() in the road
Posted Apr 11, 2019 4:24 UTC (Thu) by joncb (guest, #128491)Parent article: Microsoft Research: A fork() in the road
There's no OS police that will come knock down your door and arrest you if you don't implement fork in your research system. People create all kinds of research OSes that make all kinds of oddball decisions all the time, unikernels being a specific example of a system that (generally) doesn't implement fork (or certainly doesn't implement fork the same way as everyone else). Sure if you want a POSIX compatibility layer then you need to implement fork because fork is a required part of POSIX but if your hope is to change that then don't be surprised if people tell you to go to hell for wanting to inconvenience the roughly 20M software developers and 4B software users who rely on fork semantics on a daily basis to reduce the amount of work that maybe 10K of OS researchers will have to do in those rarish circumstances where they need to.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 4:08 UTC (Thu) by dw (guest, #12017)In reply to: Microsoft research: A fork() in the road by roc
Parent article: Microsoft Research: A fork() in the road
I don't think it's necessary to have any specially formatted stub, just a call like:
create_process(
/* helper program */
const char *path,
int argc,
const char *argv[],
const char *env[],
/* fds count */
int fdc,
/* mapped in new process 0..fdc */
int fds[]
);
Where libc might ship a static (and therefore almost invisibly fast) helper to interpret the contents of e.g. a memfd passed in on a known descriptor, the helper would initially implement the posix_spawn calls. An even simpler option might dump the FD mapping arguments for a fixed behaviour of starting the program with only one fd connected to a UNIX socket, with FD passing used as desired to communicate additional objects to the helper
The goal as with yours of course is to avoid putting any of this policy in the kernel again if it could be practically avoided, and making it simple to iterate the userspace helper without changing any OS interface or even having to wait for libc
A backdoor in a popular Ruby gem
Posted Apr 11, 2019 3:28 UTC (Thu) by NYKevin (subscriber, #129325)In reply to: A backdoor in a popular Ruby gem by david.a.wheeler
Parent article: A backdoor in a popular Ruby gem
Re #2: I strongly agree that reproducible builds are, in general, a very good thing.
However, applying reproducible builds to a free-for-all package repository like RubyGems, in practice, seems like it would be challenging. At a minimum, you would have to impose these restrictions on projects using reproducible builds ("reproducible projects"):
- RubyGems has to integrate with GitHub, and at least a half dozen smaller services-that-are-not-GitHub, or else force all reproducible projects onto GitHub. This may sound trivial, but it's a deal-breaker for the likes of the FSF.
- A standardized build process that every reproducible project uses, with no exceptions allowed, and probably with some restrictions on extensions and modifications to the build process.
- A standardized set of dependencies that reproducible projects' build processes are allowed to use, with no exceptions allowed.
- A standardized sandboxed environment in which the builds may be run without endangering the service as a whole.
- That sandbox is kept up-to-date (at least in terms of security vulnerabilities), but we must not alter the output of any builds. So the build's interaction with the sandbox, and with other software running in the sandbox if any, must be very carefully circumscribed to prevent it from behaving differently in response to updates.
Then, once you've finished specifying the above requirements (and #5 in particular is going to be an interesting circle to square), you have to persuade maintainers to put up with the above restrictions. This is despite the fact that they get rather nebulous benefits out of the whole thing, as do their end users. Barring some centralized organization mandating this work, I just don't see how it gets done.
Positional-only parameters for Python
Posted Apr 11, 2019 2:11 UTC (Thu) by k8to (guest, #15413)In reply to: Positional-only parameters for Python by quotemstr
Parent article: Positional-only parameters for Python
I think the fact that the arg names are exposed by default is essentially a good accident that forces interfaces to be a bit more usable than they are by default.
Amusingly I went to a good deal of trouble in some code I made to make the args keyword-only without making the implementation of the callsites harder to read. I had explicit documentation of how calls were required to be made, but used inspection to enforce it. I could used def func(**kwargs) but manually coding all the dispatch would have been really unfortunate.
Microsoft research: A fork() in the road
Posted Apr 11, 2019 2:10 UTC (Thu) by epa (subscriber, #39769)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
Development quotes of the week
Posted Apr 11, 2019 0:15 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)Parent article: Development quotes of the week
Called it!
https://lwn.net/Articles/652125/
https://lwn.net/Articles/675433/
To be fair, it did survive longer than I predicted.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:53 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)In reply to: Microsoft research: A fork() in the road by wahern
Parent article: Microsoft Research: A fork() in the road
Does it? Something like 90% of cases are simple fork-exec and they can migrate to posix_spawn() as is, even given its deficiencies.
Everything else can probably be expressed much simpler with a newer sane process API.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:45 UTC (Wed) by wahern (subscriber, #37304)In reply to: Microsoft research: A fork() in the road by warrax
Parent article: Microsoft Research: A fork() in the road
I think the authors would disagree with you. They claim (rightly) that CreateProcess and pthread_spawn are fundamentally incapable of the expressiveness necessary of a core primitive.
Read fairly their claim is that both CreateProcess and fork+exec suck. The fork+exec model is more expressive and powerful, CreateProcess less of a burden on the kernel and more performant. Their preferred alternative is cross-process operations, though as I mention elsethread the pros and cons basically mirror the debate regarding microkernels, IMO, and unsurprisingly (from the perspective of operating system researchers busily writing experimental kernels) substantially shifts the complexity burden to user space software.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:45 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)In reply to: Microsoft research: A fork() in the road by nix
Parent article: Microsoft Research: A fork() in the road
The most important part of this is sharing of FDs, and Linux could use something like DuplicateHandle from NT: https://docs.microsoft.com/en-us/windows/desktop/api/hand...
But again, this needs an API that has a process handle as a first-class object.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:43 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)In reply to: Microsoft research: A fork() in the road by wahern
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:37 UTC (Wed) by wahern (subscriber, #37304)In reply to: Microsoft research: A fork() in the road by nix
Parent article: Microsoft Research: A fork() in the road
But Unix *has* cross-process operations in ptrace. Nobody is really clamoring to use that interface to build a better fork replacement because fork *already* represents a compromise between how much complexity to put into the kernel and how much complexity to put into userspace, and additionally how costly (mostly in complexity, not performance) the implementation must be. It shouldn't be shocking that those responsible for the kernel side are complaining about having to put in so much work; nor should it be shocking that they heavily discount the cost to user space by shifting the remainder of the burden to them.
Taken to its logical end the paper's argument basically mirrors the same arguments as for microkernels. And while I think microkernels are great and am eagerly waiting an excuse to put seL4 to some use, fork+exec is sufficiently flexible and performant to have ushered in the age of containers and other more complex process management strategies.
While cross-process operations would be more powerful we can't underestimate the cost necessary in building the stack of software that would be necessary to bring the promise to reality. It's the same inconvenient truth as with microkernels. fork+exec is just too good enough, whether by accident or design.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:34 UTC (Wed) by evad (subscriber, #60553)In reply to: Microsoft research: A fork() in the road by randomguy3
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 22:25 UTC (Wed) by pbonzini (subscriber, #60935)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
Still not enough, as "attempting to destroy a locked mutex results in undefined behaviour" (from http://pubs.opengroup.org/onlinepubs/007908799/xsh/pthrea...).
Positional-only parameters for Python
Posted Apr 10, 2019 22:08 UTC (Wed) by quotemstr (subscriber, #45331)In reply to: Positional-only parameters for Python by yootis
Parent article: Positional-only parameters for Python
More about countermeasures
Posted Apr 10, 2019 22:04 UTC (Wed) by david.a.wheeler (subscriber, #72896)In reply to: A backdoor in a popular Ruby gem by david.a.wheeler
Parent article: A backdoor in a popular Ruby gem
I've extended my previous comment in Subversion of bootstrap-sass.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 21:48 UTC (Wed) by nix (subscriber, #2304)In reply to: Microsoft research: A fork() in the road by roc
Parent article: Microsoft Research: A fork() in the road
Their suggestion to get around that is to have system calls that let you change the state of the child from the parent.This is a very nice suggestion, indeed -- you can tell I've been through the fire, because my first thought was "if they're nice to use, we could replace most of ptrace() with them! yeaaaaahhhhhh!". (I mean, yes, PTRACE_SEIZE is far nicer than the old model, but it's still a horrible syscall to use, though much of its horror has to do with unrelated problems like signal handling that only apply to processes that have started running...)
Microsoft research: A fork() in the road
Posted Apr 10, 2019 21:42 UTC (Wed) by nix (subscriber, #2304)In reply to: Microsoft research: A fork() in the road by thoughtpolice
Parent article: Microsoft Research: A fork() in the road
*This* is a killer, because it means you are constrained to whatever process-setup code the people who specified the replacement (posix_spawn(), say) happened to think of, and you can't add to it because in a system without fork() you cannot implement your own spawn replacement, but have to rely on whatever limitations the one in the OS happened to provide. The fact that the posix_spawn() API family is already a horrible tentacular monster and is *still growing* and that it is trivial to generate scenarios it cannot handle suggests that this is a rather serious limitation, and a limitation that bites real code. (Even the scenarios it can handle are really hard to read because it has to handle so many cases that it really wants to be a programming language but isn't.)
A backdoor in a popular Ruby gem
Posted Apr 10, 2019 21:27 UTC (Wed) by david.a.wheeler (subscriber, #72896)Parent article: A backdoor in a popular Ruby gem
I'm glad that relatively few people downloaded the subverted gem. That said, there's clearly room to improve. Here are some thoughts:
- It appears that an attacker got the RubyGems credentials of a maintainer. Encouraging use of 2FA for updating packages would greatly reduce this risk in general and might have completely countered this attack. I’ll note that the CII best practices badge project (which I lead) requires this at the gold level, see: require_2FA
- The attackers subverted the distributed package on RubyGems without first posting the corresponding source code in its official source code repository on GitHub. That’s a big red flag. I believe package repositories should verify that code distributed can be reproducibly regenerated from its putative source. Such an approach would have prevented this attack, and also made the previous “event-stream” incident far more visible than it was. They don't need to change their inputs; accept a build, and check that the regenerating the build will produce the same thing. Package distribution systems could make it possible to enable this on a per-package basis, so this can be done incrementally. It will take a while to make this happen, but the first step is to agree to work towards it. For more about reproducibility, see the reproducible-builds.org website.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 21:20 UTC (Wed) by roc (subscriber, #30627)In reply to: Microsoft research: A fork() in the road by roc
Parent article: Microsoft Research: A fork() in the road
Even better, have the spawn() syscall specify an arbitrary executable to do the job of ld.so, and then pass the real executable to it as one of the parameters you send over IPC. Then you can do whatever you want to set up the process even if the standard component doesn't support it.
Of course the elephant in the room is that even if everyone in the world agrees that fork() should go, getting rid of it in the application software people care about is a very long-term project whose benefits would take a long time to be realised. Perhaps all the more reason to start working on a transition now, initially by designing, implementing and deploying the replacement APIs.
Managing sysctl knobs with BPF
Posted Apr 10, 2019 21:14 UTC (Wed) by josh (subscriber, #17465)Parent article: Managing sysctl knobs with BPF
Making slab-allocated objects movable
Posted Apr 10, 2019 21:06 UTC (Wed) by tcharding (guest, #118945)In reply to: Making slab-allocated objects movable by jhoblitt
Parent article: Making slab-allocated objects movable
Microsoft research: A fork() in the road
Posted Apr 10, 2019 21:00 UTC (Wed) by rweikusat2 (subscriber, #117920)In reply to: Microsoft research: A fork() in the road by ibukanov
Parent article: Microsoft Research: A fork() in the road
NB: I'm not going to read a paper presenting decades-old VMS 'design [irr]rationales' as 'new reseach'.
Positional-only parameters for Python
Posted Apr 10, 2019 20:52 UTC (Wed) by yootis (subscriber, #4762)Parent article: Positional-only parameters for Python
Why is it ever actually necessary to prevent the use of keyword arguments? The article mentions "what if the API changes", but to me that's all the more reason to use keyword arguments. At least you'd detect the problem. Forcing positional arguments sounds dangerous to me.
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 20:33 UTC (Wed) by mathstuf (subscriber, #69389)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by roc
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Microsoft research: A fork() in the road
Posted Apr 10, 2019 20:28 UTC (Wed) by roc (subscriber, #30627)Parent article: Microsoft Research: A fork() in the road
I've always found fork() much better than CreateProcess() because it's simply untenable for a single function call to set up every aspect of the child process, and the authors acknowledge this in section 6. Their suggestion to get around that is to have system calls that let you change the state of the child from the parent. Unfortunately that creates its own problems --- richer system call API surface with more potential races and security issues (though those races also exist for "modify own process" system calls in the presence of threads).
Another possible approach that they don't mention would be to replace fork() with a spawn() function that can handle common cases, but still support exec(). Then for complicated cases not handled by spawn(), you would spawn() a helper binary that communicates with the parent to complete setting up the child before exec()ing the real binary. Then again, Linux execve() is *also* a big problem, requiring all kernel resources to specify what happens when an execve() occurs, and also having problems with multithreaded processes. (The section of the ptrace() man page on execve() of multithreaded processes is very scary.) So maybe the way to go is to eliminate both fork() and exec() and have spawn() start execution in a standard userspace stub like ld.so, which supports a standard protocol for communicating with the parent to set up the child process environment before entering the real binary.
The paper would have been stronger if they had also discussed issues with execve() and talked about the benefits of eliminating *both* fork() and execve() in favour of spawn().
One thing that worries me about marginalizing or removing fork() is that a COW memory snapshot system call is still very needed to implement rr replay and other things. fork() being that syscall is great for us because it's so commonly used, it's guaranteed to work efficiently and well. Then again, a dedicated COW snapshot call could potentially eliminate some of the problems with using fork() for this, e.g. the fact that shared memory segments aren't copied.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 20:16 UTC (Wed) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by randomguy3
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 20:08 UTC (Wed) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by pbonzini
Parent article: Microsoft Research: A fork() in the road
It's not so much a reinitialise mutexes in the child, but more of a 'create new mutexes for the new process and replace any references to mutexes from the parent' that needs to happen in the child() call.
Sorry if I wrote reinitialise and threw you previously.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 20:05 UTC (Wed) by roc (subscriber, #30627)In reply to: Microsoft research: A fork() in the road by patrakov
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 20:01 UTC (Wed) by roc (subscriber, #30627)In reply to: Microsoft research: A fork() in the road by Cyberax
Parent article: Microsoft Research: A fork() in the road
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 19:58 UTC (Wed) by roc (subscriber, #30627)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by mathstuf
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Microsoft research: A fork() in the road
Posted Apr 10, 2019 19:38 UTC (Wed) by patrakov (subscriber, #97174)Parent article: Microsoft Research: A fork() in the road
"""
...found 1304 Ubuntu packages (7.2% of the total) calling fork, compared to only 41 uses of the more modern posix_spawn(). Fork is used by almost every Unix shell, major web and database servers (e.g., Apache, PostgreSQL, and Oracle), Google Chrome, the Redis key-value store, and even Node.js.
"""
That's outright manipulation of the available facts, good enough to be included in propaganda textbooks. For starters, fork() is used not only in a way immediately followed by exec(). E.g., Redis uses fork() as a method to obtain a consistent snapshot of the database in memory, without running a separate executable. While indeed not every use of fork() is justified, the authors could at least not mix examples convertible and not convertible to posix_spawn().
Microsoft research: A fork() in the road
Posted Apr 10, 2019 19:36 UTC (Wed) by smoogen (subscriber, #97)In reply to: Microsoft research: A fork() in the road by thoughtpolice
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 19:33 UTC (Wed) by smoogen (subscriber, #97)In reply to: Microsoft research: A fork() in the road by smoogen
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 19:15 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)Parent article: Microsoft Research: A fork() in the road
This neatly avoids all the complications of forking and memory overcommit.
That's what Fuchsia does, btw.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 18:47 UTC (Wed) by thoughtpolice (subscriber, #87455)In reply to: Microsoft research: A fork() in the road by fhuberts
Parent article: Microsoft Research: A fork() in the road
Three of the (four) authors are not from Microsoft Research. You're going to be surprised when you find out what it is the majority of MSR employees do (hint: it's research, and a lot of it uses Linux.)
> Personally I think fork is a nice enough call and actually an advantage to have. For example, Git rather suffers in performance on Window because of the lack of that call (amongst other things).
This is just a flippant response, the paper's entire argument has nothing to do with whether it's "nice enough" or "easy to use", you can use `posix_spawn` for that. It's arguing that the contract implementations of `fork()` must provide is a large burden on the design of new systems that is worth reconsidering, e.g. the section that outlines the design of K42, an object-capability system, had its design significantly burdened by general `fork()` semantics, because suddenly you have to start talking about what state objects can be in after they are cloned, rather than when they are created fresh. Similarly, thanks to the semantics of `CreateProcess` actually spawning separate process (vs fork), it can work in environments that have single-address spaces -- for example, by porting their APIs to different runtimes, you can support single-address-space multi-process SGX enclaves with the same API, same with Unikernels, etc (Section 5). If you actually treat the *process* as the object of work (the object which your vocabulary is designed around) then it's easy to see how this works vs fork. Even if fork is "nice" to use for users, it has significant design ramifications throughout the system.
Also `CreateProcess` on Windows by itself isn't "expensive" because it's expensive to map in new address spaces and run main(), and Windows is just weirdly mysteriously terrible at it and they just never cared, it's expensive because actually initializing user contexts in a Windows process is expensive (that requires kernel locks, context switches to system services, thread/stack initialization, etc) but this is a wholly separate design issue. There's no reason to believe a well-implemented spawn mechanism can't have excellent performance because Windows has technical debt (and given the chance to start fresh, if you wanted a high-level spawning API, you'd almost certainly try to *ensure* it has good performance from the get-go.)
The paper never even makes the argument "`CreateProcess` in Windows is better and easier to use than `fork`" (which some other people here have read somewhere, and something that would be pretty hard to argue anyway), merely that the actual underlying design distinction -- an API revolving around spawning actual processes as a kind of first class object in the system without imposing semantic requirements on the memory subsystem -- is perhaps a better one, moving forward. The arguments seem pretty good, to me. I could live without `fork()` if it meant I got something in return, and it seems I do get some things in return.
It also comes across as a good example of where higher level, domain-specific APIs for users give more flexibility than a low level one when considering the overall system design. A higher level API necessarily gives more degrees of freedom in the implementation which, in turn, helps isolate users from underlying implementation details. You can of course go too far here, but if you capture the domain properly, then you can have the advantages of implementation freedom combined with the exact control you need.
Here's a similar discussion I had recently: if you want to write an efficient C program (energy efficient, time efficient, whatever), compared to some existing one, it will never be enough to just throw a new compiler or better optimizations at said existing program -- you cannot choose better instructions or register allocate your way out of it, etc. That will be peanuts compared to real gains you can have. Real optimization comes from choosing a different design, different algorithms and different memory layout -- the kind of decisions that are impossible for the C compiler to make for you while preserving semantics. But tiling, memory locality optimizations are much more common and practical in more restricted settings if you take away a few degrees of freedom from the user, and give it back to the computer -- the Halide image compiler is an example of this. So it is not a problem, or even a "failure", of individual *technical tools* that you are using (calling it a "failure" is not based on any technical understanding of the problem, but on the deep, social, human desire to assign blame, in order to rationalize and reduce complex interactive failure into singular causes.) It is an impedance mismatch in the *abstract language* you are using to communicate with the machine, in turn, restricting the degrees of freedom the computer has for response. Language problem, not a technical one.
Generally I enjoy LWN but most people here have (IMO) failed to level any actual substantial criticisms of the paper (beyond made up ones in their head) before dismissing it offhand, which is sad because it's pretty well written and easy to approach. You don't have to have .patch files in hand every time you want to take some basic idea and run with it and see where it might lead; and in fact, such a demand hampers actual progress more than anything, but that's another discussion...
Microsoft research: A fork() in the road
Posted Apr 10, 2019 18:40 UTC (Wed) by randomguy3 (subscriber, #71063)Parent article: Microsoft Research: A fork() in the road
An interesting piece. Having dealt with spawning processes in a cross-platform multi-threaded application as part of my day job, I am very sympathetic to the complaints of these researchers (although I'll admit I don't care that much about the difficulties fork() poses for implementing microkernel systems...).
CreateProcess() certainly has its faults (some of which it shares with fork(), such as not defaulting to CLOEXEC), but it's a lot easier to get right than fork()+exec() - the constraints on what you can do after fork() are easy to forget, and hard to even know when there are multiple threads around.
posix_spawn is a good idea, but suffers from several shortcomings (some of which are mentioned in the paper), including poor error returns, some missing basic features (like working directly) and an inherently racy approach to fd inheritance in a multithreaded environment.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 18:38 UTC (Wed) by sjfriedl (✭ supporter ✭, #10111)In reply to: Microsoft research: A fork() in the road by fhuberts
Parent article: Microsoft Research: A fork() in the road
From the paper:
> Ironically, the NT kernel natively supports fork; only theWin32 API on which Cygwin depends does not
Microsoft research: A fork() in the road
Posted Apr 10, 2019 18:29 UTC (Wed) by pbonzini (subscriber, #60935)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 18:25 UTC (Wed) by randomguy3 (subscriber, #71063)In reply to: Microsoft research: A fork() in the road by evad
Parent article: Microsoft Research: A fork() in the road
The paper gives several motivations, but I reckon the primary one comes from the authors' work as OS researchers interested in making new research operating systems. Currently, fork() usage is so prevalent in UNIX software that they are faced with implementing fork() (which they claim - I see no reason to doubt their experience in this area - infects the entire OS design) or have an OS that can't run huge amounts of existing software out there (removing a valuable testing resource and possible adoption path for the OS).
It's notable that S7 only suggests the OS might be rewritten to not have fork() as a core syscall after the most important software (however you want to define that, I guess) has been rewritten to avoid it. They're a little vague on how either part of that process would happen, but the purpose of the paper is just to convince people that it should be done, not set out a plan for achieving it.
Rethinking race-free process signaling
Posted Apr 10, 2019 18:07 UTC (Wed) by rbanffy (guest, #103898)In reply to: Rethinking race-free process signaling by eru
Parent article: Rethinking race-free process signaling
Microsoft research: A fork() in the road
Posted Apr 10, 2019 17:58 UTC (Wed) by alogghe (subscriber, #6661)Parent article: Microsoft Research: A fork() in the road
Positional-only parameters for Python
Posted Apr 10, 2019 17:57 UTC (Wed) by juliank (guest, #45896)In reply to: Positional-only parameters for Python by dbaker
Parent article: Positional-only parameters for Python
Microsoft research: A fork() in the road
Posted Apr 10, 2019 17:50 UTC (Wed) by Liskni_si (subscriber, #91943)Parent article: Microsoft Research: A fork() in the road
Vlastimil Babka pointed me to https://lwn.net/Articles/717950/ which I understood to mean that it's not at all straightforward to implement and some larger refactorings would be necessary, and that's certainly beyond my ability. So I'm wondering if we're any closer to being able to add such functionality today, and whether others think my idea of reflink on tmpfs is good or bad.
[1]: https://blogs.vmware.com/consulting/2016/09/anatomy-insta...
[2]: http://www.cs.toronto.edu/~brudno/public/pdf/lagar2011sno...
[3]: http://www.cs.toronto.edu/~sahil/suneja-hotcloud14.pdf
Microsoft research: A fork() in the road
Posted Apr 10, 2019 17:34 UTC (Wed) by evad (subscriber, #60553)Parent article: Microsoft Research: A fork() in the road
I can only assume Microsoft wants fork() to be removed from the kernel so its easier for them to support Linux apps on Windows. Otherwise why ask for its removal? Why not just educate people on the alternatives?
A very confusing paper, and very much an editorial rather than a research document.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 16:55 UTC (Wed) by magfr (subscriber, #16052)Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 16:39 UTC (Wed) by quotemstr (subscriber, #45331)In reply to: Microsoft research: A fork() in the road by fhuberts
Parent article: Microsoft Research: A fork() in the road
These researchers happen to be right. fork requires overcommit, and overcommit is the enemy of guaranteed forward progress.
Positional-only parameters for Python
Posted Apr 10, 2019 16:35 UTC (Wed) by dbaker (guest, #89236)In reply to: Positional-only parameters for Python by FLHerne
Parent article: Positional-only parameters for Python
iterating over containers of containers:
for a, b, _ in [(1, 'a', []), (2, 'b', [])]: ...
for functions that need to fulfill an interface:
def f1(f: str, *, opt: bool = False):
def f2(f: str, **_):
myval = [f(myval, opt=True) for f in [f1, f2]]
with the python3 partial container explosion syntax:
a, b, *_ = (1, 2, 3, 4)
and a bunch of other cases.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 16:14 UTC (Wed) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by metan
Parent article: Microsoft Research: A fork() in the road
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
prepare() should do something like take locks for exclusive access on the malloc() area (potentially blocking until exclusive access is guaranteed), then returning to allow the fork() to proceed. parent() can drop the locks again in the original process & thread, while child() can replace any locks with new ones specific to the child.
Of course, glibc implements both malloc() and pthread_atfork() so can use internal mechanisms to achieve the same, but it's still there for others if needed on other resources and you really have a design that calls for fork() and threads.
Making slab-allocated objects movable
Posted Apr 10, 2019 16:08 UTC (Wed) by jhoblitt (subscriber, #77733)Parent article: Making slab-allocated objects movable
Microsoft research: A fork() in the road
Posted Apr 10, 2019 16:04 UTC (Wed) by xl2784 (guest, #131031)In reply to: Microsoft research: A fork() in the road by metan
Parent article: Microsoft Research: A fork() in the road
Microsoft research: A fork() in the road
Posted Apr 10, 2019 16:04 UTC (Wed) by flussence (guest, #85566)Parent article: Microsoft Research: A fork() in the road
It's also six characters long and good enough for the rest of the world. If this also-ran open-core company can't/won't build something more compelling, then all of this is just intellectual onanism and whining over something they don't have the brains to implement efficiently.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:58 UTC (Wed) by metan (subscriber, #74107)In reply to: Microsoft research: A fork() in the road by xl2784
Parent article: Microsoft Research: A fork() in the road
* Thread A calls malloc()
* Thread A acquires malloc() lock
* Thread B calls fork()
* Thread A releases malloc() lock
Now the child of the Thread B ends up with malloc locked for eternity and any attempt to allocate memory will end up with a deadlock there.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:53 UTC (Wed) by sjfriedl (✭ supporter ✭, #10111)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
It's only easier to teach if you ignore the hard parts.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:27 UTC (Wed) by dullfire (guest, #111432)Parent article: Microsoft Research: A fork() in the road
One of the may ... dubious claims is "fork() breaks Buffered I/O"... so does read()/write().
Or in other words... if you gonna use functions from multiple abstraction layers (in this case libc vs thin-libc syscall wrappers) then it's on you to properly manage them.
I'm not sure fork() is an inspired design, however the assertions at the beginning of the paper don't fill me with confidence about the authors
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:25 UTC (Wed) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by barryascott
Parent article: Microsoft Research: A fork() in the road
It would have been a bold decision to make new sub-systems implicitly set CLOEXEC by default, but it perhaps is only now more obvious with hindsight that such a could would have been saner, but it's not the fault of fork() that it came first.
And still there is no better suggestion of a replacement or upgrade.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:15 UTC (Wed) by barryascott (subscriber, #80640)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
>
> O_CLOEXEC, FD_CLOEXEC, EFD_CLOEXEC, EPOLL_CLOEXEC, F_DUPFD_CLOEXEC, IN_CLOEXEC, MFD_CLOEXEC, SFD_CLOEXEC, SOCK_CLOEXEC, TFD_CLOEXEC, DRM_CLOEXEC, FAN_CLOEXEC, UDMABUF_FLAGS_CLOEXEC
But that is the point the paper makes. Because of the fork() design *everything* else has to work around the limitations.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 15:04 UTC (Wed) by xl2784 (guest, #131031)Parent article: Microsoft Research: A fork() in the road
“
A simple but common case is one thread doing memory allocation and holding a heap lock, while another thread forks. Any attempt to allocate memory in the child (and thus acquire the same lock) will immediately deadlock waiting for an unlock operation that will never happen.
”
Microsoft research: A fork() in the road
Posted Apr 10, 2019 14:26 UTC (Wed) by mm7323 (subscriber, #87386)In reply to: Microsoft research: A fork() in the road by warrax
Parent article: Microsoft Research: A fork() in the road
False dichotomy. CreateProcess() is ugly because of extreme backward-compat requirements, there's nothing inherent in the idea which would make such a function ugly.
Of course, you could say the weaknesses of fork() remain because of the backward-compat requirement too. But fork() + exec() is still a prettier API that's easy to teach.
Fork() is absurdly hard to use in multithreaded cases
Yes, fork() and threads don't really mix well as you won't normally know what state other threads were in, and so their memory state at the point of fork(), unless you acquire locks first as you would for any normal case of accessing another threads state. Threads don't mix well with other things too e.g. mixing locks, condition variables and poll()/select()/epoll(). Certainly in C and similar languages, use of threads requires fore-thought about the overall program structure and care over data ownership.
almost always going to be "start a new subprocess /usr/bin/something with arguments X, Y, Z"
posix_spawn() maybe what you are after then, though the man page of that says that it only offers a sub-set of fork() + exec() functionality. Forking servers are quite a common use case too, and again, are simple to teach and understand - even if the inherit by default semantics can present a booby trap.
It's a complete mess because of its implicitness.
It's actually all the other calls that need various forms CLOEXEC and preparation which makes mess, but that's semantics. A quick grep of /usr/include shows this:
O_CLOEXEC, FD_CLOEXEC, EFD_CLOEXEC, EPOLL_CLOEXEC, F_DUPFD_CLOEXEC, IN_CLOEXEC, MFD_CLOEXEC, SFD_CLOEXEC, SOCK_CLOEXEC, TFD_CLOEXEC, DRM_CLOEXEC, FAN_CLOEXEC, UDMABUF_FLAGS_CLOEXEC
Microsoft research: A fork() in the road
Posted Apr 10, 2019 14:15 UTC (Wed) by smoogen (subscriber, #97)In reply to: Microsoft research: A fork() in the road by warrax
Parent article: Microsoft Research: A fork() in the road
The problem is that we when you get to threaded-screws, the hammer no longer works well, and you end up with splintered walls and bashed fingers. So you upgrade your toolbox with better hammers, and maybe some screwdrivers. You might even go with a toolbox with no hammer in it (aka Windows). You quickly find that all of the remaining tools still have enough rusty bits to give every program still gives you a bad case of tentanus, gangrene and blood poisoning while trying to deal with threads.
In the end, papers do not fix things.. especially papers which do not give code which clearly shows a better solution. They may provoke people to think about building better tools.. but even then it takes multiple generations of people who are happy with their rocks to retire before you even get claw hammers or phillips head screwdrivers.. and even then you will find that someone stuck a nice sharp rusty point on the #1 phillipshead and the fix was to keep wrapping it in indirection duct-tape until it only pokes you now and then.
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 14:07 UTC (Wed) by mathstuf (subscriber, #69389)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by roc
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Actually, I have uMatrix set up to block cross-domain redirects by default. It is only really a problem for shopping carts and OAuth stuff which bounce the browser around, but this is a known situation and I can reasonably predict when such stuff is actually going on to know when to relax the behavior.
Schaller: Preparing for Fedora Workstation 30
Posted Apr 10, 2019 14:07 UTC (Wed) by zarrro (guest, #54749)In reply to: Schaller: Preparing for Fedora Workstation 30 by patrakov
Parent article: Schaller: Preparing for Fedora Workstation 30
So expect sometime in the future when they update to newer Electron( Skype is still on an ancient version) to receive support for Wayland screen sharing.
For me personally, Skype is the only thing now holding me back from switching to Wayland.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 13:54 UTC (Wed) by warrax (subscriber, #103205)In reply to: Microsoft research: A fork() in the road by mm7323
Parent article: Microsoft Research: A fork() in the road
Fork() is absurdly hard to use in multithreaded cases because of the implicit forking of resource handles of various kinds. It's also really hard to do error handling around it correctly(!). In languages like C it's certainly *possible* to use it correctly though it's rare to see people get the edge cases right, but try asking any language runtime implementors how much fun they had having to work around its nightmarish semantics.
There's nothing elegant about fork() at all -- it overconstrains implementations by way of its semantics for a use case which is almost always going to be "start a new subprocess /usr/bin/something with arguments X, Y, Z". It's a complete mess because of its implicitness. Explicit over implicit all the way!
Microsoft research: A fork() in the road
Posted Apr 10, 2019 13:32 UTC (Wed) by ibukanov (subscriber, #3942)Parent article: Microsoft Research: A fork() in the road
The real fork drawback is that it does not have sane semantics in multi-threaded semantics and using it with threads with shared memory do more harm then good . But fork in single threaded applications that uses it for computational workers works nicely and may even leads to better CPU cache utilization.
Microsoft research: A fork() in the road
Posted Apr 10, 2019 13:17 UTC (Wed) by mm7323 (subscriber, #87386)Parent article: Microsoft Research: A fork() in the road
Windows CreateProcess() takes 10 or so direct parameters, of which some are structures of yet more parameters again. Yuck.
Some of the complaints in the paper seem misplaced too (fork is slow, doesn't scale, forces memory overcommit). fork() has a certain purpose and trying to use it for performance is something which we already know doesn't work that well - that's why webservers went through design iterations of pre-forking, using threads, async IO or some combination of techniques.
Suggesting fork() is insecure possibly has some truth as inheritting most things by default (except other threads) is the opposite of what would be safest, but it's too late to change. Perhaps a new part() call that inherits little could be made, but the knock on is then making APIs for everything to opt into inheritance.
Positional-only parameters for Python
Posted Apr 10, 2019 13:16 UTC (Wed) by FLHerne (guest, #105373)In reply to: Positional-only parameters for Python by rgb
Parent article: Positional-only parameters for Python
>>> def fun(name, *_):
>>> print(_)
...
>>> fun("A", "B", "C")
('B', 'C')
Microsoft research: A fork() in the road
Posted Apr 10, 2019 13:01 UTC (Wed) by naptastic (guest, #60139)Parent article: Microsoft Research: A fork() in the road
<3
Microsoft research: A fork() in the road
Posted Apr 10, 2019 12:51 UTC (Wed) by fhuberts (guest, #64683)Parent article: Microsoft Research: A fork() in the road
Personally I think fork is a nice enough call and actually an advantage to have. For example, Git rather suffers in performance on Window because of the lack of that call (amongst other things).
Positional-only parameters for Python
Posted Apr 10, 2019 11:02 UTC (Wed) by LtWorf (subscriber, #124958)In reply to: Positional-only parameters for Python by niner
Parent article: Positional-only parameters for Python
Positional-only parameters for Python
Posted Apr 10, 2019 10:59 UTC (Wed) by rgb (guest, #57129)Parent article: Positional-only parameters for Python
def fun(name, *_):
...
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 8:13 UTC (Wed) by roc (subscriber, #30627)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by roc
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
This is a good argument in favour of <a ping> actually; it allows sites to stop obfuscating outbound links.
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 8:11 UTC (Wed) by roc (subscriber, #30627)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by LtWorf
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Since JS was invented, scripts have been able to navigate the current page to some arbitrary URL with or without any user action.
> Back in the days they were always recommending to check the preview of the link to know if it was safe to click or not
That advice makes sense if you trust the page containing the link (e.g. results from a search engine you trust).
If you don't trust the page containing the link, there's no point in checking the link preview because the page can send you wherever it wants at any time, and that's been true for 20 years.
Managing sysctl knobs with BPF
Posted Apr 10, 2019 8:03 UTC (Wed) by thithib (guest, #115203)Parent article: Managing sysctl knobs with BPF
I get the advantages of BPF over e.g. a new LSM hook in this particular case.
What I'm uncomfortable with is, I guess, the fact that it's one more step towards making BPF a mandatory skill for sysadmins trying to correctly enforce their security policy.
Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
Posted Apr 10, 2019 7:23 UTC (Wed) by LtWorf (subscriber, #124958)In reply to: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer) by mathstuf
Parent article: Major Browsers to Prevent Disabling of Click Tracking Privacy Risk (BleepingComputer)
But IMO it is a grave security issue from browsers, because the preview of the link shows an URL, but then copying it or clicking it actually takes me to a completely different URL.
Back in the days they were always recommending to check the preview of the link to know if it was safe to click or not, and now browser vendors have made that unsafe to trust.
Positional-only parameters for Python
Posted Apr 10, 2019 6:38 UTC (Wed) by foom (subscriber, #14868)In reply to: Positional-only parameters for Python by niner
Parent article: Positional-only parameters for Python
Maybe you meant that all _required_ arguments should have been made positional only? But, then what about optional arguments? Those must allow keyword calls?
Positional-only parameters for Python
Posted Apr 10, 2019 6:14 UTC (Wed) by niner (subscriber, #26151)Parent article: Positional-only parameters for Python
Special cases aren't special enough to break the rules.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
If the implementation is hard to explain, it's a bad idea.
Of course such a change would be quite backwards incompatible. If only they had used the one chance they got to make such changes for actually fixing the language...
Managing sysctl knobs with BPF
Posted Apr 10, 2019 5:16 UTC (Wed) by moorray (subscriber, #54145)In reply to: Managing sysctl knobs with BPF by pj
Parent article: Managing sysctl knobs with BPF
Rethinking race-free process signaling
Posted Apr 10, 2019 5:15 UTC (Wed) by eru (subscriber, #2753)In reply to: Rethinking race-free process signaling by rbanffy
Parent article: Rethinking race-free process signaling
Managing sysctl knobs with BPF
Posted Apr 10, 2019 4:03 UTC (Wed) by roc (subscriber, #30627)In reply to: Managing sysctl knobs with BPF by Cyberax
Parent article: Managing sysctl knobs with BPF
Instead of reimplementing WebAssembly badly, just go ahead and support it in the kernel.
Managing sysctl knobs with BPF
Posted Apr 10, 2019 3:25 UTC (Wed) by ebiederm (subscriber, #35028)In reply to: Managing sysctl knobs with BPF by wahern
Parent article: Managing sysctl knobs with BPF
On Linux unlike BSD, the binary mechanism is an emulation layer of /proc/sys. While at one point the binary layer was almost equal, that is no longer the case.
The binary layer kept having conflicting paths added, was not used, was never tested, and had security holes the /proc/sys path did not. So a while ago I just reduced it to an emulation layer so we could forget about it.
Which is a long way of saying about the only thing the BSD and Linux sysctl implementations have in common is their name.
