Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp490671rwd; Wed, 24 May 2023 22:48:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Mmiv22yXFSC+q1fNIU/CAAYjCNHkyjIKAptA89cKf09hNRhaziNnL07Su+NqpZ9dRgVo4 X-Received: by 2002:a17:90a:bc2:b0:253:94c7:4603 with SMTP id x2-20020a17090a0bc200b0025394c74603mr367020pjd.49.1684993693983; Wed, 24 May 2023 22:48:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684993693; cv=pass; d=google.com; s=arc-20160816; b=HZJO1NEb9hvcNyblfi6CFWcV1OmQUGnyoJhVjn2vCfNN9JG621B7Efbvgha32fivwc r9a3hOh8dhxG7iWbfk8c7i3p8sVM4dLc1yqqiyhaLsEM2H//z11X55ORHAoWeA2Z6ntW aa2DrAb/t4dac+jJqQ6lymIoR/jNG+stiLN5tgw4qSs7pGLQdA99OFOE141ktat6d3Ps 8DLXEPGukvAz7InZ077rPTATJU2n2onQfLModRnCJZt4RKhnQZorMiTkrwwd+BhMrsCS S1jU/g2DavroozgIHGL0huO97sV1ZK6cp+RlN3W1wjAcIf2HizFmHlQcqi3QSupRyz7P ZcdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=SLhUrRatyzmJDBMG4fyWFhqyWzIqbULwv2mAXqpfuzw=; b=MI5VinW8Nbmrht1ez6DpjRlbi/NeoTQvxu3Km4ej6MZA9xB2J89g520CiB3f99fzs6 miH+V0aFF1Kgzx490VqOQDA9Ij9xgn93BntFiPwo/b9fuUIYGv+37BrwjO/GeRJ02aDW q6oF8Vpe1ckYv+EA5oCXUJkL4A5HAxInmaSO8lLRpIVH/GOh9mGW+NYa51QZkrill1W6 0GdtMSfDCHmXk+71FJIs/2eNoOZp/hvIbnaav0fvOkq7pjRZVc836eRnXegtKD5AzN/x 1BgcLO4NFwm7CJfFNT4QHjPk/ybEUxVLQ4N5muctTLcyLOLDd1aFBSKwcM95/ZdQSSYk P7yw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@meta.com header.s=s2048-2021-q4 header.b=arrfskI7; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.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=meta.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a17090a930900b0024e29c5c06dsi753188pjo.12.2023.05.24.22.48.01; Wed, 24 May 2023 22:48:13 -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=@meta.com header.s=s2048-2021-q4 header.b=arrfskI7; arc=pass (i=1 spf=pass spfdomain=meta.com dkim=pass dkdomain=meta.com dmarc=pass fromdomain=meta.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=meta.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236191AbjEYFh6 (ORCPT + 99 others); Thu, 25 May 2023 01:37:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234573AbjEYFhy (ORCPT ); Thu, 25 May 2023 01:37:54 -0400 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF7C6D8; Wed, 24 May 2023 22:37:52 -0700 (PDT) Received: from pps.filterd (m0044010.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34P3S3BT026206; Wed, 24 May 2023 22:37:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=s2048-2021-q4; bh=SLhUrRatyzmJDBMG4fyWFhqyWzIqbULwv2mAXqpfuzw=; b=arrfskI7wFATRZmNuKigz2Rb6jY/GIzUJU3MF/mb6Cqb45cejhLpaQKHILmGvKkZ/6rw LAGjV3DaCOWYJNesoHn9uIZzqGZMONZ5kxh4mA/etC1uIazJNPN3AxZbhrV1IafSY3tK DE668tMxX8EztTnfxYlFWqlKf29rxJEhZBC99GqJY2Mk4c8zNiVTvLu9Iz55SJHOHahm j4pMqL5C67gTC4nmqTfT8Tz1wVyIHh2uSL4JBwoYOZw39KcZjdVvEPpwk2DAwk4AGjrE Hb2GIp3WjlNNio9wg+f5TFnLZvTCcj4sM3KvWLEV9GhFOGqaN3FASQR8Fb5p8S+f7Mla yA== Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2170.outbound.protection.outlook.com [104.47.73.170]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3qsystrjsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 May 2023 22:37:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KXaGIVGHbbZL4OnT+FPZXHI5RHWgnqmbsKp8xEK9Rbt1xYBfJogr4fDbcYBzVbTZUHmSIqRVxwKyIYFm2wCl8+mpKhfDx9XXKAimDIng5TakLGMZOToRzAXwRmmZ9fcgBStsSAQIdCrk0zGJcdupddzp7RRlBpdk+HYzZOVNxwpfxLENKvG48Pze63xGpcJegVRBADiX9BBLdxl8OIJyJc9IysDrnfwxbbug6HfbhIv4DeqnskjgiyUXuzZ6EXT+2RWHFOGlGiAfyVpIMf3MP+0a/cTMurJM/uJIrGgVtvUQ4Da4drKLwT8bHXQXVJXC80klQxaQyCV+a8gChSocxQ== 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=SLhUrRatyzmJDBMG4fyWFhqyWzIqbULwv2mAXqpfuzw=; b=nem75E3XbVjGgMHwlAXeIS8Jrp2tp6W6dm3CPgBFwlmJRUnh5HTqu7afLZLOQMgDNg8cMKL0IIh4P8Mpp9f/54K/0Ron/1XDo8jsj4+A8cf6Krm7u9mWfRz0srDF/vLhQZsHWM0zpezqvUd3tl7VkoBWBYtFkksfFsHmDhdRFr5t4gGJV9Baj5/dkhydsX6fL1vL7/z0TkbqmgYThri19k0DA90cC8PC6A2e7ozydiv7rIem4J1QEmwuOFBHv3iy2B/DgfFEoHDT8rKcbnlOqcnBZ+hzEFSiNwT7wX2TRyCr8OMDGwIeK6jM1PjNHUNmoyNoimDH5U4KyVnwN6gqbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=meta.com; dmarc=pass action=none header.from=meta.com; dkim=pass header.d=meta.com; arc=none Received: from SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) by SN7PR15MB5755.namprd15.prod.outlook.com (2603:10b6:806:349::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Thu, 25 May 2023 05:37:30 +0000 Received: from SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::bf7d:a453:b8d9:cf0]) by SN6PR1501MB2064.namprd15.prod.outlook.com ([fe80::bf7d:a453:b8d9:cf0%5]) with mapi id 15.20.6433.016; Thu, 25 May 2023 05:37:29 +0000 Message-ID: <14c985d9-f5eb-e62d-e1a2-9d4c2b651151@meta.com> Date: Wed, 24 May 2023 22:37:25 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [bug] kernel: bpf: syscall: a possible sleep-in-atomic bug in __bpf_prog_put() Content-Language: en-US To: Alexei Starovoitov Cc: Teng Qi , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , bpf , LKML , Network Development References: <20230516111823.2103536-1-starmiku1207184332@gmail.com> <57dc6a0e-6ba9-e77c-80ac-6bb0a6e2650a@meta.com> <113dc8c1-0840-9ee3-2840-28246731604c@meta.com> From: Yonghong Song In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BY3PR05CA0056.namprd05.prod.outlook.com (2603:10b6:a03:39b::31) To SN6PR1501MB2064.namprd15.prod.outlook.com (2603:10b6:805:d::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR1501MB2064:EE_|SN7PR15MB5755:EE_ X-MS-Office365-Filtering-Correlation-Id: f132175e-4c13-4e28-8118-08db5ce2215d 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: H6E7p9lcSedJFXuADkjKVynIGzdilpepya+hwvsWPykVRlo5XW6jnwfMaQdgYAD7zyjKKmu1etN1sPOc/UGV/0DhFQ+cYcpjHj9btW8Ng9SvCFp8y40fzSiasn7hPBh3uupwxuOVFJ9wO3HNf9XK0ZmTnfV6FIPjNQhbaRCy40XPaHtSyWTUTrVIbg7H/rkfwkS3zXgvAH739Xl0dJ+ORUG4VZ8/gDjdLquPOriuNy177bwO2gjTr49A2yMTSxzt8RMF+/vew61jEUV8+rYukfzbS3cHp5CydlbN0CkCi/N4eBivoUlrUDyBSbXYpbEZ7Mqi2huu/W4Vgd9wjoj5iBf1tzsdM1gZctfLL8bb5eVC6QxpwZm3PUMOBPCMQVcgbbB/3OVrV6iTorD+swoZq0hHt5t0pLusm1tT9ZK/ePZUL0xfVPYHyiwernHnSrxthAR1sy4IsrI1BT9cpTPnl37Mu4vNO3m35nC69hUbuT4PXXZzN2RTHCuIeeLcb65ULRp1l3cbRQAhPr+ILKtvireKOLZoXjZQboqrDsdgPG2XJcJHp+ctLmdnjpTL95fuEwLFKuK3bP3+44KhaIPZm+cbaoK1y7YRul8yAPyUAt47xhAgRBkkSANBKK6WPCbw28lbSrn+kdKCyRVRSFocGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR1501MB2064.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(346002)(396003)(39860400002)(376002)(366004)(451199021)(6666004)(478600001)(2616005)(83380400001)(86362001)(31696002)(38100700002)(6486002)(6506007)(36756003)(6512007)(186003)(53546011)(41300700001)(8936002)(316002)(8676002)(7416002)(31686004)(5660300002)(2906002)(54906003)(66946007)(66556008)(66476007)(4326008)(6916009)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YjNVNEN6MjJwM1RxbjhPTkRxSlFmdWJNazFFTHJpb3B6TktyUzdhd1VLTXFR?= =?utf-8?B?YnJWZXJhV3pBMWxFUUhiZVo0UHA0L2tIQXc3cTFHd3BGQjU2ZUIxMVlR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VlVicE1DMzhOOTA5R1FWL1FweFpMQ3cxMG54bDdmWlRu?= =?utf-8?B?R2JGUjhBaEpXTTFnSzg2a2E4d0prbjFRUE9hTXg2ZUNoR2g0dVdsSEZqOGh4?= =?utf-8?B?bUVaWEtaYTFtZ3U1YTJhTlBkSFB0OHFSYjdWNVZ6dmtHVkpIb2l4WUxIRGx5?= =?utf-8?B?MDlvL044MlhjUW5VMUNEWWdlU1Rtb1NYeTN1R0JYYzc4cG9UbFBNRmZLL0dO?= =?utf-8?B?b08rakJuOUFtOGpCbGlTVktsUHQzdXFaOTEwVWFGUlE2bkx4US84MlIzblNF?= =?utf-8?B?VWc9PQ==?= X-OriginatorOrg: meta.com X-MS-Exchange-CrossTenant-Network-Message-Id: f132175e-4c13-4e28-8118-08db5ce2215d X-MS-Exchange-CrossTenant-AuthSource: SN6PR1501MB2064.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 05:37:29.6528 (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: 6bxR//YtOjljW074qAo80KAtZqQO1XBkIVDMuTK0LEsS/Oft2Br7zBiFrHJmW86+ X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR15MB5755 X-Proofpoint-ORIG-GUID: zaeTx5SstPERQN6PRwZJJxy_0rZ0PMx0 X-Proofpoint-GUID: zaeTx5SstPERQN6PRwZJJxy_0rZ0PMx0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_02,2023-05-24_01,2023-05-22_02 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 5/24/23 12:44 PM, Alexei Starovoitov wrote: > On Wed, May 24, 2023 at 12:34 PM Yonghong Song wrote: >> >> >> >> On 5/24/23 5:42 AM, Teng Qi wrote: >>> Thank you. >>> >>>> We cannot use rcu_read_lock_held() in the 'if' statement. The return >>>> value rcu_read_lock_held() could be 1 for some configurations regardless >>>> whether rcu_read_lock() is really held or not. In most cases, >>>> rcu_read_lock_held() is used in issuing potential warnings. >>>> Maybe there are other ways to record whether rcu_read_lock() is held or not? >>> >>> Sorry. I was not aware of the dependency of configurations of >>> rcu_read_lock_held(). >>> >>>> If we cannot resolve rcu_read_lock() presence issue, maybe the condition >>>> can be !in_interrupt(), so any process-context will go to a workqueue. >>> >>> I agree that using !in_interrupt() as a condition is an acceptable solution. >> >> This should work although it could be conservative. >> >>> >>>> Alternatively, we could have another solution. We could add another >>>> function e.g., bpf_prog_put_rcu(), which indicates that bpf_prog_put() >>>> will be done in rcu context. >>> >>> Implementing a new function like bpf_prog_put_rcu() is a solution that involves >>> more significant changes. >> >> Maybe we can change signature of bpf_prog_put instead? Like >> void bpf_prog_put(struct bpf_prog *prog, bool in_rcu) >> and inside bpf_prog_put we can add >> WARN_ON_ONCE(in_rcu && !bpf_rcu_lock_held()); > > bpf_rcu_lock_held() is used for different cases. Sorry, I actually mean rcu_read_lock_held() ... > > Here s/in_irq/in_interrupt/ inside bpf_prog_put() is enough > to address this theoretical issue. Maybe if (!in_interrupt()) { INIT_WORK(&aux->work, bpf_prog_put_deferred); schedule_work(&aux->work); } else { bpf_prog_put_deferred(&aux->work); } ? Basically for any process context, use a work queue since we have no idea whether rcu_read_lock() is held or not. In process context, is_atmoc() and irqs_disabled() should already use the work queue. As we discussed in the above, if in_interrupt() is true, kvfree seems okay, so can directly call bpf_prog_put_deferred(). Does this sound reasonable?