Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5197671rwl; Tue, 28 Mar 2023 18:16:40 -0700 (PDT) X-Google-Smtp-Source: AKy350bbn41nLtQvkA+POrXjJlTIkoj926M85Ygdk0y+q4SnhftlL2ffdBx3KLvfj2xqYqRs+mXI X-Received: by 2002:a17:906:6449:b0:8eb:d3a5:b9f0 with SMTP id l9-20020a170906644900b008ebd3a5b9f0mr17810908ejn.67.1680052599885; Tue, 28 Mar 2023 18:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680052599; cv=none; d=google.com; s=arc-20160816; b=B6Rb2SIw7MqPDijEEi6wJB1MqN2pSkbR6hhfsn0aB5tAp/0mK4IgHj9l8Jn94X+oK+ W5rLjuB512JY0nuyZrFpFJvcaD/lOcvP0v+OsklEtaoBzN6bT1t/0tDjVsdwuX+tl8Ph rGozy1RsV6aw57M7HTnhOodCV20NdrU1k1XTb9Kors106rIDtf6UqjNczq1rKMbSVLm4 QDi6RXjC7VHMRmhmvEXVjI/wnKZNFCJM0W9PGFeDPcBeawyoMAwQp+rvzkCxpNuwks7N bDrIpXDNBMWv0XFUOL7jVK3DJR2I/dqZNdAF/oNC+1xU511brE3y4qpsZ6a4iGfmpGvO WUFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=CV+JPi9jrhKysuhyuOo9mHfdcUee9dW6k5JS0Hzd0N8=; b=lIvmaOm5uk4TfBSVy6MOy+vXmV/MA41ZIXQ+f/MyE6e1weHBgNI+2cEOUEXcth7k06 FMZ6LPB90BgfowaP41iv6LyC6uESWAQYFonOy55SSvJHbxOawu1cYhBgvyz3Zu+AC4bo 7mvk5cE7GdTG1vlBnxVNUgJOfWk4/CCNVMP2umLzaczS6WqQnMY+5aflf9UKplMC0/sa I9U9h7MB0EwO3klub79AYKT3Q46w8PvIvBHvgjWJBGNFtd2zvGAscjPUyE7c6hp/I9A/ DnEq2b9R8hqqIa9HHd4vo1ttmeD7x+tbneITixWN15/Sl6HCa8DwhlmVVTYfNT1SvBB4 YvtA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a17090608cf00b008d4fbb9f30csi28367006eje.899.2023.03.28.18.16.14; Tue, 28 Mar 2023 18:16:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbjC2BOi (ORCPT + 99 others); Tue, 28 Mar 2023 21:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjC2BOd (ORCPT ); Tue, 28 Mar 2023 21:14:33 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6FEDE1; Tue, 28 Mar 2023 18:14:20 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4PmT934wYpz4f43Nx; Wed, 29 Mar 2023 09:14:15 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP3 (Coremail) with SMTP id _Ch0CgC3YiDnkCNkRbL8Fg--.2035S3; Wed, 29 Mar 2023 09:14:17 +0800 (CST) Subject: Re: [PATCH v2 0/5] md: fix uaf for sync_thread To: Song Liu , Yu Kuai Cc: Logan Gunthorpe , Paul Menzel , agk@redhat.com, snitzer@kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20230315061810.653263-1-yukuai1@huaweicloud.com> <606b1388-10e7-a0ae-f314-52274b0942dd@deltatee.com> From: Yu Kuai Message-ID: <2de7665b-b6a9-fe23-6a36-0d8ff2626b15@huaweicloud.com> Date: Wed, 29 Mar 2023 09:14:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: _Ch0CgC3YiDnkCNkRbL8Fg--.2035S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Ww48XF1Dtw1xtF48ZF4xZwb_yoW8tr4Upa y3KaySyw4kJw1Iyr18tr1I9w1IkryrXrWDJrWrG34rA3s8Xw1ftF47trWDCFyv9F4xWw4a va1Yq3yq9a90v3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9F14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E 3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcS sGvfC2KfnxnUUI43ZEXa7VUbXdbUUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.0 required=5.0 tests=NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 Hi, Song! 在 2023/03/29 7:31, Song Liu 写道: > On Wed, Mar 15, 2023 at 6:26 PM Yu Kuai wrote: >> >> Hi, >> >> 在 2023/03/16 6:55, Logan Gunthorpe 写道: > [...] >>> I was going to try and confirm that no new regressions were introduced >>> by Yu's patches, but seems the tests are getting worse. I tried running >>> the tests on the current md-next branch and found that one of the early >>> tests, 00raid5-zero, hangs indefinitely. I quickly ran the same test on > > I am not able to repro the issue with 00raid5-zero. (I did a rebase before > running the test, so that might be the reason). > >>> v6.3-rc2 and found that it runs just fine there. So it looks like >>> there's already a regression in md-next that is not part of this series >>> and I don't have the time to dig into the root cause right now. >>> >>> Yu's patches don't apply cleanly to v6.3-rc2 and I can't run the tests >>> against md-next; so I didn't bother running them, but I did do a quick >>> review. The locking changes make sense to me so it might be worth >>> merging for correctness. However, I'm not entirely sure it's the best >>> solution -- the md thread stuff seems like a bit of a mess and passing >>> an mddev to thread functions that were not related to the mddev to get a >>> lock seems to just make the mess a bit worse. >>> >>> For example, it seems a bit ugly to me for the lock mddev->thread_lock >>> to protect the access of a pointer in struct r5l_log. Just spit-balling, >>> but perhaps RCU would be more appropriate here. Then md_wakeup_thread() >>> would just need to hold the RCU read lock when dereferencing, and >>> md_unregister_thread() would just need to synchronize_rcu() before >>> stopping and freeing the thread. This has the benefit of not requiring >>> the mddev object for every md_thread and would probably require a lot >>> less churn than the current patches. >> >> Thanks for your suggestion, this make sense to me. I'll try to use rcu. > > Yu Kuai, do you plan to resend the set with Logan suggestions? Yes, of course, it's just some other problems is triggered while I'm testing the patchset, I'll resend the set once all tests is passed. Thanks, Kuai > > Thanks, > Song > . >