News for hackers. Stuff that matters.
Re:How would you build an operating system? (SerenityOS with... by saagarjha on Wednesday February 07, 2024 @08:14AM (#39288151)
One problem with 2. is that subscribing to changes isn't always good enough, since if you go to act on the changes things may update out from under you regardless. Like, if you react to filesystem events, if a new file is created you might have it get deleted before you even register that it was added and do whatever you wanted with it.
Re:How would you build an operating system? (SerenityOS with... by vacuity on Wednesday February 07, 2024 @08:59AM (#39288628)
I feel like it should be possible to say "I want to reserve access to this resource when something important happens on it". Or just "I want to reserve access to this resource". Hopefully eliminates TOCTOU races. I guess then there have to be different modes to balance scalability/flexibility.
Re:How would you build an operating system? (SerenityOS with... by electroly on Wednesday February 07, 2024 @10:50AM (#39289977)
When people complain about antivirus and endpoint security applications slowing their computer down, this is what they're talking about. This leads to user-visible delays (which, to them, seem to be random) as the reserver does what it wants right after the user has done something to the file. Many (most? ALL?) apparent Explorer stalls are really Windows Defender locking and scanning the file right after you did something to it.
Re:How would you build an operating system? (SerenityOS with... by josephg on Wednesday February 07, 2024 @11:44AM (#39290767)
Yeah good point. I don't want write stalls because of subscription requests. For things like filesystem watching (for compilers), it'd be enough to have a form of snapshot checkpointing. (There were these FS events within 10ms [..]) / (Then the file contents was XXX) / ... (Then there were these FS events) / and so on.

Its possible you'd end up in situations where the OS would need to retain old file contents if there's both a pending read from a subscriber and subsequent writes. But in most cases, this is fine.

Going back to my original comment, this is the sort of reason I'd like to try this in my own OS kernel rather than try and solve all these problems immediately in linux. It'll give me a chance to try out a few different solutions and see if I can find something that works well.

Re:How would you build an operating system? (SerenityOS with... by duped on Wednesday February 07, 2024 @01:09PM (#39291970)
It should be possibly to speculatively execute code that's accessing resources and only allowing transactions on system resources to commit successfully if other transactions haven't invalidated them.

Meaning a process could start loading and reading while queuing writes and only writes would block while another process is locking access to the executable to scan it. If the scan succeeds the writes are committed and if it fails it could revoke execution privileges and all the work is undone.

Lot of hand waving there, but when you're not committed to existing file system semantics there is a lot of room for innovation.

Re:How would you build an operating system? (SerenityOS with... by saagarjha on Wednesday February 07, 2024 @09:53AM (#39289264)
You can definitely do that, it just means that userspace can now stall access to things unless you're very careful :) Like, one model (often used by EDR, which is why everyone hates them) is that every operation must be "authorized" so it doesn't go through until some evaluation happens. But this means the kernel has to ask a program for every operation, which is slow.
Re:How would you build an operating system? (SerenityOS with... by vacuity on Wednesday February 07, 2024 @11:00AM (#39290130)
What's EDR? But yeah, I recognize that there need to be limits. I haven't really thought it through yet, heh.
Re:How would you build an operating system? (SerenityOS with... by kemotep on Wednesday February 07, 2024 @12:02PM (#39291008)
EDR stands for Endpoint Detection and Response or Remediation.

Think modern antivirus. Less periodic scans and more continuous monitoring for anomalies.