History log of /arch/arm64/kernel/jump_label.c
Revision Date Author Comments
a4a8d5398c9325f6b952c90e35d7af13f8c33f6f 25-Nov-2014 Mark Rutland <mark.rutland@arm.com> UPSTREAM: arm64: jump labels: NOP out NOP -> NOP replacement

In the arm64 arch_static_branch implementation we place an A64 NOP into
the instruction stream and log relevant details to a jump_entry in a
__jump_table section. Later this may be replaced with an immediate
branch without link to the code for the unlikely case.

At init time, the core calls arch_jump_label_transform_static to
initialise the NOPs. On x86 this involves inserting the optimal NOP for
a given microarchitecture, but on arm64 we only use the architectural
NOP, and hence replace each NOP with the exact same NOP. This is
somewhat pointless.

Additionally, at module load time we don't call jump_label_apply_nops to
patch the optimal NOPs in, unlike other architectures, but get away with
this because we only use the architectural NOP anyway. A later notifier
will patch NOPs with branches as required.

Similarly to x86 commit 11570da1c5b1dee1 (x86/jump-label: Do not bother
updating NOPs if they are correct), we can avoid patching NOPs with
identical NOPs. Given that we only use a single NOP encoding, this means
we can NOP-out the body of arch_jump_label_transform_static entirely. As
the default __weak arch_jump_label_transform_static implementation
performs a patch, we must use an empty function to achieve this.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Laura Abbott <lauraa@codeaurora.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

(cherry picked from commit 6ddae4186886a81e22ad78ad7c6936ed36bc8225)
Signed-off-by: Tomasz Figa <tfiga@chromium.org>

Bug: 24475017

Change-Id: I9ef07c3a5a7f91418b30006850fcc0c421e147e2
Signed-off-by: Kees Cook <keescook@google.com>
9732cafd9dc0206479be919baf0067239f0a63ca 07-Jan-2014 Jiang Liu <liuj97@gmail.com> arm64, jump label: optimize jump label implementation

Optimize jump label implementation for ARM64 by dynamically patching
kernel text.

Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>