From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751466AbdC0HvI (ORCPT ); Mon, 27 Mar 2017 03:51:08 -0400 Received: from mail.kernel.org ([198.145.29.136]:47700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751468AbdC0Hu7 (ORCPT ); Mon, 27 Mar 2017 03:50:59 -0400 From: Masami Hiramatsu To: linux-kernel@vger.kernel.org, Ingo Molnar Cc: Peter Zijlstra , Thomas Gleixner , "H . Peter Anvin" , Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , Andrey Ryabinin , Ye Xiaolong , mhiramat@kernel.org Subject: [RFC PATCH tip/master V2 1/8] kprobes/x86: Fix not to boost call far instruction Date: Mon, 27 Mar 2017 16:49:57 +0900 Message-Id: <149060098757.12303.8553696655809472967.stgit@devbox> X-Mailer: git-send-email 2.9.3 In-Reply-To: <149060091581.12303.13449343279538504544.stgit@devbox> References: <149060091581.12303.13449343279538504544.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix kprobe-booster not to boost call far instruction, because call may store the address in singlestep execution buffer to the stack, which should be modified after single stepping. Currently, this instruction will be filtered as not boostable in resume_execution(), so this is not a critical issue. Signed-off-by: Masami Hiramatsu --- arch/x86/kernel/kprobes/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 993fa4f..9eae5a6 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -200,6 +200,8 @@ int can_boost(kprobe_opcode_t *opcodes, void *addr) return (opcode != 0x62 && opcode != 0x67); case 0x70: return 0; /* can't boost conditional jump */ + case 0x90: + return opcode != 0x9a; /* can't boost call far */ case 0xc0: /* can't boost software-interruptions */ return (0xc1 < opcode && opcode < 0xcc) || opcode == 0xcf;