Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1410248imm; Wed, 1 Aug 2018 15:42:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdcq0LegkqXzl/C82rhx3yo+BxnyUyFmDOnkd62wZx/M7y7NvQNyTwjJwAyHT09aw/QE+36 X-Received: by 2002:a17:902:290a:: with SMTP id g10-v6mr214063plb.110.1533163346140; Wed, 01 Aug 2018 15:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533163346; cv=none; d=google.com; s=arc-20160816; b=EU1wzX7TsMytgFjvGPad2OW5h2rfJlpz80zkzwmYEyvz323OC5MdU1+XjcKx9ulQZa nFN/QxCRqZOSAy3Y5w2sqMKxOifSZy2xe7mQIUHksCSuz1XE+j2Okoq5LAZmeZucRqXA Ez9pfq7ZKaISGfZ8LwIiVb88N8hMuUzPJbHSrh+beMUOUt4oISqf3/2W/asxg8KxeMb7 GbzTmHyq1iRQ5Kg70229umrwNYvKi615LjXjB3fqfLjX3yQVk9FPoN3fvez8Cfl1Xu0m 9G2NFnGdTY51tZpORSsFHxFX8HlLWdIMmvmGxVCCaQM9K9l0RFEeQXY3HqLbTc7OrtxF ORug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:arc-authentication-results; bh=+JBeNTZW6yPmNkHkffn0/qgQk6o8a+HdX4w10NgZ25k=; b=vGI4ab6MovrR4CDAeEUCDmayrznVwNsaFQpRJ1i+x0TVwzBQ7MyMon5KpZ6Y/50c8I 4dK7Pk5Ba3kn8clwREJvgWvEr9YY8Ti5o6Axl1ZCXvXPg2YnK4Iku40GP5Q6sDr7fxsp JNiSFDGDVfLTmW9e4b3vQIrl521B6XB3gRWIHHflzOMMVrKdHfeySITRwQsllkBqUTe0 ddP+4SiKN9WP0EsU9MPJYRrwoo7k/oKcJw6opNtHaVDJfiRLtJniTpCwOt0d/5AMWQ7y PfpYC6JxkiJkBsmopsj9xMpLugFpb5utvd1X0B4qHLn9BPwSGHsup+PULw7E8JHX7C9i T9bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b="gmiL/67n"; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="D4/VdlFc"; 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=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf9-v6si137040plb.76.2018.08.01.15.42.11; Wed, 01 Aug 2018 15:42:26 -0700 (PDT) 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=@fb.com header.s=facebook header.b="gmiL/67n"; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b="D4/VdlFc"; 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=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387472AbeHBA0u (ORCPT + 99 others); Wed, 1 Aug 2018 20:26:50 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:45054 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732356AbeHBA0t (ORCPT ); Wed, 1 Aug 2018 20:26:49 -0400 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w71MXJYq025470; Wed, 1 Aug 2018 15:38: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=+JBeNTZW6yPmNkHkffn0/qgQk6o8a+HdX4w10NgZ25k=; b=gmiL/67nZeOchRY874kcrJNyziIdyxl73Opo7rdsA8+ydch+tj45HntJWuoQg8b8055c jTY7I6uyw4shKKC6IQ9468wjHG12CtMSAwQQv0o4P8TkvvgBgq95yu0uaFXl13BYeUkq XXN341GV84Lv5E8Xid5+5wbNlzby1JI4nAw= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2kkmytg4e0-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 01 Aug 2018 15:38:20 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 1 Aug 2018 18:38:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+JBeNTZW6yPmNkHkffn0/qgQk6o8a+HdX4w10NgZ25k=; b=D4/VdlFcaDTPYaZHT4thdfII0+JOKCzWu+PU1uQl0AU+YzBv5GUOTdCZRfpi/wZHzczXWfY5Ve9o0Ea3ItwQVqllg1MhRFMEJrxLtEVGmAa2BscXaIFmyYRvxNqsAAOqwJJ/f4xUrPkDzC6AERJtMXQI39fkeFSd6yMJYMpdzRo= Received: from castle.thefacebook.com (2620:10d:c090:200::5:7cca) by SN1PR15MB0176.namprd15.prod.outlook.com (2a01:111:e400:58cf::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.19; Wed, 1 Aug 2018 22:38:13 +0000 From: Roman Gushchin To: CC: , , Roman Gushchin , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau Subject: [PATCH v6 bpf-next 00/14] bpf: cgroup local storage Date: Wed, 1 Aug 2018 15:37:26 -0700 Message-ID: <20180801223740.11252-1-guro@fb.com> X-Mailer: git-send-email 2.14.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c090:200::5:7cca] X-ClientProxiedBy: MWHPR1601CA0016.namprd16.prod.outlook.com (2603:10b6:300:da::26) To SN1PR15MB0176.namprd15.prod.outlook.com (2a01:111:e400:58cf::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c2047bb-9a1d-4f48-7c69-08d5f7ff77cd X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:SN1PR15MB0176; X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0176;3:92Dc+nWvHwx02tuathyQirIfhsfQ49jEjWuEilw1CStvsxuwyf6OnWLoGM8iWJ43W2jkg/z1tD5IA17Ht+lL+YUj5xHHAa+49Pmy2QJuH9aWpW87P8KiJBZDwg+g/Gu9jGaQlDqT54wWlbLAMYk7/YjgW87Fo4fHXjde5GcDzVuLDVaSRF/Owxi5XmNIF7gGEvAm8HESrsbfvOTV/YLVmlTRiM/QXjHjWV5I0yE4dyrKAsJN9BAVPk7Bz1LyZMfZ;25:cN8Oom/66QaO+RcKaDM05UhK4UZ+wHlTVM3HB2Y8wwhrCxU5NgJ3FuYGsqnolBIEn6u+rD5X3kbtNiDyeDPJetpzXIjq+Dyi0gCT8+Fdc2mB7fBrBCOJ1m4avvjLSbHMZLh7PkZMmUgLc4vPjUhqcM7G5InOHVZRH7veIrd2/4s2tJ+8wxO7QTzAxDp1c3OaIK1bWNPWaF+bY3jI6oyg+QRh5TMq3ZwICvJDOpNgLKH8Bormwc6BlJnJ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5R38aB/KQXla4cILbd6NGfvTxZNrtZhChQiKS8MZQ/AWgPaHCkVbiERHWUDuI8MeMA+QM4vZEl0WrGFcZmGvRq9gdbpyHwR/saeIS02q5pjOCkGlCgBgiMy1OOAcUkfYNu57ccvyk1/ZsrQgZ74GVXTySXDHXTl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(11241501184)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:SN1PR15MB0176;BCL:0;PCL:0;RULEID:;SRVR:SN1PR15MB0176; X-Forefront-PRVS: 0751474A44 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(376002)(39860400002)(346002)(396003)(136003)(199004)(189003)(6486002)(6512007)(50226002)(6916009)(2361001)(5660300001)(53416004)(68736007)(6666003)(386003)(106356001)(6506007)(105586002)(52116002)(51416003)(86362001)(36756003)(486006)(2616005)(8936002)(81166006)(16586007)(54906003)(478600001)(50466002)(316002)(81156014)(6116002)(2351001)(69596002)(7736002)(1076002)(52396003)(14444005)(5024004)(16526019)(46003)(8676002)(4326008)(476003)(97736004)(47776003)(305945005)(186003)(2906002)(48376002)(25786009)(53936002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR15MB0176;H:castle.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR15MB0176;23:W1ce46rlGTm2KqCZFPjQR646XZYH4LQYvZDN9+A5D?= =?us-ascii?Q?rmQ1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tCb6qrv64zqm8zpMu1FDar6sbBFcE4khnx3B8c7xEXhT40phZcO53d4vCv6zRe48di8m2kkImXOfg+KekzU3m9xQ+GjSCF7h25yhLswQBCl3K8W3/QNeR1lnNsUHfEmyAa9ksB8Ay5bHzuJGWAeUYUTrNZEEIMBDCy8h598OtoC+FWCFuOGgQIIpPs24ybD4Uyqks34HI3Gy5+E668ldOmoQJaJ4IC/cpCKmME8kAM4B6A==;5:QKJeLPmY9sxQWSoKzQalti/qy6Pm9tYvFXQ9kizMFdsKWekmLCmEL4AgTfZejxSOUjrdScsbCzkecZRZLFDfiv/UlOzp2BXtxPELm3lOi0hhvFDHqSwZ2b653kujU70j6Ph+xvNobtoulOW/tXnp+PlZrOlpdlMp7d1MgOInq2A=;7:XYGjUU0k1NTDtXaoWQktYuFcwGODqK7Uvyo0Z6UWg0Uk7YIFwvXKA/JKY9dV+7OfXkYpNacKjAOINrLMgSE1QEudFdBO68cRVC+cQrCp3i0cVyZ1/8rWgZ22O7tnP94obhsGnGTe/eEEyCFh5Bml/SI868qk5XEkc3+kMilboKDv60vDIqRIYimw8WaMXXKxGcrax4p30J8ryP6NxMzGQ/SHdw3kyAr3lfv4PUyIZivSuirq3hxoGCDZImQLFVKm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0176;20:meRI5K99rFHfd2D969BeZOlmJTlby3/HSr6YNkXSu+CZT92oG568Oo2/8FbAoUmJQdq5dRtPHxmkN6n22gLtjSSBIDP6gXiPJd3T+39yr5cbQLlxwptt2oU7xZXVT2Ji4qCTwe4yPw1JEYMb2Vn6iWldXUUk7YvNg4MHk70HQq4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2018 22:38:13.4432 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c2047bb-9a1d-4f48-7c69-08d5f7ff77cd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR15MB0176 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-01_08:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset implements cgroup local storage for bpf programs. The main idea is to provide a fast accessible memory for storing various per-cgroup data, e.g. number of transmitted packets. Cgroup local storage looks as a special type of map for userspace, and is accessible using generic bpf maps API for reading and updating of the data. The (cgroup inode id, attachment type) pair is used as a map key. A user can't create new entries or destroy existing entries; it happens automatically when a user attaches/detaches a bpf program to a cgroup. From a bpf program's point of view, cgroup storage is accessible without lookup using the special get_local_storage() helper function. It takes a map fd as an argument. It always returns a valid pointer to the corresponding memory area. To implement such a lookup-free access a pointer to the cgroup storage is saved for an attachment of a bpf program to a cgroup, if required by the program. Before running the program, it's saved in a special global per-cpu variable, which is accessible from the get_local_storage() helper. This patchset implement only cgroup local storage, however the API is intentionally made extensible to support other local storage types further: e.g. thread local storage, socket local storage, etc. Patch (1) adds an ability to charge bpf maps for consuming memory dynamically. Patch (2) introduces cgroup storage maps. Patch (3) implements a mechanism to pass cgroup storage pointer to a bpf program. Patch (4) implements allocation/releasing of cgroup local storage on attaching/detaching of a bpf program to/from a cgroup. Patch (5) extends bpf_prog_array to store cgroup storage pointers. Patch (6) introduces BPF_PTR_TO_MAP_VALUE, required to skip non-necessary NULL-check in bpf programs. Patch (7) disables creation of maps of cgroup storage maps. Patch (8) introduces the get_local_storage() helper. Patch (9) syncs bpf.h to tools/. Patch (10) adds cgroup storage maps support to bpftool. Patch (11) adds support for testing programs which are using cgroup storage without actually attaching them to cgroups. Patches (12), (13) and (14) are adding necessary tests. Signed-off-by: Roman Gushchin Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Martin KaFai Lau v6->v5: - fixed an error with returning -EINVAL instead of a pointer v5->v4: - fixed an issue in verifier (test that flags == 0 properly) - added a corresponding test - added a note about synchronization, sync docs to tools/uapi/... - switched the cgroup test to use XADD - added a check for attr->max_entries to be 0, and atter->max_flags to be sane - use bpf_uncharge_memlock() in bpf_uncharge_memlock() - rebased to bpf-next v4->v3: - fixed a leak in cgroup attachment code (discovered by Daniel) - cgroup storage map will be released if the corresponding bpf program failed to load by any reason - introduced bpf_uncharge_memlock() helper v3->v2: - fixed more build and sparse issues - rebased to bpf-next v2->v1: - fixed build issues - removed explicit rlimit calls in patch 14 - rebased to bpf-next Roman Gushchin (14): bpf: add ability to charge bpf maps memory dynamically bpf: introduce cgroup storage maps bpf: pass a pointer to a cgroup storage using pcpu variable bpf: allocate cgroup storage entries on attaching bpf programs bpf: extend bpf_prog_array to store pointers to the cgroup storage bpf/verifier: introduce BPF_PTR_TO_MAP_VALUE bpf: don't allow create maps of cgroup local storages bpf: introduce the bpf_get_local_storage() helper function bpf: sync bpf.h to tools/ bpftool: add support for CGROUP_STORAGE maps bpf/test_run: support cgroup local storage selftests/bpf: add verifier cgroup storage tests selftests/bpf: add a cgroup storage test samples/bpf: extend test_cgrp2_attach2 test to use cgroup storage drivers/media/rc/bpf-lirc.c | 10 +- include/linux/bpf-cgroup.h | 54 ++++ include/linux/bpf.h | 25 +- include/linux/bpf_types.h | 3 + include/uapi/linux/bpf.h | 27 +- kernel/bpf/Makefile | 1 + kernel/bpf/cgroup.c | 58 +++- kernel/bpf/core.c | 77 ++--- kernel/bpf/helpers.c | 20 ++ kernel/bpf/local_storage.c | 377 ++++++++++++++++++++++ kernel/bpf/map_in_map.c | 3 +- kernel/bpf/syscall.c | 61 +++- kernel/bpf/verifier.c | 38 ++- net/bpf/test_run.c | 13 +- net/core/filter.c | 23 +- samples/bpf/test_cgrp2_attach2.c | 21 +- tools/bpf/bpftool/map.c | 1 + tools/include/uapi/linux/bpf.h | 27 +- tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf/bpf_helpers.h | 2 + tools/testing/selftests/bpf/test_cgroup_storage.c | 130 ++++++++ tools/testing/selftests/bpf/test_verifier.c | 140 +++++++- 22 files changed, 1028 insertions(+), 86 deletions(-) create mode 100644 kernel/bpf/local_storage.c create mode 100644 tools/testing/selftests/bpf/test_cgroup_storage.c -- 2.14.4