Open Quuxplusone opened 9 years ago
Bugzilla Link | PR22311 |
Status | NEW |
Importance | P enhancement |
Reported by | Steven Stewart-Gallus (sstewartgallus00@mylangara.bc.ca) |
Reported on | 2015-01-23 12:41:49 -0800 |
Last modified on | 2015-02-10 20:10:14 -0800 |
Version | 3.5 |
Hardware | PC Linux |
CC | llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Nevermind the volatile workaround does work. I am still cautious of it because the semantics are unclear though.
Can you explain why you think noclone is important in this example? As far as I can see, you're violating the rules for using vfork:
"the behavior is undefined if the process created by vfork() [...] calls any other function before successfully calling _exit(2) or one of the exec(3) family of functions"
Your call to 'f' here is breaking this rule.
(In reply to comment #2)
> Can you explain why you think noclone is important in this example? As far
> as I can see, you're violating the rules for using vfork:
>
> "the behavior is undefined if the process created by vfork() [...] calls any
> other function before successfully calling _exit(2) or one of the exec(3)
> family of functions"
>
> Your call to 'f' here is breaking this rule.
You are correct that this does not obey the version of the POSIX standard that
mentions vfork. However, the next version of the POSIX standard removed vfork
from the standard as it was too finicky too use and difficult for compilers to
work around. Clang itself miscompiles code that uses vfork in a conformant way
to that version of the POSIX standard. Because Clang miscompiles conformant
code using vfork, I don't expect Clang to change that and many other compilers
could miscompile the code anyways so I wrote my little wrapper that tries to
carefully isolate away some of the unsafety of vfork. I don't feel bad about
breaking that outdated version of the POSIX standard because following that
version of the standard does not work.