Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4003296imj; Tue, 12 Feb 2019 08:12:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IaVFSqR9B8pXdOPAuOV6DjvJx05/H6VQfDXH3AXtZm4eJOYhIJvhUcwgt2xMb/uKj6pzkji X-Received: by 2002:a62:3541:: with SMTP id c62mr4661495pfa.19.1549987977687; Tue, 12 Feb 2019 08:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549987977; cv=none; d=google.com; s=arc-20160816; b=upzQWzGuUNbuX4a+XnYVQ60H7S8RIhEPLylkxtIimAchYxZaXo/vqyhWZvh4rh4uIO ThJwUynbWpg48BjxhMiJjRG7NMH17ktSwqt92OGO9oGJsqaQmAyf/LJKc/uvIp2Pgt+p c0R5/Ll1BgLbXvuSzImGC4wgDuUQnU/RFzT8OXjf7ndoaivJPe9Xh7Xf4ncuFvhtE6FF wMAbZPUCsJ4NCVKF2k8nqkKdJUsTsknt4XJlbmbPG4zYdcRdekNPKehqIwtHPPXvIVJz 4FLxi/OcW22VYthhJAm1Wscl1+n0foPEgzcTqXxhipmRVUioK+mZFanqiehVU6Z3zKvw U+Hg== 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=bNkpT/KKzB2ZZ6NGIYXLtARoyDUFMlo8sE8kpernnown0WzcdSorsdl8nam5T8CHLb V3lsY7xwBF1CVoHhf0THM+RC295qOuOoStimKNfp+ZelZIQcAYSxdobF6BowJwQWXFpo iGGdyfnfNFbvTT8sYUityfwUMeFJaUHXNklELvRhnyNBp/6eNXYn9EmnI5QEwIpf4U75 tTZY4I4WTszBWcqClp9UZzDl5dC28673S4Hi71m4dFMKE0QHyhX77XLCLJKWjsUu8RxS bmkMjBSYAz9H8GWd6pii6Eb3jqTHytbRPDEOyA/hVFHA11vf+Ptta3jIkAcCn52u4Oxb YXCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ww9aOHU2; 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 n3si14105851pfn.285.2019.02.12.08.12.40; Tue, 12 Feb 2019 08:12:57 -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=ww9aOHU2; 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 S1730930AbfBLQLm (ORCPT + 99 others); Tue, 12 Feb 2019 11:11:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:41190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730818AbfBLQLm (ORCPT ); Tue, 12 Feb 2019 11:11:42 -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 11931217D9; Tue, 12 Feb 2019 16:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549987902; bh=8LZm9dNn3cys+j98zjuWUS3/y2IImFDWESUVHisUDgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ww9aOHU2HYU9VptgOQUDW6bhjdjzNg89Z94rSzPC6jEW60rs6tYf7N85gJMomQ4d5 T8qWKMBUGqTV6CnvygY76OmudUW/q1J7NCj30ekU/9ssg6Ka4WkjSDb9eK99ylz6SR 2tp1QPiPU5qbQ2+0WqrzIjZ+huSpFqTAj5cqM3nw= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH -tip v3 01/10] x86/kprobes: Prohibit probing on optprobe template code Date: Wed, 13 Feb 2019 01:11:19 +0900 Message-Id: <154998787911.31052.15274376330136234452.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <154998785011.31052.1475728497912659748.stgit@devbox> References: <154998785011.31052.1475728497912659748.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)