From patchwork Fri Apr 26 17:11:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin KaFai Lau X-Patchwork-Id: 1091670 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="gl6YqLx3"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44rLDX62Hlz9s3Z for ; Sat, 27 Apr 2019 03:11:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726315AbfDZRLH (ORCPT ); Fri, 26 Apr 2019 13:11:07 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42800 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbfDZRLG (ORCPT ); Fri, 26 Apr 2019 13:11:06 -0400 Received: from pps.filterd (m0109333.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3QH9mm5016877 for ; Fri, 26 Apr 2019 10:11:05 -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 : content-transfer-encoding; s=facebook; bh=eolrUtjttQLdmQLUbYVmlKc0ar3pgQwRUJEVk7nGgLU=; b=gl6YqLx37fNXxuoqi5oOTL5V49KvCqTAOIoL4xLvjjAo4Qyzph5KgWso5zSgT9WkqEA1 wL2kUR9XUvtL3UgKOqnRRp3RxmNmrUXOCc3THJOnnTwVlIZ4nswneG2n8dnfRKBz9/ux +p0+GeYh5fyaovo9Kus3PSsvDUW+kQI360g= Received: from mail.thefacebook.com (mailout.thefacebook.com [199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2s447r0ewc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 26 Apr 2019 10:11:05 -0700 Received: from mx-out.facebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5; Fri, 26 Apr 2019 10:11:04 -0700 Received: by devbig005.ftw2.facebook.com (Postfix, from userid 6611) id 4FD6229421AA; Fri, 26 Apr 2019 10:11:02 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Martin KaFai Lau Smtp-Origin-Hostname: devbig005.ftw2.facebook.com To: , CC: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , John Fastabend , , Yonghong Song Smtp-Origin-Cluster: ftw2c04 Subject: [PATCH v3 bpf-next 0/6] BPF sk local storage Date: Fri, 26 Apr 2019 10:11:02 -0700 Message-ID: <20190426171102.61757-1-kafai@fb.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-26_11:, , 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 v3: - Replace spinlock_types.h with spinlock.h in patch 1 (kbuild test robot ) v2: - Add the "test_maps.h" file in patch 5 This series introduces the BPF sk local storage. The details is in the patch 1 commit message. Martin KaFai Lau (6): bpf: Introduce bpf sk local storage bpf: Sync bpf.h to tools bpf: Support BPF_MAP_TYPE_SK_STORAGE in bpf map probing bpf: Add verifier tests for the bpf_sk_storage bpf: Add BPF_MAP_TYPE_SK_STORAGE test to test_maps bpf: Add ene-to-end test for bpf_sk_storage_* helpers include/linux/bpf.h | 2 + include/linux/bpf_types.h | 1 + include/net/bpf_sk_storage.h | 13 + include/net/sock.h | 5 + include/uapi/linux/bpf.h | 44 +- kernel/bpf/syscall.c | 3 +- kernel/bpf/verifier.c | 27 +- net/bpf/test_run.c | 2 + net/core/Makefile | 1 + net/core/bpf_sk_storage.c | 796 ++++++++++++++++++ net/core/filter.c | 12 + net/core/sock.c | 5 + tools/bpf/bpftool/map.c | 1 + tools/include/uapi/linux/bpf.h | 44 +- tools/lib/bpf/libbpf_probes.c | 74 +- tools/testing/selftests/bpf/Makefile | 25 +- tools/testing/selftests/bpf/bpf_helpers.h | 5 + .../selftests/bpf/map_tests/sk_storage_map.c | 638 ++++++++++++++ .../bpf/progs/test_sock_fields_kern.c | 49 ++ tools/testing/selftests/bpf/test_maps.c | 18 +- tools/testing/selftests/bpf/test_maps.h | 17 + .../testing/selftests/bpf/test_sock_fields.c | 115 ++- tools/testing/selftests/bpf/test_verifier.c | 42 +- tools/testing/selftests/bpf/verifier/sock.c | 116 +++ 24 files changed, 2015 insertions(+), 40 deletions(-) create mode 100644 include/net/bpf_sk_storage.h create mode 100644 net/core/bpf_sk_storage.c create mode 100644 tools/testing/selftests/bpf/map_tests/sk_storage_map.c create mode 100644 tools/testing/selftests/bpf/test_maps.h