Received: by 10.223.148.5 with SMTP id 5csp7311827wrq; Thu, 18 Jan 2018 04:01:53 -0800 (PST) X-Google-Smtp-Source: ACJfBos8OGOchvdnWPtIdf8zcTPFGCQmRKLvmeeAU5b3YknDHMngeEVN+JXazUYdozkIRx0zH7bS X-Received: by 10.101.100.69 with SMTP id s5mr29222416pgv.88.1516276913266; Thu, 18 Jan 2018 04:01:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516276913; cv=none; d=google.com; s=arc-20160816; b=Q3bu7bxfD/8Uaq9Vw2WtYwQOwDfuVwIgXi8peXnCQDErDnAyz6p5bCZ/mFCBPjqSNo 11VBCItRQLxhon4Ws+Zq+HKTdb0Ij9Zxl4KXpWEmiWRCK9IUaGWC77rtl9OpZHiQw51d MshmE3rpJTTutbwXV1uI4jv22v03iBx4fEUBq/vn4zF5vp59yBzIxiib8VSsSbDJPKSm 48aO5/JJnxlECcD3xP3v+dljR1920ylaECK2p8F35UTcsLAUIcLni6tVavaXSnvVF0/D 4YvK/2UFx0t0/7BcHXdN00DYgLPDOwOBK5ME4U+CDoFJMJpNK5cZFMuSDArOS0hbUALK hMYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=PqjK+KV+jKmJLoWh6f0n+fkmZTVZ1100MqImF7e6qxs=; b=MitY9kUJ0/Ea0j/UMsAGH9xl47jP+Grr8W3JqHm2uroC4v05VmUbToUG9T2mjD06Gx Nh54Ijx90V+AXuYv+PmYrr/TxVf2zMtHyZa0ZCYmYubsZoSVCavcR+ML4wweZ7oV/9Zw JFb7phlTrvZVoZK9C92iRMKRsio/ofyLoSKiHrQpSXLCEphvHAG2jOM5fCFukcPypo+f rLR8U/5bwRzyLtviE2uOTCkXO20s6L3hSUxe7Wm08QNrhRc1bhNA2dBCK8BdgdvnYkM1 bymYO9GHtwrnIPsRalVhSqRzt33mFPdK1rAIHcpT/2lmVIDCXt+oGEstGuyvJ8fxTUm6 BOLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si5791628pgf.263.2018.01.18.04.01.38; Thu, 18 Jan 2018 04:01:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932218AbeARMBP (ORCPT + 99 others); Thu, 18 Jan 2018 07:01:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:40008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754855AbeARMBO (ORCPT ); Thu, 18 Jan 2018 07:01:14 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 15A7D20837; Thu, 18 Jan 2018 12:01:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15A7D20837 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: Ingo Molnar , David Woodhouse Cc: Masami Hiramatsu , linux-kernel@vger.kernel.org, Andi Kleen , Greg Kroah-Hartman , Arjan van de Ven , Peter Zijlstra , Ananth N Mavinakayanahalli , Thomas Gleixner , "H . Peter Anvin" Subject: [PATCH v1 tip/master 0/3] kprobes/x86: retpoline: Fix kprobes for retpoline Date: Thu, 18 Jan 2018 21:00:48 +0900 Message-Id: <151627684798.24682.2979775081582774869.stgit@devbox> X-Mailer: git-send-email 2.13.6 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is a series of patches to fix kprobes issues on the kernel with CONFIG_RETPOLINE=y. - [1/3]: This introduces __x86_indirect_thunk_* boundary symbols so that kprobes easily identify those functions. - [2/3]: Mark __x86_indirect_thunk_* as blacklisted function for kprobes, since it can be called from other blacklisted functions. - [3/3]: Check jmp instructions in the probe target function whether it jumps into the __x86_indirect_thunk_*, because it is equal to an indirect jump instruction. Side effect: [1/3] will move __x86_indirect_thunk_* functions in kernel text area. Of course those functions were in the .text area, but placed in right after _etext. This just moves it right before the _etext. Thank you, --- Masami Hiramatsu (3): retpoline: Introduce start/end markers of indirect thunk kprobes/x86: Blacklist indirect thunk functions for kprobes kprobes/x86: Disable optimizing on the function jumps to indirect thunk arch/x86/include/asm/nospec-branch.h | 3 +++ arch/x86/kernel/kprobes/opt.c | 23 +++++++++++++++++++++- arch/x86/kernel/vmlinux.lds.S | 35 ++++++++++++++++++++++++++++++++++ arch/x86/lib/retpoline.S | 3 ++- 4 files changed, 62 insertions(+), 2 deletions(-) -- Masami Hiramatsu (Linaro)