Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp95748imj; Wed, 13 Feb 2019 05:20:04 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia27pVSdoAY7+143aLlzrEghVnq2FP7ONnckSm1SuJQTu4YCUqZWzNcA7zRCYUAovTXcMBu X-Received: by 2002:a17:902:1122:: with SMTP id d31mr518922pla.246.1550064004811; Wed, 13 Feb 2019 05:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550064004; cv=none; d=google.com; s=arc-20160816; b=WMyW9FpvPRAAl8tUBW+KZiiwJvSnaFurEb7g2yDJOtOOU6lGqeAT/eW3tnboMw+Lct q7HY090hzdGBNMh8eBb2PfCD1ai1t9BXkCpvbyviSNv3H1SCL9v3EyK7ha3LoVGHTWX+ PWLXH6HuWD8bnBM6V1cyN+cJus9ctAv5CrINFy/GX83JP5BBiNc4XJuJdIqbYNsidzBt mXFnxWs9lHvTq960b8Hzb5RCmxs6cgX4ynDCRBnJpYzQxPRU213ZBjluJIcyr0MdUelj +RaQ6g/7bAiF/W1nkgyBb28AhpaqT5k0Ky6WDVxmFk6tDbue+Hf13TBZXPU2PGB9NR2r AEbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=gufiOuMU7rEAexnOYSbXQSyVgOHO6+3YPE3bGRQMXbU=; b=PvugxnBsNeMSziETsObHJ5LaPbvTlS915v62x1mNOXpEn3oIEIWskWIb0eAWJin5er TAiwS5pDyncOpbBjtDzvkZY4MEJqT4DOMq1F5VkNGmFJM0Q425KbIJP0AoE1BWjW5KEu i/II4d6n51MOQwou/wD2sQl7w/+E+4YcjTulgIqPnyh9zSpvrK58AzPXjVxJK7N3rD0p T9zOrbBb5pwBCFvDJAYBVKZpjaj2CwUtjPnK4YuXgd8m4J6ulleoYwlyPgpSHM2OT/wL a9qySWx60T0yu2DEMrr6RZmDiB6R3zgO0HRyHJNk8GcF+Q1ZNXGzEOjydxdyzyC2yjwA /PPA== 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 k12si14706461pgg.382.2019.02.13.05.19.37; Wed, 13 Feb 2019 05:20:04 -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 S2390962AbfBMI7w (ORCPT + 99 others); Wed, 13 Feb 2019 03:59:52 -0500 Received: from terminus.zytor.com ([198.137.202.136]:60173 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390952AbfBMI7u (ORCPT ); Wed, 13 Feb 2019 03:59:50 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x1D8wtZV195690 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 13 Feb 2019 00:58:55 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x1D8wsLi195687; Wed, 13 Feb 2019 00:58:54 -0800 Date: Wed, 13 Feb 2019 00:58:54 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Masami Hiramatsu Message-ID: Cc: righi.andrea@gmail.com, jolsa@redhat.com, torvalds@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, mathieu.desnoyers@efficios.com, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org Reply-To: mathieu.desnoyers@efficios.com, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, alexander.shishkin@linux.intel.com, mhiramat@kernel.org, rostedt@goodmis.org, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, righi.andrea@gmail.com, acme@redhat.com, jolsa@redhat.com In-Reply-To: <154998787911.31052.15274376330136234452.stgit@devbox> References: <154998787911.31052.15274376330136234452.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] x86/kprobes: Prohibit probing on optprobe template code Git-Commit-ID: 0192e6535ebe9af68614198ced4fd6d37b778ebf X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, FREEMAIL_FORGED_REPLYTO,T_DATE_IN_FUTURE_96_Q autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0192e6535ebe9af68614198ced4fd6d37b778ebf Gitweb: https://git.kernel.org/tip/0192e6535ebe9af68614198ced4fd6d37b778ebf Author: Masami Hiramatsu AuthorDate: Wed, 13 Feb 2019 01:11:19 +0900 Committer: Ingo Molnar CommitDate: Wed, 13 Feb 2019 08:16:39 +0100 x86/kprobes: Prohibit probing on optprobe template code Prohibit probing on optprobe template code, since it is not a code but a template instruction sequence. If we modify this template, copied template must be broken. Signed-off-by: Masami Hiramatsu Cc: Alexander Shishkin Cc: Andrea Righi Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mathieu Desnoyers Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Thomas Gleixner Cc: stable@vger.kernel.org Fixes: 9326638cbee2 ("kprobes, x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation") Link: http://lkml.kernel.org/r/154998787911.31052.15274376330136234452.stgit@devbox Signed-off-by: Ingo Molnar --- arch/x86/kernel/kprobes/opt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 6adf6e6c2933..544bd41a514c 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -141,6 +141,11 @@ asm ( void optprobe_template_func(void); STACK_FRAME_NON_STANDARD(optprobe_template_func); +NOKPROBE_SYMBOL(optprobe_template_func); +NOKPROBE_SYMBOL(optprobe_template_entry); +NOKPROBE_SYMBOL(optprobe_template_val); +NOKPROBE_SYMBOL(optprobe_template_call); +NOKPROBE_SYMBOL(optprobe_template_end); #define TMPL_MOVE_IDX \ ((long)optprobe_template_val - (long)optprobe_template_entry)