Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp212786imm; Thu, 28 Jun 2018 18:23:56 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLOZWhmUcAiXUCvv3DCE6UXw05RnZwbbw0Jtth86bSi1mCJ8YEGhZF9T+uloc/JvAhFrfdV X-Received: by 2002:a63:2505:: with SMTP id l5-v6mr11060074pgl.40.1530235436647; Thu, 28 Jun 2018 18:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530235436; cv=none; d=google.com; s=arc-20160816; b=PuvRtnwcVoiZpaFzbDd4mJOQq7N1cXrkTsIeOUDj9uvtvcbYTPdL9gO5Q02DVUxrN8 dfN8snHKHjNc9zWR2rcvEsgFwq7pWsdFqYX228iWl85L5TJeLoTvDvoG4PUdcCf7xSvO 7pJK9c0TpQs4cZXczNwBU91k8I/IjyArkWnvFkvoG9qRWBx7uNcXeofKaUEDNfiNkf7N 2mSFae53wW38fVQ3JmvMBkNraPHbLoYS05k8pNLEZbKR+XVeYjDZwxYZgbrUPlfdTu+z 5COA31hNdyGmVlu/ji+yhi2QNUX6jNTN33OVoRsPCNQZ+8/ZLjLryHII2du3EtziuPKQ 3g8g== 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=nEUoZRJfdIEN94t2lsS0TnlTolZ1eb7i4yJqbLfohws=; b=XjB1sqBDd73CUGpX5i0Jb4MuzvfbCyLOcyfbxVkfzAeHPdBg96tLWyNUM7wR0X51ft k8vAy2gK4zF6GA5wsOLO1CDiG0Rg9dBw7Q1jnSFaBSSB9thww7P5ZJMkrgIPlwAzCPN6 7AfbCSWPUBHyqoa2EBKn+Y9ASVZ5HUgUQkMasDt1JYu4Bb+Ft1Tp0XE8Bt3ujpwFH4fe SzdGtzWETFG2ofLT8rbhWNw3eozW1rCj+rXHrgYlFza9C+rtG1CMcoK0081xO777AaiD 4x9M9vVxoZy4rh73wcNHyxqS1sXz2rXO5ERGqCDNZcA11URtpKsMRZBUcNkHKwx2NgKO 8QDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=KcbiM0AL; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GpUCb+qC; 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 f14-v6si7683112plr.365.2018.06.28.18.23.41; Thu, 28 Jun 2018 18:23:56 -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=KcbiM0AL; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GpUCb+qC; 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 S1030336AbeF1QvX (ORCPT + 99 others); Thu, 28 Jun 2018 12:51:23 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:56920 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935746AbeF1Qs0 (ORCPT ); Thu, 28 Jun 2018 12:48:26 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5SGka5S013501; Thu, 28 Jun 2018 09:48:06 -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=nEUoZRJfdIEN94t2lsS0TnlTolZ1eb7i4yJqbLfohws=; b=KcbiM0ALGCJClEm3hnlUe+IHRa4JWTzFoVKe9JCG53Zq4yZuJTDaPdmp4bs8Q4xhMqAL 1Sa9NE1KwDR8INDgghcoQLLLaYMc7eCe0iKPcAoyrTj/bvdTbqxbHqMmFcbSRlZz2dCT jTndv92YaGV1ega+ID+dYyYHSLxSLyGU9NE= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 2jw2u0074v-3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 28 Jun 2018 09:48:05 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.26) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 28 Jun 2018 12:48:04 -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=nEUoZRJfdIEN94t2lsS0TnlTolZ1eb7i4yJqbLfohws=; b=GpUCb+qCh9mG1zq82ODQQhSMkitMTtx+FgJ9YWjaSZF5uy9JyI6q8kLvNdwGnBhW9PMGAUQqNXKzQbNSOnbIyLT0va/GwJqhkZqiinskF4TZ/jFESyFCHvk/smBpH/xfjDyNPwFvw6exMMg3+6gHBXDDLES6hz/WyYJt47bdkCo= Received: from castle.thefacebook.com (2620:10d:c090:200::4:4716) by DM3PR15MB1081.namprd15.prod.outlook.com (2603:10b6:0:12::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.24; Thu, 28 Jun 2018 16:47:57 +0000 From: Roman Gushchin To: CC: , , , Roman Gushchin , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH bpf-next 03/14] bpf: pass a pointer to a cgroup storage using pcpu variable Date: Thu, 28 Jun 2018 09:47:08 -0700 Message-ID: <20180628164719.28215-4-guro@fb.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180628164719.28215-1-guro@fb.com> References: <20180628164719.28215-1-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c090:200::4:4716] X-ClientProxiedBy: MW2PR16CA0046.namprd16.prod.outlook.com (2603:10b6:907:1::23) To DM3PR15MB1081.namprd15.prod.outlook.com (2603:10b6:0:12::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a2d6803-1552-4ba9-1539-08d5dd16e792 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652034)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(2017052603328)(7153060)(7193020);SRVR:DM3PR15MB1081; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1081;3:IFN2VQKloua4fcHYxqeneJAVKi1wXBwE3MTwSgTTIDDgrBZ7BczQW66hsiQ+WKRZM3Zf4iBJlYCPqLkRXsrFpSuwQJFh0ROCFYCz7taydvY6pRqczbLO8YdchCRQvlOSu/YDbhwsSshf00wO3N/PSD9ORlj88W6BhyH1lcX+M+N6Jze+mTHwrg8RzfTcec8qfNMBj3iheLEpXLvsRwq66Xv/+zHVsHrMloQAV8VB8S7YL3gGRvTmAmbIOHPldCd6;25:X/eqYdDooH43299w3LIbDAQqQboduZu+u9gsSkT3qRVi8ocTAgcdc3cxwzTeDQ5N2NxIZkbN6oCgrT5mgNyeoAjlKDq3SFWPj36De0mzSLHP1vDHgNs23dktGcVRz+p3NM8dAUVMOtnaciUxqcv0C9igJQEQ12wiavQ2+XKpb3axCqsTSL9070ECa+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tJELJCUN4+45QnukMZcvN2RIwzhnomfLbSccIZbY6axbsW6ssZSzZ5i7sbRB/eoF3BE2+N/xlaIsXsokap+neg+sXse6dktCnZ6CDfJ/OmbOMfxo5fa4S6u5sJFOb+6jgZz/oc5LqySSwYyd2Wok3pfzRcNxqTXNThk+qPOiAu34x+ldjxkDpbNFYDnrlxoeiaKUjLUZlawmzo49QnmgU 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)(3002001)(10201501046)(93006095)(93001095)(3231254)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:DM3PR15MB1081;BCL:0;PCL:0;RULEID:;SRVR:DM3PR15MB1081; X-Forefront-PRVS: 0717E25089 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(136003)(396003)(346002)(39860400002)(376002)(366004)(189003)(199004)(8676002)(6512007)(4326008)(81166006)(81156014)(69596002)(97736004)(52116002)(2361001)(51416003)(8936002)(76176011)(305945005)(53416004)(186003)(16526019)(6506007)(386003)(106356001)(105586002)(2906002)(25786009)(36756003)(52396003)(7736002)(68736007)(50226002)(5660300001)(6666003)(53936002)(6916009)(48376002)(50466002)(478600001)(6486002)(1076002)(47776003)(6116002)(86362001)(575784001)(5024004)(14444005)(16586007)(54906003)(46003)(476003)(486006)(446003)(2351001)(11346002)(2616005)(316002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1081;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-ascii?Q?1;DM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fo8fBVJ7q1YW7SmzXgpAjv5jvo8UxTtcPQBQ+oOxrtfFXFjWWdVYzZmv0MMCxKYs1MgdpZijU3MO1NGKcWP8wOj2svSWzsdWcewuKEY9S+Dsdg8Uqd7lh1xpom9iq5qmetYt28Ogo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2018 16:47:57.9735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a2d6803-1552-4ba9-1539-08d5dd16e792 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1081 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-28_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 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 | 14 ++++++++++++++ kernel/bpf/local_storage.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index b4e2e42c1d2a..128fb0e39b4d 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -20,6 +20,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 +98,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 = rcu_dereference(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, @@ -223,6 +236,7 @@ struct cgroup_bpf {}; static inline void cgroup_bpf_put(struct cgroup *cgrp) {} static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } +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