Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1241282imu; Fri, 11 Jan 2019 18:28:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN6jkaY43YtifTumqZlVBL9L0prWg/p3NZbctnDf6J2+Mx12/NPivK5huquFlJV3hfl3Pm7m X-Received: by 2002:a62:b2c3:: with SMTP id z64mr16724889pfl.120.1547260104500; Fri, 11 Jan 2019 18:28:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547260104; cv=none; d=google.com; s=arc-20160816; b=YDijx3dB2+isIlesIYR+2wVYgi9/MVzdFZOpfD68D74swlfgBvAtCSzJLXvO1R2DAO ffuhPeuKn8HEEmGydMTnexPoo5Yeqiq246O/H+4nsxj2SkwHbrTKtmL8l7FsyhvHCPiD fBUaXCHN3m3YNmnY4kClHAr6mSzc7azp3Mq8V638j/OjL2EOBkp9Z6JTsQtXwAMzu6lk ReGh4CWXtAMwOab2oykb6+YtG0LR2ReZmDQnALXnyQThFkE9LfPSqBYi+a+QZ/hF2Wa6 QW1Vmv8rmXTrrt67IeeDx86UFPLBxcEPdz3HU5DVNSFO4CiaQoNF9M+0F0mcYqCnF5fa pj8g== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UM0YsJuLyb14PuXwCFeWc1TqGSKAMn1tm5qhi3tJ2ow=; b=g9/RlQiZXtcJn8XgPskty9nFSzD/QJh9n9SK7tmV9FkdmqpSEbthLM9hFpHe0/PvWM xrE/gE6ClCFlpefVgPQd+xA0jgOe9UIm8YJ4d7rcH4XQXybMP9qCyFzMW/54KwFHjnDd sJUP+ho7iufc0khjgHk+lYzYWLptX1G2xzoxeiQIzpjeiZCd/L0qK8TtuL3266qYukd3 0jniQhISiW/8ItMk3yhp4uG9Jx3toqOC1mco8o8ZYkCAlUCKP+5S9AaW2XhTZVWvURSg hxCStQuLP+3IpZSGPMK+SQqrj8eKcM8E4yztJFp324RfXFcWdOIR70OQw3Ym8kVaCGYt ySMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UFdoqdXN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si18473632pgg.357.2019.01.11.18.28.03; Fri, 11 Jan 2019 18:28:24 -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; dkim=pass header.i=@kernel.org header.s=default header.b=UFdoqdXN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbfALC0c (ORCPT + 99 others); Fri, 11 Jan 2019 21:26:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:47778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfALC0c (ORCPT ); Fri, 11 Jan 2019 21:26:32 -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 C7F1D20872; Sat, 12 Jan 2019 02:26:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547259991; bh=8LZm9dNn3cys+j98zjuWUS3/y2IImFDWESUVHisUDgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFdoqdXNAREgoJNv0aUZveP31L61yuKHwp1XtottSODlFI87e0Tvebr4UVh4JsUPV 6r4ufcDswyMc8gRHN7CFyyGJain6hRTiT9B+7qR1ie+Tw6pIH8u9L8ZWMadQPhE5ZY oaesUYJm1ruUQdgOp1fU68fDe9sB4sqhimhue4i4= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH v2 1/9] x86/kprobes: Prohibit probing on optprobe template code Date: Sat, 12 Jan 2019 11:26:09 +0900 Message-Id: <154725996885.18060.7107278512876517981.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154725993986.18060.2759150647140353514.stgit@devbox> References: <154725993986.18060.2759150647140353514.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Fixes: 9326638cbee2 ("kprobes, x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation") Cc: stable@vger.kernel.org --- 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)