Re:Linux futex_wait() bug – update to latest patches now
by mikerichards on Wednesday May 13, 2015 @11:11PM
(#9543254)
from the patch I see, isn't the problem that C doesn't enforce a default case?
[ Parent
| on HN ]
Re:Linux futex_wait() bug – update to latest patches now
by asveikau on Thursday May 14, 2015 @01:08AM
(#9543524)
Was waiting for an HN user to come forward and say that a processor specific synchronization primitive bug is C's fault... Hilarious.
Much more important what the code in that new default block is doing. It's a memory fence.
Re:Linux futex_wait() bug – update to latest patches now
by cremno on Thursday May 14, 2015 @12:35AM
(#9543454)
GCC has a diagnostic for that (-Wswitch-default) but see mirashii's comment.
Re:Linux futex_wait() bug – update to latest patches now
by danieltillett on Wednesday May 13, 2015 @11:38PM
(#9543315)
The problem is not that there is not an enforced default case, but that it was not in the coding standards. I always have a default case, but this is in my coding standards.
Re:Linux futex_wait() bug – update to latest patches now
by mirashii on Wednesday May 13, 2015 @11:44PM
(#9543332)
Neither of these things actually fix the problem, which is in particular the content of the default case. default: ; break; would be just as buggy.
Re:Linux futex_wait() bug – update to latest patches now
by gpvos on Thursday May 14, 2015 @01:15AM
(#9543546)
The commit message says the code was reviewed quite thoroughly. So I think a break-only default case where the other two cases had an /* implied MB */ comment would likely have been noticed. So in this particular case, there is a fair chance that such a warning would have helped.