Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp615434imm; Fri, 28 Sep 2018 04:08:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV62AYHe3wXg+UTi72q97GA4pvZpTlNapw78cUPEAeb95QZquGDLAlQTHTjUWx8qXCndXga2H X-Received: by 2002:a63:f:: with SMTP id 15-v6mr1519872pga.15.1538132901751; Fri, 28 Sep 2018 04:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538132901; cv=none; d=google.com; s=arc-20160816; b=HfJI7S5HClOCPSfvC3CfJ3bqn4yGKK03MECjvQtfCVn0ms6jRD1d1Z0q01kOlO3uCw hxm4tSWGGFGwIzIRNNK9Sg7oCMMHihG8t1vqhG921ihsMDUOwKHh3w7bd/J5g4+ASquC jXRsfRmpijE7zhp5r4/e2SHCeqCChouwsaGSjVrV5l7UOOugEEu7ofgIKJGYhUHIS1Kv JsDGL/EEtSO05Xx6X8RvNzs78UpEwBDQd6CqNiudCRD1eHCe1RF5AVnLFLHPB/cikJe+ iqPZl76AyCHS4VCfpj8PoBnTlKSevbsdpoJTS5k+oXIsPG2spdAIJktqMrc32MeiY7lF SoRA== 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; bh=ewgA+Z7l7fcy/smLrbGkIqIhRWrVTM/0u82v4WecQWM=; b=zfMK9Z7H9xpv5aREit+uJyrbBoh+w05oYOjk42T+aM4wfGtYZD3fjHjpDfD3lv5+Iv NjTxdTve5xuFBDngmHGim53jzdLcGlaIpMuUr0mKmVVPBCR0NBqxEg5W5+Xb6DKl4ZeH PzE+sh4s43PcfP9/05e/CJ5qkKxdLXNiVHGI4Va2WK+NTcaGz7h5TGZOPT4cC/6t2Ufq b7pgmpuvLF5T+7i/4g+WdvfK04zgo2HaXHtmsWeGT8i0tmsznRy199f0LL0e3adIkPOi W+7QEcPtPG0wtEg7XiYnwvqlSHhf00v1H8eL1bDN1ErQDGvlMRASEH/TE+T7sLhGhWkB W0JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=qOXrTLAH; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=HfZW9xww; 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 o186-v6si4449145pfo.236.2018.09.28.04.08.05; Fri, 28 Sep 2018 04:08:21 -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=qOXrTLAH; dkim=pass header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=HfZW9xww; 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 S1729451AbeI1Ra4 (ORCPT + 99 others); Fri, 28 Sep 2018 13:30:56 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:50830 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729093AbeI1Ra4 (ORCPT ); Fri, 28 Sep 2018 13:30:56 -0400 Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8SB4eAt016207; Fri, 28 Sep 2018 04:07: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=ewgA+Z7l7fcy/smLrbGkIqIhRWrVTM/0u82v4WecQWM=; b=qOXrTLAHWBM5x84+XgFulH1UpsOVy5hv74vhPbJvjsgBMZrQHEuDrh/MMWnE172o+KhR e0idUNcdGvnmVjJZGhQk47QVBnUKDvyxs20Vy+l7oMxIfp3I4qLd4xQlZ69ZWLyqnCic zoW5QO2Dnsq/5NK8dqr/kYfNp5jW+IlScYI= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2msja2g5dk-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 28 Sep 2018 04:07:20 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.24) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 28 Sep 2018 07:07:18 -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=ewgA+Z7l7fcy/smLrbGkIqIhRWrVTM/0u82v4WecQWM=; b=HfZW9xwwOUiNQPvAsRjFdLNq60Qq5WFAAffXc+vk6jH9nu6C0qOHJb61cUwSGqITBYfw/xoDV/nP7Lgc3wXR5jyepowhQyoXGGUvrfziIG1CWi0ctT+smcXCBCHv8LPY6G4CmO/HQRnC4MTOtzOiYJUEg8r/D58qTgx37Hz7Tlo= Received: from castle.tfbnw.net (2620:10d:c092:180::1:7e75) by CY1PR15MB0171.namprd15.prod.outlook.com (2a01:111:e400:58bb::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Fri, 28 Sep 2018 11:07:12 +0000 From: Roman Gushchin To: CC: , , Roman Gushchin , Daniel Borkmann , Alexei Starovoitov Subject: [PATCH bpf-next] bpf: fix flags check in bpf_percpu_cgroup_storage_update() Date: Fri, 28 Sep 2018 12:06:48 +0100 Message-ID: <20180928110648.22973-1-guro@fb.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c092:180::1:7e75] X-ClientProxiedBy: AM5PR0701CA0054.eurprd07.prod.outlook.com (2603:10a6:203:2::16) To CY1PR15MB0171.namprd15.prod.outlook.com (2a01:111:e400:58bb::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51e304c1-3336-4a72-ee7e-08d625328be0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:CY1PR15MB0171; X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;3:2zFpS8t0/zruAl3aVrA//BzueyyUqF/GBOYXtxw7jooMJ6GYFJOaO+uOUC1EVXsOkOZsJV9hlhBNdUuRi9pzrin//xlt94EEfYmp3U1x3epXAMW5XO7TtwajQmEWcEzmP5/IXKdgWdm3nmV2FhhcPhHmlIKmlb2p81TDRL+taKqTDBHvZus4PNTraxJjyS8xFpUEf40bnwPABgRfrepxIpScImzIFSw9FrwvwwY/hM3rLbgEYKYIoG3W1OudFJu/;25:BKPODQBzNNcyVMPzz5SJO0JKoYPlMJJ0d0SfN5Db5oYFdPqbPI5923X5OBplcxrGPQLCqKMw5uxROwpFP/JNXAOePa9Z0cvC0cJc5QIFgKbl3rrFUJcIRUvGaut/qOD+aAS1zHi3jISD4+4WTnd3fZmC5oDNcyHY/Fk02lUaCgXIt04AwIRPSeXsluL9+zwF4vxAeiz9PsLqkrlnSxK5TYSUU1Cs4EzFT/sTG+i6PcLHuZbGJlfq7+56eCgidqi88elPsmbfnV6utZshbDNvfWAtXOXhauS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H4wajq5KYK4HrWRx5Ev4Vul6c1/AkDt/oIb5efbNv8GjHqQTCCkMO4EZHuBeeWb0ONtsOH5IYRW4Yo/cpdS66Gt5hanaVAXgErIQKWO0RyRVP2AOGEeYSkzMLB1BXpVbgCCGwUqHZk 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)(823301075)(93006095)(93001095)(3231355)(11241501184)(944501410)(52105095)(3002001)(10201501046)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(201708071742011)(7699051);SRVR:CY1PR15MB0171;BCL:0;PCL:0;RULEID:;SRVR:CY1PR15MB0171; X-Forefront-PRVS: 0809C12563 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(366004)(396003)(136003)(376002)(346002)(189003)(199004)(486006)(52116002)(4326008)(16586007)(476003)(2616005)(25786009)(86362001)(69596002)(54906003)(6506007)(386003)(46003)(2906002)(50466002)(7736002)(186003)(53416004)(52396003)(36756003)(478600001)(97736004)(305945005)(16526019)(14444005)(6512007)(6486002)(5024004)(51416003)(6666003)(1076002)(48376002)(316002)(34290500001)(47776003)(6916009)(106356001)(53936002)(6116002)(105586002)(68736007)(2351001)(81166006)(8936002)(2361001)(81156014)(50226002)(5660300001)(8676002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR15MB0171;H:castle.tfbnw.net;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;CY1PR15MB0171;23:aBDcZhaeb6XM3De+4/Pg7ek0OqQkv2eIitiJND3gZ?= =?us-ascii?Q?TvQz1mHpItO3MK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HNaIKyJZZvoBEwH53XmLwir+8vs8DR+bAWhzlFL+jGAqPFbT/z+blBQ75Hi+?= =?us-ascii?Q?f8KS/e0lGZTMwTUE7TFg3sWLlFJwLMMXHpYn2qfivAigLpnIBs20nrdAPIin?= =?us-ascii?Q?pln/5ycSOEq+ct6PBRsLfuuBl9xKG/qLwWbp2Cw3hmFySguPZFDHLidStq+t?= =?us-ascii?Q?/p7gra435PVcf9EkjZ/vXc4XnBh5UZGJicTFtAEdbwMrqJlb3t5GK/f9SIMy?= =?us-ascii?Q?PgbYOivmyHPdWw15/Xh55Rpx8kgVh4t11hHRSce7+flx6RrLPZooBGGsbAQu?= =?us-ascii?Q?aQlL0g4Z757o8ru12jXTao2lQ61Il75toUJbd11q4WqmJg//opVHWwZKgVdn?= =?us-ascii?B?Zz09?= X-Microsoft-Antispam-Message-Info: 4Cdz7L152hrpQ3zlBH9HKR2J1DW4jDpLiT0fYgZRrTxFtPXhNlj3xg8JinsWyO+FN0lxus9lR+SNrI+oczEAH6BrJxZSPUAsVrCYiyGNdPQ24DcCCaKj0FK9+PvKpiPoDiMlt316Dqhd3hanTT4woT077ck4bPPxselwhxUl1crnrnFVF/c7Pv2gQz6Nb3gaB3cpSRQL0cuF2WgLZjHYZMo1s7RW5jJGDeAhT6VCyNF2PgWRWuD1ym6/4nWFhuSYHCmi2exB3eJN9goXnZnpiMJwNXqYXOM+10k+1zpfp5zr1E9Qi4Z8C442fyTMoxUZ2joT/UBkEAFYy86Xsjcak4xAPfpPsCFhpPzNOgvrKEg= X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;6:tUOk7j66zpG8Xug3zwS1IY9PHWZtApZLpWmlB/MBHPUXIPtai3LcpDksnBOtRSx9uf6hLhanEK4RrkpEGKSuDgDak7Fw0eUYU9BnvCrv8niRPZzfdbfNrhFs60ElkQgv0LYaZIFbjljJ4eNUn4qIky1ZqbDfmjBa/Z7MK6N2qflwZfknLgjgDYStl8kK3s9RQqedO91h6vp4h7hArQz10jCGSy79xEc7pCC0xE72OIPstuK6RyrWR22yVQfSUjE53QygScTSNe42y5Qa4V+zNhEIjD8jpngQriARVe7RayGxejQfhLxyE5ATOpnCXwv5UizlivVXbwt3AIoFQQArLCkxHHv10SPv6+ikhKchHzVNhfP6bqgEjQSIWl6K5fnj/PQbYIW+aZU3p7EbeeIOujE4sm9QGSGfefVFL4Gss/FlAA2hdYtle6eUWW0Gkjk7YtuuGk6CRIw40Row/Wxk8A==;5:NVId/LDIStLmy4C3YW8zC+Mbyu2iBuUbJdw8MbS+MQFk5ejZCd8GBEk4Bl8CgrGyAF0MAqHW7eBukrwtUTOV1LAC3rwa/hwGmDSEmfnWpiG3FyQ2DTdiEAT2owpRRY/0VdeKVMb6G5Wk1dTAi0xBOFWUvt/4QEOJSLv7vt78wIM=;7:9k8DHntxiwbFemd6wT21CF6rcW+M3do7ZPvv7us0HerddM+k/DL6geqfobBqeULpQ0KPf2udwwhYpHsKR2zI0fSm+HOyAjrXfC4eWzyJrc8TArlDhLWzrLeyg5Yn/fUnBAnY2nQ1DyfMiiUNLHFKPXYAAUolxsmlzuANNAN/RLL9mRWlPo6jhy8TACYpuHFLKAprR29iN9YYxW3+1YHWmCEP11Cq5PNa4kf82Q3lriUks86gVfqdNIa4NGuytGah SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;20:v+ferlZmIKjcpHWH5fk3X6dcLhFBVhJ2f/xFSFtrzBZLWggU+Zi+Q3CrRD2WeZKlyux70UUYYrs6gxRIBYJCikkrzqnwTRSC6qYzkTUJfKJpxRIkgp379pyMLsbvThD0QeLriNVDk8MI8U3Gr7Rzr1RK6Sdp+m/8v5RL3l0+4qw= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2018 11:07:12.2682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51e304c1-3336-4a72-ee7e-08d625328be0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR15MB0171 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-28_04:,, 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 Fix an issue in bpf_percpu_cgroup_storage_update(): it should return -EINVAL on an attempt to pass BPF_NOEXIST rather than BPF_EXIST. Cgroup local storage is automatically created on attaching of a bpf program to a cgroup, and it can't be done from the userspace. Fixes: 0daef9b42374 ("bpf: introduce per-cpu cgroup local storage") Signed-off-by: Roman Gushchin Cc: Daniel Borkmann Cc: Alexei Starovoitov --- kernel/bpf/local_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c index c739f6dcc3c2..190535f6d5e2 100644 --- a/kernel/bpf/local_storage.c +++ b/kernel/bpf/local_storage.c @@ -191,7 +191,7 @@ int bpf_percpu_cgroup_storage_update(struct bpf_map *_map, void *_key, int cpu, off = 0; u32 size; - if (unlikely(map_flags & BPF_EXIST)) + if (map_flags & BPF_NOEXIST) return -EINVAL; rcu_read_lock(); -- 2.17.1