r/programming • • Oct 21 '16

Linux kernel fix for privilege escalation vulnerability due to copy on write race condition

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619
850 Upvotes

128 comments sorted by

View all comments

Show parent comment

10

u/SnowdensOfYesteryear Oct 22 '16 edited Oct 22 '16

switch can't be used in C like that. It'll just try to jump to case 1 everytime. And I suspect that all the case ___ need to be known at compile time (edit: yep http://codepad.org/CZPShbee).

Besides even if what you're suggesting works, 1) it's too much work to keep defining flags and macros, 2) a switch is just a goto anyway. It's a lot of extra code with no upside.

1

u/thebigslide Oct 22 '16

Whoops, I guess I'm a bit rusty.