On Tue, Aug 17, 2021 at 11:56:56AM +0100, Andrew Cooper wrote:
> Some versions of GCC complain with:
>
> traps.c:405:22: error: 'get_shstk_bottom' defined but not used
> [-Werror=unused-function]
> static unsigned long get_shstk_bottom(unsigned long sp)
> ^~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> Change #ifdef to if ( IS_ENABLED(...) ) to make the sole user of
> get_shstk_bottom() visible to the compiler.
>
> Fixes: 35727551c070 ("x86/cet: Fix shskt manipulation error with
> BUGFRAME_{warn,run_fn}")
> Signed-off-by: Andrew Cooper <[email protected]>
> ---
> CC: Jan Beulich <[email protected]>
> CC: Roger Pau Monné <[email protected]>
> CC: Wei Liu <[email protected]>
> CC: Marek Marczykowski-Górecki <[email protected]>
>
> Not actually tested. I don't seem to have a new enough GCC to hand.I have just compile-tested it and it seems to fix the issue (indeed it failed before with CONFIG_XEN_SHSTK disabled). > Most of the delta here is indentation. This diff is more easily reviewed with > `git show --ignore-all-space` Wouldn't this make the compiler include the code even if CONFIG_XEN_SHSTK is disabled (not a huge issue...)? Or is it smart enough to optimize it out in that case? -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
signature.asc
Description: PGP signature
