From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbcGSJcX (ORCPT ); Tue, 19 Jul 2016 05:32:23 -0400 Received: from mail-it0-f47.google.com ([209.85.214.47]:37836 "EHLO mail-it0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753209AbcGSJcT (ORCPT ); Tue, 19 Jul 2016 05:32:19 -0400 Date: Tue, 19 Jul 2016 02:32:16 -0700 From: Sargun Dhillon To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: alexei.starovoitov@gmail.com, daniel@iogearbox.net Subject: [PATCH net-next v3 0/2] bpf: add copy_to_user helper & example Message-ID: <20160719093214.GA23733@ircssh.c.rugged-nimbus-611.internal> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series contains two patches that add support for a copy_to_user helper to BPF programs. This allows them to manipulate user memory during the course of tracing. The second patch in the series has an example that uses it, in one the intended ways to divert execution. Thanks to Alexei Starovoitov for review, I've made changes based on his recommendations. --- v1->v2: restrict writing to user space, as opposed to globally v2->v3: Fixed formatting issues Sargun Dhillon (2): bpf: Add bpf_copy_to_user BPF helper to be called in tracers (kprobes) samples/bpf: Add example of using bpf_copy_to_user in bpf kprobes include/uapi/linux/bpf.h | 11 +++++++ kernel/trace/bpf_trace.c | 31 +++++++++++++++++++ samples/bpf/Makefile | 4 +++ samples/bpf/bpf_helpers.h | 2 ++ samples/bpf/tracex7_kern.c | 51 +++++++++++++++++++++++++++++++ samples/bpf/tracex7_user.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 174 insertions(+) create mode 100644 samples/bpf/tracex7_kern.c create mode 100644 samples/bpf/tracex7_user.c -- 2.7.4