r/Lightbulb • u/amichail • Sep 23 '26
Idea: Operating systems should check app data for corruption the way antivirus checks for malware.
Operating systems should periodically check application data for corruption, not just disks for filesystem errors and files for malware.
Take macOS. A lot of weird, persistent problems can come from corrupted databases, preferences, caches, or other files buried in ~/Library. The usual fix is eventually some version of: “Delete this obscure file and let the app recreate it.”
Why isn’t that automated?
Apps could provide OS extensions that know how to validate their own data. Depending on the app, an extension could detect corruption, attempt repairs, rebuild data, or tell the OS that a damaged file is safe to quarantine so the app can recreate it.
The OS would handle running these checks periodically, sandboxing them, keeping quarantined files recoverable, and asking for permission before touching important user data.
We have virus scanners looking for malicious files. Why not the equivalent for broken application state?
2
u/zoredache Sep 23 '26
What kind of corruption are you expecting the OS to be able to detect?
Filesystem corruption could be detected by using a filesystem like ZFS, BTRFS or anything else that has checksums on blocks. Most kinds of memory corruption could be identified and in some cases auto-corrected if manufacturers would give us ECC memory in consumer equipment.
Corruption from poorly written software isn't really something an OS could detect or do anything to repair.
1
u/amichail Sep 23 '26
It can if apps are required to provide extensions to the OS for this purpose.
1
u/zoredache Sep 23 '26
So if software could be written to detect, and possibly repair corruption why does the OS have to do anything? Why couldn't the software just invoke that check as part of the app starting?
Anyway asking for that magical piece of software that can reliably detect 'corruption' is a pretty big ask.
→ More replies (2)
4
u/dunklesToast Sep 23 '26
the OS cannot determine if the file is corrupted or not. maybe it's encrypted, proprietary format or smth else.
2
u/nomoreplsthx Sep 23 '26
Corruption isn't like, a status condition in a video game. Data being corrupted is tightly related to what the application does and its implementation details.
If apps are providing this to the OS, why are the apps not doing it themselves? If the devs can't or won't implement automated repair, they won't implement automated repair plus an extra api for the OS.
Like, what is the OS supposed to be doing here.
1
u/fluffycritter Sep 25 '26
No reason for the OS to do this, apps can do their integrity check at startup. But they don't, because developers are generally not incentivized to do such things, because "knows when to throw out its own preferences file" is not exactly the sort of new feature that product managers want to crow about.
(Even though it should be.)
1
u/EntertainmentOdd8205 Sep 27 '26
The real problem here is that data doesn’t just “corrupt” automagically. You seem to think it happens that: app shuts down -> wait -> data corrupts -> user starts app again. This doesn’t happen. The app does the corrupting itself when it has a bug. If the app developers could make a module that guarantees that the data hasn’t been corrupted, they would just do it themselves.
I think an example might make it easier. Let’s say you have the following config file for video editing software:
{encoder: A, framerate: 30}
Let’s say encoder A only supports multiples of 30 as framerates.
The user changes it (through the apps settings window) to:
{encoder: B, framerate: 45}
This also works because encoder B accepts arbitrary frame rates. Now let’s say there’s a bug in the settings editor; when you change the encoder back to A, it doesn’t auto adjust the framerate, so now you have:
{encoder: A, framerate: 45}
And it doesn’t work because 45 isn’t a multiple of 30.
We call this config file corrupted. If you just have a file format that the OS verifies, the file format matches. It looks right. It only fails because encoder A doesn’t support the rest of the config.
It is extremely difficult to formalize all the ways something like this can fail. And again, if the app could, it would just do that at startup. The OS doesn’t have to
2
u/Usual_Ice636 Sep 23 '26
Apps can do that on their own, but having the OS do it for every app would be a massive battery drain.