Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2864001imm; Mon, 16 Jul 2018 15:58:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfG+U9kXFHt3jwCdN4cFeroWpFqNvn9JDJFh/nGu2U6sT5CyrkOE7HeOnpRHix6Fj7lCZ5L X-Received: by 2002:a17:902:7798:: with SMTP id o24-v6mr18741940pll.165.1531781937007; Mon, 16 Jul 2018 15:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531781936; cv=none; d=google.com; s=arc-20160816; b=c822u8x11aE3TsjaAlMUfjWyqVWXN/jabHLq7VPqM5W1bI698Se2nMzPzNqDL03KZM Zv6lzQNjEFDux1q9kLafJ+s0wjZw8ICEdkuuBJukp0JQYq/VCC0CbXG5YAlUWjVMGnes 9GcM87EoYuTBw2fBJnpv+2UxwD7sdt4m9WGaFAoU0xr39/U7IMJQX89VR/No5d7PCSut SC8Tntow7CW9fYfwWQAmPRKBLjDxSFUi0XpZVaiAiYEpJJjz1pjeP7UrQ9pBl1mbNRM9 mONcpzWxVckuzCby9bYt54oUk2ptJc03YEVm0ORks57eeg+4c9DxvHhlYqE0O/Gt8SNL PAYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=jLLQVtSUFpEuzu2eJixM5N0ZqJGCkynMnELlj564u88=; b=NtdilDUswdt5BUYEYaQySe4AdioL4LW7hOj5dOxAai5/dvB8bb5aWx7zlDzZ0Bg6+z a5yFZtgDUKewyazrrRyVqMwRPG9i26QQk5L0zcO0PsIS3S5EJH6AnRmzKOkvqGORx/+d OfhNYLDbxFis5o+Z53a8W2/rw4rZW5VbnDogvBO9eikxbEH0eFbE/NLZbDSZ6G0R4MwR S15BzHEux7y9n1jgirMDdSyaNnyRb/bXRL8vyJMpX7/Z99pq95xtCoti+CQ7yu8shFZh 5Y7k5UxsZak6/WXs7SkZOeJreM5wLOUkFjT5Nj7E13wgJiwaPrWJdld0IHwELWpaOyir Y/gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=dFwobmKw; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GxQ7BMHy; 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 b4-v6si21265912pgg.537.2018.07.16.15.58.41; Mon, 16 Jul 2018 15:58: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=dFwobmKw; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=GxQ7BMHy; 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 S1729854AbeGPX1W (ORCPT + 99 others); Mon, 16 Jul 2018 19:27:22 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:57972 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728947AbeGPX1W (ORCPT ); Mon, 16 Jul 2018 19:27:22 -0400 Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6GMmSsQ002995; Mon, 16 Jul 2018 15:57:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=jLLQVtSUFpEuzu2eJixM5N0ZqJGCkynMnELlj564u88=; b=dFwobmKw+z2rdmGnVCbtu9pY5lbhuI/Yf9OgogBQW7l9nGZExX5F0lHu5Ruf26PaRO6w SwDaFhKLPEZO6EMVuy4Fw90zG7XQPWU1/fKm7yxMP/C7RXaWHUbiiI//N6sevka/ykd0 8jDZ2+X1zh0RQKGv6ryDI5XCQaaQGBiu6JE= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2k93ha85kd-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 16 Jul 2018 15:57:25 -0700 Received: from NAM04-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.23) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 16 Jul 2018 18:57:24 -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=jLLQVtSUFpEuzu2eJixM5N0ZqJGCkynMnELlj564u88=; b=GxQ7BMHyIdUm0QUva752/YJ3d3FZjM6cpa5qsTNoVVE7Oxu2WYpam4CKAC9TkiYzFHGZ5tOr62Bj0EBIItVZygMo/PIjcsgjf7fcVwJgQ0/Vlp4DB8r4HYTqxKjvsIrsX1Ljnox/glYGajCHZSZArEi1dagSOIxMsGKwD/og56A= Received: from castle.DHCP.thefacebook.com (2620:10d:c090:200::7:d20) 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.952.18; Mon, 16 Jul 2018 22:57:20 +0000 Date: Mon, 16 Jul 2018 15:57:16 -0700 From: Roman Gushchin To: Daniel Borkmann CC: , , , Alexei Starovoitov Subject: Re: [PATCH v2 bpf 3/5] bpf: bpf_prog_array_free() should take a generic non-rcu pointer Message-ID: <20180716225715.GB3898@castle.DHCP.thefacebook.com> References: <20180713194114.2711-1-guro@fb.com> <20180713194114.2711-3-guro@fb.com> <41b5f919-3155-5bd4-2774-84efd58650e2@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <41b5f919-3155-5bd4-2774-84efd58650e2@iogearbox.net> User-Agent: Mutt/1.9.2 (2017-12-15) X-Originating-IP: [2620:10d:c090:200::7:d20] X-ClientProxiedBy: MWHPR1201CA0006.namprd12.prod.outlook.com (2603:10b6:301:4a::16) To CY1PR15MB0171.namprd15.prod.outlook.com (2a01:111:e400:58bb::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66adda5d-e105-488e-1ab8-08d5eb6f7ce0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:CY1PR15MB0171; X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;3:LqevXkMrFYUw0Ij0WkcB2NxFp4h4Zx75eEGADJNUqZJxmAlcK6tvnQYwwLXTo6vpkt4HaSf2MDWUkKf4jskEGDzCb7MNvjgw0DfoQHO9n7skdgmSqE/wViA+FDarT38e5YlpK+vZR3IERVMzd86HczaePwhowNkGKS6w1COiPSDpWYPJ1l5cJ89ZcWDyoJkAKkoy0jYhg/z7GATiE712iaGuxjxCIZtDJc4HIved/Ycz2CB+5K8gfAgyjJznpR79;25:+aOv9UmXRHPm1z+NcONZqBa3wo3g10tnibezZSLKVOZAgEqZrnC+phxagFWWOmN/+vQOO+5oQ+3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/vxEKu2dUP74s7R13bs;4:G/NSaBb/3nw3kQBcT22y3c1ZjIvT2/SZAyR6XrBSFhMXGHC8LCv5dYMZw4ynjqNaP5DWTxgaX1jPTtiWlnaQmeDufDTuMGf2HUGD2NItkApmHaNCaKDRivjzQj0NWT8Cnzbsj6uyFZcWo5kp7rH9ei9KCN5XIddN744NeJh42hA84x/5s7uOR8L4oZoXi9AS/N988OfAt2zCg2qMmfgrU0DLU9LEO81yew2xMicB9nqn6uYhu4pE1bsif3mWXgvjrZHdJUDPL9xJOU+7VHGhUuidowzClv4jEF9LWmFyYm6ZnBt0GKg9cUkH29yd6qg79/Aa8AxLo0sU9jx047z5YEAPv+oQwJfwnmCw/LItkOY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(17755550239193); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231311)(11241501184)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:CY1PR15MB0171;BCL:0;PCL:0;RULEID:;SRVR:CY1PR15MB0171; X-Forefront-PRVS: 073515755F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(376002)(39860400002)(396003)(366004)(136003)(189003)(199004)(6916009)(50466002)(53546011)(6506007)(386003)(8676002)(6666003)(46003)(86362001)(575784001)(16526019)(23726003)(1076002)(6116002)(229853002)(186003)(81156014)(5660300001)(47776003)(8936002)(305945005)(7736002)(105586002)(33656002)(52116002)(7696005)(478600001)(52396003)(81166006)(76176011)(106356001)(68736007)(58126008)(316002)(16586007)(25786009)(476003)(4326008)(486006)(11346002)(446003)(2906002)(9686003)(55016002)(5024004)(6246003)(14444005)(97736004)(53936002)(18370500001)(41533002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR15MB0171;H:castle.DHCP.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;CY1PR15MB0171;23:A1/ZtMFYvu3jur+8k/0jIVHiDr67oom7s0elru31f?= =?us-ascii?Q?l2faB6wiIpFPXq1Js+xvcaSYxniDSo97/DNnxJHFqq3sG2KvarZeZGbtmmxj?= =?us-ascii?Q?m27aL/nCuCqA3jWryu+oGv19c4tpQmnlQtllj68rKNvoUckRe/Mgs5EiIXgA?= =?us-ascii?Q?cZKx/PobwtMAot7m/l+N3IfNBHDvTjtNqdpHFyRzbSceeXGfjsGKic7XOd1B?= =?us-ascii?Q?v6nXbU50z6ewSX7X04Nzt+aOz3S1T2YPa+1NhNwQQxU8HavT5F4WZkz96luY?= =?us-ascii?Q?lUOvOabTN1jWdcLnezimyItmz5Kn+ZVvJgTtUrzpI90SzPBeEbbk6tz7qIXM?= =?us-ascii?Q?QO1VLRKxu3eePt2LQS8GejPqkC8zHaIgNTuAp7hnc1sCiiPzCuy91uztNMdP?= =?us-ascii?Q?mqkvYGq1k+hlcvXy7+AQDC8pUTsbN5GTLQZfJbEuG66qCHcKyl7RlHCNhHew?= =?us-ascii?Q?jGGv8ACMkWjGmw65cnQfpmYhUJhEBc2WOwMU0d3o7E2dHc2Jv+6upXCWsy8Q?= =?us-ascii?Q?f/9ZIt+hlCbRRVM640LDWrXz2CQBlv/8IGIOMqeoKosVOg83JmN2dEqccPQP?= =?us-ascii?Q?60ix4gHEyd4K/2J7xd9A0tNT/polEMoMKM/ZgmGFqZ6WcGn2cqexe1zgvHbd?= =?us-ascii?Q?icX2V9RE5k1N7AzEhSkisHtdmaMLzWsUgWj/5Vy+RiQuEkNtVb1PK05RDoi1?= =?us-ascii?Q?s67HCZwGT00onuQ3j2g49gfGVDQS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6r3xA4bmAHe7o6Kg+EHfRu3a6VQNL7z6CfvVwVPH+lXwHGJuKMXB0= X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;6:6Y18bZ1RGN/4Xm2dWMD6dwDN/ePyY4OQEijr6JgMvlbwbbHYpbyw+5tZaxOzq3BpxTBK4JU55KHHwYy11xF4ps93RYWwerpubnzhmv/vT49DP93lqTiHS922u7CpHp/3Qmg+phFTH+ttm5b/RxtRkh7PoYzxBOszcT0PCEjWJ2+L8jhh7IsNyCPYHwfR/+qNtxmvMVE87NMfsxlTe2ZEwB2PaWTl45+BpFOsgHqKF73PD+iWmRtN9+ccYrY0lplo4WN5ORpejm2kU4P0Wg4dxGJPUVqbW9rF2+y+vp9tCKw0jANR81IZZG1sukU57zb1H0rLups1TyjQbjmr5D8SdjIHlMfXqwzyaNgxevHCe9khkoLWNl31h5A39+gR2AzNpLv6gVQMxbHHylun3QIdsf9pP668/vKGTeja0NIudNoveBUF0wQ8Kn81LNySn4Ps7Ctq+XT4c/QLiamTJQakTQ==;5:eYqqhGtZ6eTyC4+AhTQNHXem2TKstVQh+B267dDy+yARpeAov+lShau9rMr8st0xrF22SDzRUMvpGyemkbiTv3NiE1xnb8OGES3uIz8kfcDBJvbuDzrLajfyArGlFGmOxRldkDo9Z4QJE8gT3yGshDUkJLmZB/3kQZ2qzy+XKUs=;24:GG4iR4GRE3kvcA6fwFPY0Ewn5kGv1fXOnSBHApE8BJ8MzveukANuC0xS3+slwRTd9n+5j4qhqhByzzYOO1XsZH6ZVngFWHFO1gprmZjbFlY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR15MB0171;7:b/BejiYlIYOVB+6MvqPV3oqAMQ+Qjku7APAFIcJYeEpu9+23c0la7GEk+dixjhT07h61G5hMzFb+4tXMPDvDeT/blFKSa1jovaDgzd55RpfV+aUx9v8WLVCyvQS88ywY26ubd5Xmi+C9/lYJGYd+U/ftgbtElsfC1hz3B+2HUFK6CFPaFYyIRmFL7w0+nMzWCjIt+KCPlVUZTYZxjrdkvPbrptqr99RbJPDwKjDia+fIy0Pj/194B4LkHsXSB346;20:2LqMOBdAU1ayXFFt4929q681fwkQlcvMBQLTnvnuIdEFM0bbEyUrU6UnNaAawxiT9VuRoOA1UBRcSO8jUBETech0yyPLUAC98OjFJxokHTiLwv1Za7ac39+jBXJvWu/YbEB/agyw69oSMMdDKWNplaxUWKfDjOJOePzXoefanMc= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2018 22:57:20.7358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66adda5d-e105-488e-1ab8-08d5eb6f7ce0 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-07-16_07:,, 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 On Tue, Jul 17, 2018 at 12:30:18AM +0200, Daniel Borkmann wrote: > On 07/13/2018 09:41 PM, Roman Gushchin wrote: > > bpf_prog_array_free() should take a generic non-rcu pointer > > as an argument, as freeing the objects assumes that we're > > holding an exclusive rights on it. > > > > rcu_access_pointer() can be used to convert a __rcu pointer to > > a generic pointer before passing it to bpf_prog_array_free(), > > if necessary. > > > > This patch eliminates the following sparse warning: > > kernel/bpf/core.c:1556:9: warning: incorrect type in argument 1 (different address spaces) > > kernel/bpf/core.c:1556:9: expected struct callback_head *head > > kernel/bpf/core.c:1556:9: got struct callback_head [noderef] * > > > > Fixes: 324bda9e6c5a ("bpf: multi program support for cgroup+bpf") > > Signed-off-by: Roman Gushchin > > Cc: Alexei Starovoitov > > Cc: Daniel Borkmann > > --- > > drivers/media/rc/bpf-lirc.c | 6 +++--- > > include/linux/bpf.h | 2 +- > > kernel/bpf/cgroup.c | 11 ++++++----- > > kernel/bpf/core.c | 5 ++--- > > kernel/trace/bpf_trace.c | 8 ++++---- > > 5 files changed, 16 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/media/rc/bpf-lirc.c b/drivers/media/rc/bpf-lirc.c > > index fcfab6635f9c..509b262aa0dc 100644 > > --- a/drivers/media/rc/bpf-lirc.c > > +++ b/drivers/media/rc/bpf-lirc.c > > @@ -135,7 +135,7 @@ static int lirc_bpf_attach(struct rc_dev *rcdev, struct bpf_prog *prog) > > goto unlock; > > > > rcu_assign_pointer(raw->progs, new_array); > > - bpf_prog_array_free(old_array); > > + bpf_prog_array_free(rcu_access_pointer(old_array)); > > Taking this one as an example, why can't we already do the rcu_dereference() on the > 'old_array = raw->progs' where we fetch the old_array initially? Then we also wouldn't > need the rcu_access_pointer() on bpf_prog_array_free() and yet another rcu_dereference() > inside the bpf_prog_array_copy() from your later patch? We can, but then we have to change bpf_prog_array_copy() args annotation, and also all places, where it's called. IMO, basically all local variables and function args marked as __rcu should be not marked as RCU, but fixing them all is beyond this patchset. > > Regarding former, rcu_access_pointer() should also only be used for testing the pointer > value, but deeper in bpf_prog_array_free() we also deref it, etc. Hm, but at this moment it's a not "real" rcu pointer. We're sure that we're owning this pointer. Btw, we probably have to use rcu_swap_protected() in this place. Thanks!