Messages in this thread | | | Subject | Re: [PATCH] x86, retpolines: entirely disable switch jump tables when retpolines are enabled | From | Daniel Borkmann <> | Date | Mon, 25 Mar 2019 15:37:25 +0100 |
| |
On 03/25/2019 03:28 PM, David Woodhouse wrote: > On Mon, 2019-03-25 at 14:56 +0100, Daniel Borkmann wrote: >> More than 20 switch cases are not expected to be fast-path critical, but >> it would still be good to align with gcc behavior for versions < 8.4.0 in >> order to have consistency across supported gcc versions. vmlinux size is >> slightly growing by 0.27% for older gcc. This flag is only set to work >> around affected gcc, no change for clang. > > I note your final sentence doesn't actually say that clang doesn't have > this problem, and doesn't *need* this (or an equivalent) change. > > It should say that (if it's true). And if it isn't true, then other > remedial action would be in order.
clang doesn't have this problem as analyzed back in ce02ef06fcf7 ("x86, retpolines: Raise limit for generating indirect calls from switch-case").
I thought both here would make it quite clear, from this patch commit msg:
"After this has been brought to attention to gcc folks [0], Martin Liska has then fixed gcc to align with clang by avoiding to generate switch jump tables entirely under retpolines."
And the comment in the Makefile code:
# Additionally, avoid generating expensive indirect jumps which # are subject to retpolines for small number of switch cases. # clang turns off jump table generation by default when under # retpoline builds, however, gcc does not for x86. This has # only been fixed starting from gcc stable version 8.4.0 and # onwards, but not for older ones. See gcc bug #86952.
Thanks, Daniel
| |