From patchwork Fri Oct 19 16:27:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 986863 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=fb.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=fb.com header.i=@fb.com header.b="PQXaN0+c"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42cBFb4M6rz9sj4 for ; Sat, 20 Oct 2018 03:29:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727850AbeJTAgL (ORCPT ); Fri, 19 Oct 2018 20:36:11 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:59582 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727038AbeJTAgL (ORCPT ); Fri, 19 Oct 2018 20:36:11 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w9JGRPrs009869 for ; Fri, 19 Oct 2018 09:29:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=31L4YiC8RAUdeKsEXXX3CDuzfHX0FiKLSMEE401LNxQ=; b=PQXaN0+c5w63KRZ6r/U2R2QCT/ud2vy7v3JrdQXRX9mL9B2PEI1/Cj3HaE7L4tIIOo0K jXNnE9uG/FvsTKfytFkR0WcyQXaKSBFctM6dKw65W0E0E+gL4wHCi2L4+LF2KJbvNW27 cSXSO9zoRO3T+UtFWkMBOqqJsNSM47HL754= Received: from maileast.thefacebook.com ([199.201.65.23]) by m0001303.ppops.net with ESMTP id 2n7jt1g08j-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 19 Oct 2018 09:29:20 -0700 Received: from mx-out.facebook.com (2620:10d:c0a1:3::13) by mail.thefacebook.com (2620:10d:c021:18::174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1531.3; Fri, 19 Oct 2018 09:27:58 -0700 Received: by devbig006.ftw2.facebook.com (Postfix, from userid 4523) id EE75262E0DEC; Fri, 19 Oct 2018 09:27:49 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Song Liu Smtp-Origin-Hostname: devbig006.ftw2.facebook.com To: CC: , , , , Song Liu Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH v7 bpf-next 0/2] bpf: add cg_skb_is_valid_access Date: Fri, 19 Oct 2018 09:27:46 -0700 Message-ID: <20181019162748.1285423-1-songliubraving@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-19_07:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Changes v6 -> v7: 1. Make dummy sk a global variable (test_run_sk). Changes v5 -> v6: 1. Fixed dummy sk in bpf_prog_test_run_skb() as suggested by Eric Dumazet. Changes v4 -> v5: 1. Replaced bpf_compute_and_save_data_pointers() with bpf_compute_and_save_data_end(); Replaced bpf_restore_data_pointers() with bpf_restore_data_end(). 2. Fixed indentation in test_verifier.c Changes v3 -> v4: 1. Fixed crash issue reported by Alexei. Changes v2 -> v3: 1. Added helper function bpf_compute_and_save_data_pointers() and bpf_restore_data_pointers(). Changes v1 -> v2: 1. Updated the list of read-only fields, and read-write fields. 2. Added dummy sk to bpf_prog_test_run_skb(). This set enables BPF program of type BPF_PROG_TYPE_CGROUP_SKB to access some __skb_buff data directly. Song Liu (2): bpf: add cg_skb_is_valid_access for BPF_PROG_TYPE_CGROUP_SKB bpf: add tests for direct packet access from CGROUP_SKB include/linux/filter.h | 21 +++ kernel/bpf/cgroup.c | 6 + net/bpf/test_run.c | 8 + net/core/filter.c | 36 ++++- tools/testing/selftests/bpf/test_verifier.c | 171 ++++++++++++++++++++ 5 files changed, 241 insertions(+), 1 deletion(-) --- 2.17.1