Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3140819imm; Fri, 20 Jul 2018 10:50:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdn8gSClkusJaAZO1FevQaeu+DUtMl+87WqHHqXHrhXmLg1UTSFjn2EQUgqsn7Jq2qHsxi/ X-Received: by 2002:a17:902:3a3:: with SMTP id d32-v6mr3016387pld.294.1532109019772; Fri, 20 Jul 2018 10:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532109019; cv=none; d=google.com; s=arc-20160816; b=FOPpLGXAbzZyRs31LZQEWdvWaV/JnYyZgJNkVrq21Iz+wRghT2CYfYPBH7m71brB6M L39e4cpa2d7qVcSN8eb8HDERM4aClvRHp4GHLWXS+9wpr8sJSFP9tcpnZjsXYRiLwquc 0WGsGzRpWefO8OzODdqFbX3XdByY+RBIlM1oy5FAz1uV1bHK6qeEP5nrYXam2fTKzifl Y5ro0hqW7WnxEoofIAigvfYFVKsFeyzp/MeAtRPDoO+i2QWe1CdZ7o5R1+Cu/pUQ7ETn XpfBsY8FyCw2lLHMCVTdWqtRAPGKZAwHv9f4Y0RHBsxqy+vJg0ZqKnsXzcKBA7kkRHpA k9DA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-signature :arc-authentication-results; bh=4Y2yU/4yD3i5oNYcl/ut9DlMjS9+srPiVmiDH/K7ZZk=; b=Zqt7vxICw48QDzzzNM3lJvFitI3Sjau3fE8hUr/OvfiMgVGFO/WOuEEXCisT+SHnIy RRzHXWngLYHqAWwVRKtLVwGW7iRYXqQL0f3FdZ1511nXvT8iVJkXuuZJNbHTyQ/mfc/D 6jJg5ki4Wp2/P3ay0RS69OmNFq6N+0pOqTau+kt+A1XhLFm6DeCvVYZkzC8jTdtx5gva Z/F+FU6RqhtbrOWP4Pq9HSpggaimwabDiR6v2u97hTMMFBlINQCXbSmeFiHYPJe/cnAU V30Slgvo9awBE05PS2AI27RpReiATCfoboRGO1F41Nj+QAWYdpV4WxoLsu3mSLKewR85 Rmiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=LAVNgOzJ; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=IwWt80Ns; 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 x17-v6si1983902pln.465.2018.07.20.10.50.04; Fri, 20 Jul 2018 10:50:19 -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=LAVNgOzJ; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=IwWt80Ns; 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 S2388463AbeGTSiZ (ORCPT + 99 others); Fri, 20 Jul 2018 14:38:25 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:33110 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388126AbeGTSiZ (ORCPT ); Fri, 20 Jul 2018 14:38:25 -0400 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.22/8.16.0.22) with SMTP id w6KHiNbI006915; Fri, 20 Jul 2018 10:48:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=4Y2yU/4yD3i5oNYcl/ut9DlMjS9+srPiVmiDH/K7ZZk=; b=LAVNgOzJaTCxx0bbgVZ3n5zc1r/N+29mxcxQvCZ+Zjesu4UXAJ/jDIA8Jv/PFUTP9QcK MmGn2RlMolh16ShsjoObOnM5TD4ZuTWfbiA5An/I4OHCw02ECq0wevu9nVQHzvTXFiyd 54C7+Fm/Ybva2vTHLSBzP0UtrAlOF3RcXQc= Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 2kbk20rbfb-4 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 20 Jul 2018 10:48:43 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.11) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 20 Jul 2018 10:46:37 -0700 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=4Y2yU/4yD3i5oNYcl/ut9DlMjS9+srPiVmiDH/K7ZZk=; b=IwWt80NszDTkPg0doGYm4NffRXFNnD67yoNesYbhTf2R66Grw7xlq8PoUF7udLON+jsYi8mtIATEXexs5QC4IfsWVuXuavKIwOHvBX+UNhc9aqLsITLsKxYlCTO1auxOVhHJNWZZsaW9QzI0ANhxaTwrILsdl+pgpBIUhDnV1xE= Received: from castle.thefacebook.com (2620:10d:c090:200::6:ca05) by SN1PR15MB0175.namprd15.prod.outlook.com (2a01:111:e400:58cf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Fri, 20 Jul 2018 17:46:16 +0000 From: Roman Gushchin To: CC: , , Roman Gushchin , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH v3 bpf-next 03/14] bpf: pass a pointer to a cgroup storage using pcpu variable Date: Fri, 20 Jul 2018 10:45:47 -0700 Message-ID: <20180720174558.5829-4-guro@fb.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180720174558.5829-1-guro@fb.com> References: <20180720174558.5829-1-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c090:200::6:ca05] X-ClientProxiedBy: MWHPR17CA0096.namprd17.prod.outlook.com (2603:10b6:300:c2::34) To SN1PR15MB0175.namprd15.prod.outlook.com (2a01:111:e400:58cf::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 600f0b2c-af7c-4965-7905-08d5ee68b1fb X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600067)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:SN1PR15MB0175; X-Microsoft-Exchange-Diagnostics: 1;SN1PR15MB0175;3:rfK5K2RHRZYqn0+CoUD2q0y3RZr5W0KY0E8MtvauI/6iUH4NOngTz37Ua2uXGLbER3k4pdTPhTJyuw+5sOaePRKEoj2X1sea7f+h6eEVSjBjd/HlzD++JFhoXnmVh4GaDeKYjANkAf9CXQXAAAVgafMIA4ss1U0/4EIW6tRf7zONflox6I+rArsd+G7JtMeVwwM/HjUWTb2TMm70BvN+dLhi27prcVhyoKqRQplF1wADBr9WARYIZWB0LiIxoeXr;25:IVNjJTYlwlqDv1NadqFd7+pX4JXrocx2JLdK2MZhU+2LaI4uBzgJpeIzmCIEfXTeqzjLz3+eYkxPS8n9nONZXb/3fa0MKX8r1bbnqZ1Jt4Cf+U2k80c+lbCzykgGeFzRZByq11+Ey2sUWPYEUzEC8Soq/pyxgvgfv0iGJLALtWyI1TJu0odVwy+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3N4JtzKcIAeDRbQ+cMf1NPaJUb4GPXWVK/kLhv+H7x/fkF1Q4vaKOw7zpxr90T4NpHTrmZFv5NvOgKDokzyk68WF8yYSDRCjimjT+zBmJn9l3H40AozQEtlejV9FrepESO8MU1Hb0oXck/Y1lCKw85iqnEPAYrdpbuHOxCLua4eB2nDI81xgsDl5X12Aar870qqgQEaW/mmcW9yf4g04hn5AXpNIJ+ 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)(8121501046)(5005006)(93006095)(93001095)(3231311)(11241501184)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:SN1PR15MB0175;BCL:0;PCL:0;RULEID:;SRVR:SN1PR15MB0175; X-Forefront-PRVS: 073966E86B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(366004)(136003)(376002)(396003)(189003)(199004)(2906002)(6666003)(50466002)(81166006)(53416004)(8676002)(48376002)(2351001)(68736007)(81156014)(106356001)(8936002)(25786009)(105586002)(1076002)(5660300001)(6512007)(6486002)(575784001)(36756003)(478600001)(86362001)(69596002)(7736002)(6116002)(305945005)(97736004)(2361001)(16586007)(316002)(52116002)(51416003)(52396003)(446003)(50226002)(46003)(54906003)(14444005)(47776003)(2616005)(5024004)(476003)(486006)(6916009)(11346002)(386003)(76176011)(16526019)(53936002)(6506007)(186003)(4326008)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR15MB0175;H:castle.thefacebook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-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K9oruTrGkK64+oDdXrBg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2018 17:46:16.5824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 600f0b2c-af7c-4965-7905-08d5ee68b1fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR15MB0175 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-20_05:,, 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 commit introduces the bpf_cgroup_storage_set() helper, which will be used to pass a pointer to a cgroup storage to the bpf helper. Signed-off-by: Roman Gushchin Cc: Alexei Starovoitov Cc: Daniel Borkmann Acked-by: Martin KaFai Lau --- include/linux/bpf-cgroup.h | 15 +++++++++++++++ kernel/bpf/local_storage.c | 2 ++ 2 files changed, 17 insertions(+) diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index 6b0e7bd4b154..1b1b4e94d77d 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -3,6 +3,7 @@ #define _BPF_CGROUP_H #include +#include #include #include @@ -20,6 +21,8 @@ struct bpf_cgroup_storage; extern struct static_key_false cgroup_bpf_enabled_key; #define cgroup_bpf_enabled static_branch_unlikely(&cgroup_bpf_enabled_key) +DECLARE_PER_CPU(void*, bpf_cgroup_storage); + struct bpf_cgroup_storage_map; struct bpf_storage_buffer { @@ -96,6 +99,17 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk, int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor, short access, enum bpf_attach_type type); +static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage) +{ + struct bpf_storage_buffer *buf; + + if (!storage) + return; + + buf = READ_ONCE(storage->buf); + this_cpu_write(bpf_cgroup_storage, &buf->data[0]); +} + struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog); void bpf_cgroup_storage_free(struct bpf_cgroup_storage *storage); void bpf_cgroup_storage_link(struct bpf_cgroup_storage *storage, @@ -249,6 +263,7 @@ static inline int cgroup_bpf_prog_query(const union bpf_attr *attr, return -EINVAL; } +static inline void bpf_cgroup_storage_set(struct bpf_cgroup_storage *storage) {} static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog, struct bpf_map *map) { return 0; } static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c index 940889eda2c7..38810a712971 100644 --- a/kernel/bpf/local_storage.c +++ b/kernel/bpf/local_storage.c @@ -7,6 +7,8 @@ #include #include +DEFINE_PER_CPU(void*, bpf_cgroup_storage); + #ifdef CONFIG_CGROUP_BPF struct bpf_cgroup_storage_map { -- 2.14.4