News for hackers. Stuff that matters.
Re:Compiler bug? Linker bug? Windows Kernel bug by mehrdadn on Monday February 26, 2018 @05:15AM (#16464302)
I'm not sure... UB in general seems to be a language-level construct. OSes (and below) don't really have much UB to speak of, and I assume this is because they are expected to provide security and stability regardless of misbehaving user programs. And also, UB is usually said in response to a program expecting a certain behavior, but in this case I'm not worried about the program itself, but about the system and where exactly the black hole that the physical memory is mapped to is (given that it is no longer a file). In this case, I wouldn't be surprised if there are serious stability or even security issues lying behind this... I just haven't bothered to investigate.
Re:Compiler bug? Linker bug? Windows Kernel bug by barrkel on Monday February 26, 2018 @05:28AM (#16464353)
It would rather be classified as undocumented behaviour. Undocumented behaviour is frequently maintained in OSes because programs become reliant on it, to the point that sometimes bugs need to be emulated to avoid breakage.
Re:Compiler bug? Linker bug? Windows Kernel bug by DoofusOfDeath on Monday February 26, 2018 @07:22AM (#16464774)
It's been a long time since I've looked at Windows documentation, but I wonder if it's reasonable to treat their documentation as the actual contract offered by the OS?

I had the impression that poor documentation forced a lot of Windows programmers to understand Microsoft's API's via experimentation.

Re:Compiler bug? Linker bug? Windows Kernel bug by MaxBarraclough on Monday February 26, 2018 @09:36AM (#16465527)
> UB in general seems to be a language-level construct

Not always. Various standard library functions can cause UB, and not just things like C's div function. In C++, calling front() on an empty std::vector<T> causes UB, for instance. http://www.cplusplus.com/reference/vector/vector/front/

I agree that from a system perspective, it doesn't look like good behaviour.

Re:Compiler bug? Linker bug? Windows Kernel bug by mehrdadn on Monday February 26, 2018 @09:42AM (#16465570)
> Not always. Various standard library functions can cause UB, and not just things like C's div function. In C++, calling front() on an empty std::vector<T> causes UB, for instance.

std::vector et al. are parts of the C++ language. "Language" != pure syntax.

Re:Compiler bug? Linker bug? Windows Kernel bug by MaxBarraclough on Monday February 26, 2018 @11:12AM (#16466311)
I think I see your point - that despite the way C++ libraries can and do expose UB if not used as intended, it doesn't mean that Windows does the same.

For what it's worth, I read that POSIX does have UB in the spec (as in, distinct from how the compiler is allowed to break things in terms of language-level UB), at least in some ghastly signal handling situations. I wasn't able to find at a glance whether Windows does too, or if it categorically doesn't.

> According to POSIX, the behavior of a process is undefined after it ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated by kill(2) or raise(3).