3 ms·
There are a whole bunch of almost-correct comments here along with a surprising number of "it's been so long it must be fixed". The alleged bug is that Linux d
by amluto 10y ago
There are a whole bunch of almost-correct comments here along with a surprising number of "it's been so long it must be fixed".
The alleged bug is that Linux didn't clear DF on signal entry. (This has nothing to do with what is saved or restored. Flags have to be saved and restored and, AFAIK, always were.) The x86 ABI is crystal clear: C functions are called with DF clear. Neither glibc nor Linux cleared it before calling a signal handler, so there was a bug.
But the bug was fixed in March 2008 for Linux 2.6.25. [1]
[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e40cd10ccff3d9fbffd57b93780bee4b7b9bff51 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux....
- pjmlp 10y agoThat doesn't mean anything when talking about POSIX.
- lmm 10y agoPOSIX doesn't guarantee that memset is async-signal-safe, that is clear enough, and flags like this are even a reasonable rationale. But it sounds like post-2008 memset is and should be async-signal-safe on Linux. Are there relevant systems on which it isn't? IME it's impractical to write code that will work on all POSIX-compliant systems as the standard leaves too much undefined and there is no testsuite that will let you determine when your code is depending on something beyond the minimum requirements of POSIX.
- pjmlp 10y agoWelcome to POSIX. As for GNU/Linux, can you assure memset works that way in all hardware platforms supported by Linux? Even it does, no one intending to write portable UNIX code can rely on it anyway.
- lmm 10y ago> As for GNU/Linux, can you assure memset works that way in all hardware platforms supported by Linux? I don't know, that's why I'm asking. I'm not going to try to write code portable to all theoretically possible unices - I doubt anyone has managed that for nontrivial programs, and it's too hard to tell. Hell, I'm content to exclude a fair few systems I know exist (CHAR_BIT != 8, non-IEEE FP). If it's supported on all the platforms I've heard of I'll do it - it's just not practical to hope to be POSIX-complient in a language-lawyer sense.
- pjmlp 10y ago> I doubt anyone has managed that for nontrivial programs, and it's too hard to tell. In the early 2000's, the company I worked for was deploying UNIX based software for GNU/Linux, FreeBSD, HP-UX, Aix, Solaris and Windows (yes Windows, not a typo).
- lmm 10y agoSure, writing a program that works on 6 actually existing unices with test instances (or even just documentation) is relatively easy. Writing one for all possible unices including some that don't exist at the time of writing is a lot harder.
- pjmlp 10y agoThose 6 were already enough to learn how "portable" POSIX actually is.