Message ID | 20200504131326.18290-4-broonie@kernel.org (mailing list archive) |
---|---|
State | Mainlined |
Commit | c71052cc9e14db90d9a95fe0991ecc72556f1818 |
Headers | show |
Series | arm64: Make NOP handling a whitelist | expand |
On Mon, May 04, 2020 at 02:13:25PM +0100, Mark Brown wrote: > Currently the kernel assumes that any HINT which it does not explicitly > recognise is skippable. This is not robust as new instructions may be > added which need special handling, and in any case software should only > be using explicit NOP instructions for deliberate NOPs. > > This has the effect of rendering PAC and BTI instructions unprobeable > which means that probes can't be inserted on the first instruction of > functions built with those features. > > Signed-off-by: Mark Brown <broonie@kernel.org> > Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/kernel/insn.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c > index 0829bb5b45ec..15c3f0643e3b 100644 > --- a/arch/arm64/kernel/insn.c > +++ b/arch/arm64/kernel/insn.c > @@ -57,14 +57,10 @@ bool __kprobes aarch64_insn_is_steppable_hint(u32 insn) > return false; > > switch (insn & 0xFE0) { > - case AARCH64_INSN_HINT_YIELD: > - case AARCH64_INSN_HINT_WFE: > - case AARCH64_INSN_HINT_WFI: > - case AARCH64_INSN_HINT_SEV: > - case AARCH64_INSN_HINT_SEVL: > - return false; > - default: > + case AARCH64_INSN_HINT_NOP: > return true; > + default: > + return false; > } > } > > -- > 2.20.1 >
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index 0829bb5b45ec..15c3f0643e3b 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c @@ -57,14 +57,10 @@ bool __kprobes aarch64_insn_is_steppable_hint(u32 insn) return false; switch (insn & 0xFE0) { - case AARCH64_INSN_HINT_YIELD: - case AARCH64_INSN_HINT_WFE: - case AARCH64_INSN_HINT_WFI: - case AARCH64_INSN_HINT_SEV: - case AARCH64_INSN_HINT_SEVL: - return false; - default: + case AARCH64_INSN_HINT_NOP: return true; + default: + return false; } }