Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1241559imu; Fri, 11 Jan 2019 18:28:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN4zX29IzRU0XPxSmBliQY5Hpcx9lzulFDEWNzAGQOXVNbvpEnFm/JdONQGpUTDTbCw6r0/A X-Received: by 2002:a62:d206:: with SMTP id c6mr703084pfg.245.1547260134402; Fri, 11 Jan 2019 18:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547260134; cv=none; d=google.com; s=arc-20160816; b=I7re6ORibpxoF8dEIz7WPygNvvzvNtbwEkS9n/C60Vjo2Q6A/xeWt/wd9jk+WelTkX mKny22XrQfHaMQjr4rTY7XtzMhlbGyO4tKuYOHbxeGA2lQ5HV7nh1j+vRUvq7n8y9Sfd bIl7pgbRTLsuh5iBox1v2ac4+fU+tIOhl3MU+eM6LAobAHBqwuvOChR2Zzm+kGf34HFV Q/2/5O8uCuZ6b0gi6gwjKNmCm16y1QowHCshlgQEw1+ylCHESZZIj/x/vgFpxML7zVTK AD0G2rGDrZa2o3iTLU77Mg1gQ5rCXDr73zSaQ2q0JYFsRsZx8aVlTxyq40HvEnETcPZM 4HTw== 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=NrQFc5DGrQbG2oYnOVQ0llVYV70sgQU5/MVmjZSI//U=; b=bMUKR533Z3a+fZ1iLiUFMDKmCsyWa28nlpqu1nS6bxmWccQdJY+GGnDaG4xgggIKxs 8cE42X/rPMpfMuh4Jc+a8JCfnf6F7jVV6bCb9jqY7qBnyza9ckEZphAMaLu5vrAgm48L vWAKsiK+3Eecdy2rgkLbml15wZmogt5pET5RyeiSgwyI0O2uXqnyAcu9XkTP+qWHCvRm mqj/25+RljeOj4g/qwSXrgFm5BeczS6HSOy9BplVeMBFz3qWJwGNDh1MiSYqKcjtly7X Z0rPZnKxhk0wvWTJNPatua6z3HetKUXigSim6rvN/oUdyXjBuBire4BMe1MMPMvT8vmy LJvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tZi7+xDx; 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 l7si3572703pfb.31.2019.01.11.18.28.38; Fri, 11 Jan 2019 18:28:54 -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=tZi7+xDx; 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 S1726553AbfALC1B (ORCPT + 99 others); Fri, 11 Jan 2019 21:27:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:47940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbfALC1A (ORCPT ); Fri, 11 Jan 2019 21:27:00 -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 2448220872; Sat, 12 Jan 2019 02:26:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547260020; bh=M9BzOKcjSHrnF/hxoyZFdVlh1Oa72HK6z/2/YIL0ijY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZi7+xDxsCBP5fDm9eyoCPLP+2Ms8oTJPrkM7O+UhE6CsBjm8OR/Lj019jjz9xbqR m6UCB3JarYgTVXT4GeXqAD4uEaHPamaXlcAEq28qWfBqhsYBkmXuUhXR+NyzkrA6VM oNMh949dO6ERLCTpSm3j5yE1zNLPeKL7xOwOPI7M= From: Masami Hiramatsu To: Ingo Molnar Cc: Masami Hiramatsu , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Andrea Righi , Steven Rostedt Subject: [PATCH v2 2/9] x86/kprobes: Move trampoline code into RODATA Date: Sat, 12 Jan 2019 11:26:37 +0900 Message-Id: <154725999715.18060.12029300333454823166.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 Move optprobe trampoline code into RODATA since it is not executed, but copied and modified to be used on a trampoline buffer. Signed-off-by: Masami Hiramatsu --- arch/x86/kernel/kprobes/opt.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index 544bd41a514c..f14262952015 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c @@ -97,6 +97,7 @@ static void synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long val) } asm ( + ".pushsection .rodata\n" "optprobe_template_func:\n" ".global optprobe_template_entry\n" "optprobe_template_entry:\n" @@ -136,16 +137,10 @@ asm ( #endif ".global optprobe_template_end\n" "optprobe_template_end:\n" - ".type optprobe_template_func, @function\n" - ".size optprobe_template_func, .-optprobe_template_func\n"); + ".popsection\n"); 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)