android_kernel_xiaomi_sm8350/drivers/idle
Neal Liu 476c942d9b BACKPORT: FROMLIST: cpuidle: change enter_s2idle() prototype
Control Flow Integrity(CFI) is a security mechanism that disallows
changes to the original control flow graph of a compiled binary,
making it significantly harder to perform such attacks.

init_state_node() assign same function callback to different
function pointer declarations.

static int init_state_node(struct cpuidle_state *idle_state,
                           const struct of_device_id *matches,
                           struct device_node *state_node) { ...
        idle_state->enter = match_id->data; ...
        idle_state->enter_s2idle = match_id->data; }

Function declarations:

struct cpuidle_state { ...
        int (*enter) (struct cpuidle_device *dev,
                      struct cpuidle_driver *drv,
                      int index);

        void (*enter_s2idle) (struct cpuidle_device *dev,
                              struct cpuidle_driver *drv,
                              int index); };

In this case, either enter() or enter_s2idle() would cause CFI check
failed since they use same callee.

Align function prototype of enter() since it needs return value for
some use cases. The return value of enter_s2idle() is no
need currently.

Bug: 159445192
Bug: 159672235
Change-Id: Iffc9e1b6a17471ca4291865ab3dc8803303a38ce
Link: https://lore.kernel.org/lkml/1595820346-4361-2-git-send-email-neal.liu@mediatek.com/
Signed-off-by: Neal Liu <neal.liu@mediatek.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2020-07-29 14:37:49 +00:00
..
intel_idle.c BACKPORT: FROMLIST: cpuidle: change enter_s2idle() prototype 2020-07-29 14:37:49 +00:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00