Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This may come as a shock to you, but operating systems have bugs. And nobody is trying to defend NTFS populating your file with random OS pages.

So yes, an OS should allow you to call its API without triggering internal bugs. But that's kind of a straw man.

There's an interesting line that you're exploring, though, and I would like to dig deeper. You said "the kernel is still doing what it was asked". Let's ignore the bug described by the article for a moment and look into this.

Let's say I have two threads. Each one does a write to the same LBA range. You wind up with a file that doesn't represent the full contents of either write (say it's a 8192-byte write, and your file has 4096 bytes from the first write and 4096 bytes from the second write). Do you consider that to be a bug in the OS or a bug in the application client?

(It's obvious that two conflicting writes will result in someone losing their data. The part of the scenario I'm exploring is that in this case everyone lost their data.)



It's not a straw man, it's a description of the rule that was actually violated by windows.

In the absence of documentation saying otherwise, I would expect the calls to be serialized, and one to happen entirely before the other.

Now if they each did two writes at about the same time, it's no longer the OS's problem if the threads interlace badly.


"So yes, an OS should allow you to call its API without triggering internal bugs. But that's kind of a straw man."

That's not a straw man. That's the exact topic under discussion in this thread.

"Let's ignore the bug described by the article for a moment and look into this."

And that my friend is the definition of a straw man :-)


Wait, I think you and I are having very different conversations.

If the topic you're discussing is that the clients of an OS API should not encounter a bug...uh, I mean, I don't think you'll find anyone to disagree with you. It's not like Microsoft engineers put that bug in there thinking it would be OK. They even acknowledged that it was a bug...it just wasn't high priority because the caller (presumably; again, I know nothing about these syscalls) is not following best practices. Someone's pet bug got deprioritized. This is not news.

The topic I thought we were discussing was whether it's the OS's responsibility to prevent callers from misusing their APIs in a way that causes stupid things to happen, even when the caller is doing something stupid.

I think the latter is a more interesting conversation, but I apologize if I interrupted your discussion of the former.


"Wait, I think you and I are having very different conversations."

So it would seem.

"It's not like Microsoft engineers put that bug in there thinking it would be OK."

You say that now. But the reason my strident response was triggered was because of what you said in your original post that I replied to:

"I don't know what contract these operations have, but it may very well be the case that the user was violating the contract. If Microsoft responded with "don't do that", this may be the case."

That is quite absurd on it's face. I replied with how the contract was nothing more or less than the syscall API and there was no margin for negotiation on kernel's part when it comes to corrupting data when a user program calls those APIs in whatever order it pleases.

Subsequently, your arguments seem to have become more elaborate with a lot more caveats added. I think it has stopped being fruitful for me to respond at this point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: