Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp401982imn; Wed, 3 Aug 2022 08:41:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tNHFmOpfTS0skBJZtmp+xAnq+6VKbg30x0PGVrd8IW/azzMDNh7UVQg/a07OP4beMJa+jM X-Received: by 2002:a17:906:7308:b0:72f:3294:8002 with SMTP id di8-20020a170906730800b0072f32948002mr20085538ejc.311.1659541312567; Wed, 03 Aug 2022 08:41:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1659541312; cv=pass; d=google.com; s=arc-20160816; b=fdYT4Jfw9I0qIMZmSF2++8VESjMz4XmEJ6doHZZll9hMEJviLyvpbAl0i7Kype13j3 pqMY4v0fZFqKB5s1L03eWVIIj7iYsCGwp0KzmA/4s91NAGerww3xTiVMFUEnxoN2zedS /xdHxEXNGUMfhTF13cp2ErombO9IG0OEX+oOxmPFskjWlTA2qod8QS32GLzYrUHOhqSp unIokcI41C5YtGFgErxDB13O7OwcvAWKG98QLWAMx+U1XtZuw4hIfkqApR8yif1ws0Ky CxH85mY9nEK04xPWgVY9QmvjHFYzRT6qoLCT/KhtRtj8Uk9AKNjEBSxZpXCKY/IMBlfz r5yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tiGut+KgyhxM+gjga3MXQtsFww7wofyYzFuzJhNqPsY=; b=doY2VfR4qiO60kq36+uJ9/y0YPsJOy7Oqtjerc+4l6e8w+IEpLawvecNSjtz9DDAzh /dAkAHBpJG2OOKfRZMp17F9u0nJRIsYTQBcFIeO6OSqDq4wdaCMtpccT8tU0h9fclkba 9wBU/6TRSB8X7T2//O18bdEq5mQ1d2Vs579MZx+SYzX+gfdxW75BOsC/JNgTYVrfyjNS +UNXWb+abGGbIk/eTsHqejySfoVx7/NFCbxQuzdQcNCm9fCH0JDoxx7XP1IGOAAdm5oq t2Y5JHJHEMMZQ2P5V6tUP3q9KIl/+EYK/HpuESAS8qbHkrkt4yFGTuSLEn4hKHJeP5/M 96CQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=QPmcCxoi; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd21-20020a1709069b9500b00730728a82f4si8772285ejc.99.2022.08.03.08.41.26; Wed, 03 Aug 2022 08:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=QPmcCxoi; arc=pass (i=1 spf=pass spfdomain=fb.com dkim=pass dkdomain=fb.com dmarc=pass fromdomain=fb.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238106AbiHCPiC (ORCPT + 99 others); Wed, 3 Aug 2022 11:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238019AbiHCPh5 (ORCPT ); Wed, 3 Aug 2022 11:37:57 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86A7E167CC; Wed, 3 Aug 2022 08:37:56 -0700 (PDT) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 273EMPQ0008478; Wed, 3 Aug 2022 08:37:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=facebook; bh=tiGut+KgyhxM+gjga3MXQtsFww7wofyYzFuzJhNqPsY=; b=QPmcCxoijJ7QSSQnGCg5JInTemTLUIFoFIqtDNYOwf37OOx5+gywX4Tdjd1qbhnGfa3V ycMm7GM+44E1OT7tVgQoUofJFTtVYk6fJ5eMzBIzs2XiZjnmLKv7D56FtZdjfutcxMiK C9/mkuw8YhStYA1zgJgMbhGhTcch2If7rOo= Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3hqtqh8jpb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 03 Aug 2022 08:37:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kyBsdjvSl1g/9MAtOTYOvRVgleFQi/gFo0tlaD/AT4lfftHZ1TjPGw/7zFaZVdzFip5qOi9r3HjYPMQwRPgJ1zt2yk6/MNhV5Vnbh1Yh2p7ZDUv6k/RCZLAdxM1mhGKeDAqOYNKE+Yh3si2Hsae26Kz7tzzF2Dx5A8HpUnjXjMIjAoRoyI4AZazk4Css+SN89DSosahU22Z+x1xgURkSuY8UuJVQBeOoFYRiSSRapec0wu7TWMSA21Ja9BTMQ3s5dwkeEXwhU5MJr+KaMtiQdv7633j2YvvuQkytuUlpH7pZLlhSEPP/6PdcK2Adq9qBlh+d7OCcDD7QNH0Vjs/Faw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tiGut+KgyhxM+gjga3MXQtsFww7wofyYzFuzJhNqPsY=; b=Z7itrAxl9EGwnyv0sTIa3Yi6vb9g6RUtVcsp9huuLR8y0apkDG9laqFVswHOZQt1BS6rdHKS/jzhu1Xfg98FV9wi3K5ognf1Mo+FL/SkTuR2DkJfFI0lJge64HkRV2fDc9u983R0BCzhwNnyoc3kJhcPy68AthaYcHlx9+LkHCbSz+EjnvgtMHO39MqHQAjKhaRfENKpLimbzFjKKvDLD5JwquXoxjLC/CBRgDE4kB2rY9+vwxAYS5SVRGoavsIbSbbkXd9U1GcPn8q/TCZR9L1lzcwcBCT3jxY0f3r7HxI77Qn6OWUizeWjHX+WHnO9TjxjaVk0els/wEUQKH+iOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fb.com; dmarc=pass action=none header.from=fb.com; dkim=pass header.d=fb.com; arc=none Received: from MW4PR15MB4475.namprd15.prod.outlook.com (2603:10b6:303:104::16) by BN7PR15MB2371.namprd15.prod.outlook.com (2603:10b6:406:8a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 3 Aug 2022 15:37:09 +0000 Received: from MW4PR15MB4475.namprd15.prod.outlook.com ([fe80::5455:4e3f:a5a2:6a9e]) by MW4PR15MB4475.namprd15.prod.outlook.com ([fe80::5455:4e3f:a5a2:6a9e%4]) with mapi id 15.20.5504.014; Wed, 3 Aug 2022 15:37:09 +0000 Date: Wed, 3 Aug 2022 08:37:06 -0700 From: Martin KaFai Lau To: Jakub Kicinski Cc: Hawkins Jiawei , syzbot+5f26f85569bd179c18ce@syzkaller.appspotmail.com, 18801353760@163.com, andrii@kernel.org, ast@kernel.org, borisp@nvidia.com, bpf@vger.kernel.org, daniel@iogearbox.net, davem@davemloft.net, edumazet@google.com, jakub@cloudflare.com, john.fastabend@gmail.com, kgraul@linux.ibm.com, kpsingh@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, paskripkin@gmail.com, skhan@linuxfoundation.org, songliubraving@fb.com, syzkaller-bugs@googlegroups.com, yhs@fb.com, Wen Gu Subject: Re: [PATCH v4] net: fix refcount bug in sk_psock_get (2) Message-ID: <20220803153706.oo47lv3kvkpb7yem@kafai-mbp.dhcp.thefacebook.com> References: <00000000000026328205e08cdbeb@google.com> <20220803124121.173303-1-yin31149@gmail.com> <20220803081413.3cc27002@kernel.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220803081413.3cc27002@kernel.org> X-ClientProxiedBy: BYAPR21CA0024.namprd21.prod.outlook.com (2603:10b6:a03:114::34) To MW4PR15MB4475.namprd15.prod.outlook.com (2603:10b6:303:104::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65e84283-4946-470c-8778-08da756606ca X-MS-TrafficTypeDiagnostic: BN7PR15MB2371:EE_ X-FB-Source: Internal X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +1pcsok/+/TPRcnY879ZfGrl/S8C0nTvvUNFsHJIeuiiM6ukfE+zaoHiJ+zhhhbs38dMj/WpcC+wA6+C+NK70RgESrhSDC9JKIJD0vtO9e5mb4uUmkE4stCca/4EhFw8+MSne/EWzb9ghDYpEvT55mmk0EdWgfYxrQ3hssTJW4KjBGzH04zfLjZpytmkAtN33axv4pFkJ8I2lJ/YP3VJkQuz9wAdIzxbEdNLaFnFkQHHBNUUyxeGpWCsIHbhJrYPQB7BUIaT9mKnUd822Xwk45yxLIaK1wHT/FnjHOleCSvX+ewxxNOMtw4wwl1Kd+ARpEHnmYFgu1jzwX8n0RClRLY14FMC9uFHRv4SDG4mKNBUu0KRWY7hJBdo7FOzPds9mg+qRXdHj9CqJ1lpMzl0H6tQdHB/KJZPFvMARaVhrO3Hzxmn5QE/4FjOdxTxbh9/+YUXvmWdFiNedGH+OsHa2YFbvQYXSxwuxQsrPlkqOkDlTFfYB7BiIX8upv/PnslX0TBpuDidGEMTvarHUGmZDUaCsXM90nLbwQiz2m6r3r84N6NJuOZQRwjN8/I1zz3ohZYPju4ze0k2yQ2NCOKJv3XOODwN+BnhyV3mEBWHrdBXfkUxyhuEZz8vjNzfQ7RTB3nKrqxz5puxrg/nkwC/769oswagyR5eLGuuwEJoxs3j/h7rkxs0QOiOPLRJGqb64SmV7uqYXXS397+OOB10KrMqsZyfGgVII7dker7uD5cBbI4fZ/6hnbXQw0kytNvC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR15MB4475.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(346002)(39860400002)(376002)(396003)(366004)(6512007)(9686003)(7416002)(38100700002)(2906002)(4744005)(41300700001)(66476007)(6666004)(4326008)(8676002)(66556008)(66946007)(52116002)(6506007)(1076003)(8936002)(6916009)(6486002)(54906003)(316002)(86362001)(186003)(478600001)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kBjGcaZ0E33jyr8zGCmPwwM8jODcpJz5fRgte2D66EW/QtbTEzJWbxwqk2G7?= =?us-ascii?Q?sITuJ1xlhvMkoza5AYy35bCf6AmacD9k/VvoVAo13FY+CfaNWndXrsIZ/YL3?= =?us-ascii?Q?PlwvHoUAAvyGGAb2g8+ZzuqO+IK8u4hG4qAGnxogO3//hfD2AsGGYonhnPhd?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+Z8AXPn7Ar7ZgmywD3flRYh4Abh52B?= =?us-ascii?Q?YNukprvjVd/0qN8iBtO1oTvw+bKaha5VNbEU30QQgSriPWWB7JtpLtMJ5GA6?= =?us-ascii?Q?uinh9Uu309rWG0BAdTKCM52nP/73zrdriNU0q+KIWjk2yDNgmaB071qQwzy1?= =?us-ascii?Q?ZDxB8pbEBzwlZ/sNinzyrA2MKt82fkHjZwgZiCrnbXc44xqgi08ao+v7w/pt?= =?us-ascii?Q?GcMstD5bBpqzeJ+QQQX71JXU6nIuXP3EClOvOVuz6qb0iKnTBNMQ6M+M4Blx?= =?us-ascii?Q?IH38bC8vpKwRSwbsZh6fSnBK4caz6iDcFE0/IzMHkmhpOuCKd2kGxXS57UX2?= =?us-ascii?Q?9HU8dZ6K63K4oWzU77HNkOLw+MNTe29XYXbbPRSNt8kDKs2A1teVFJtmwcN4?= =?us-ascii?Q?ikwJsnWsR8fs9t7xkqIXZzt964f028o6eJTBsQf/cpJR/wx1+rOXA/oBgi7y?= =?us-ascii?Q?fQxaZLTRh9tHtOOuHUGMPzKkaRVb7iC/MtchBN/cpO1vFiuEA1VPhrXy849w?= =?us-ascii?Q?ZsVzC1MG2Q060cWsOjcHUj+Zp1MljSTqjRjT3Bmeyc1r1bRQfEMxymoFRKo1?= =?us-ascii?Q?4g=3D=3D?= X-OriginatorOrg: fb.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65e84283-4946-470c-8778-08da756606ca X-MS-Exchange-CrossTenant-AuthSource: MW4PR15MB4475.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2022 15:37:09.0833 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ljPGSyUImIy4hvLvCEXHeHPVWFCx4DNC+s8daagzyMtSiOabs5biN3oehinBB2qI X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR15MB2371 X-Proofpoint-GUID: Fn0e08rBnK0NF4kbhI77mmT8SdlxyMyp X-Proofpoint-ORIG-GUID: Fn0e08rBnK0NF4kbhI77mmT8SdlxyMyp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-03_03,2022-08-02_01,2022-06-22_01 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 03, 2022 at 08:14:13AM -0700, Jakub Kicinski wrote: > On Wed, 3 Aug 2022 20:41:22 +0800 Hawkins Jiawei wrote: > > -/* Pointer stored in sk_user_data might not be suitable for copying > > - * when cloning the socket. For instance, it can point to a reference > > - * counted object. sk_user_data bottom bit is set if pointer must not > > - * be copied. > > +/* flag bits in sk_user_data > > + * > > + * SK_USER_DATA_NOCOPY - Pointer stored in sk_user_data might > > + * not be suitable for copying when cloning the socket. > > + * For instance, it can point to a reference counted object. > > + * sk_user_data bottom bit is set if pointer must not be copied. > > + * > > + * SK_USER_DATA_BPF - Managed by BPF > > I'd use this opportunity to add more info here, BPF is too general. > Maybe "Pointer is used by a BPF reuseport array"? Martin, WDYT? SGTM. Thanks.