From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: ACJfBovLCb66pJ/l4kQfUJHMKoDDAhw94xm/xGlgguz/HPyPRn/HGU9dRg2BeDTfM0upM337kP2S ARC-Seal: i=1; a=rsa-sha256; t=1516276874; cv=none; d=google.com; s=arc-20160816; b=rU9mQgCc1YIHoQA4Xz+5G8dBlo4UNttILM5l9+w4ercwlXAQqtDPQkUuHKdR5is2+M MeuSktwN+Qnqpcf0TuvdR4iru9vDoWzI0eKjWhUMPp8BaeCYHqoL/k2wecUoV2v8Tg08 fIUI6QznWaJRWXikcTamCrrdACOKI/mCyJoB0OFwhl72Gvbql2LadVVmESiMkIHLRirl YThgVsAvts+StrsrAEtu4YGgroC153O7m9vXFlE1gMmaneifGW+xuT5kXV/Wwpa7zEdP 7pqlwnpAGnlp/RnAqfcPM8FRpsKFSYz5mHGwzjS5+cLewEZ+brOKuPMWijFEk145IGv+ nRxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=kTxiT+WwQrVxURtTIbMLLMozBmv2i5fU2hTJFkcEzWSHSzupN6P7j+ChVCpOMyM6t5 eunADdZphFD2t8wBPptDiziLqX76ox447EzM2sIwDZwLUOMs9sz7PqLWltDFgUSoxery ohs0lFN8QxoeBnyaNgeuSnH3/KdtzfFb5GKfThSUTqN4MvsWVtkXyGbgpq2dDFK6if4B lhR1mmPjHeptuQvSDtQrZyizTl9EIxBNbUJiATEdr8YzYTVz+oZyN0iXQWdien3QLGm3 XaiWU9hUCyvXu/g2uEFWHuRZXrJfcm3kwnhft4DnCCaNBXH4V1BonWGTiNp550nNB5MF 20qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of mhiramat@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=mhiramat@kernel.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589931539308254743?= X-GMAIL-MSGID: =?utf-8?q?1589931539308254743?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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)