Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4170926iog; Tue, 21 Jun 2022 13:39:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vqmbcakWh/J30yyonvSF4nHLgADG0Ca8mLoe2iH9ldW2FtpR9FBwKONGaGONAJOIL2txEq X-Received: by 2002:a63:1408:0:b0:408:ab3d:9310 with SMTP id u8-20020a631408000000b00408ab3d9310mr27982553pgl.253.1655843965440; Tue, 21 Jun 2022 13:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655843965; cv=none; d=google.com; s=arc-20160816; b=Aq4320+YDGzRf/CJul2YQXeAjNX1WEWE2OwQtDSs7M39AoU/W1Mm64/uSGrM76yyIz Be1cPgx30OpuOXNPSiAdcaoJN6kiUlb4xXhrPAPe3J78jBJniHLDNxwpPpQCehVKJbbt SudwlB08i2opPUxni9wV7dC5XHc+JRIy5qNuQhTKr1BpajiKUDzOZIVlqdsTBJZkKTab NgAJgj+WaWTDmVxG0k+xoetNmjsdNhoS0qaWEG8I9fF/rhK82zTOUjQ9JrNNsOvzZDgk elCUb4v2hueOHvFyjLr9ewyPwevtAyh2LUD5lT50B5qhnFSvSCp+LTJMigWr2vHi7x/d kQRw== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=FHOjmjAGhb/jKh/X38HObStif09xq2VOvZEQFXt3zqo=; b=MkKYkP+I72v9Vakh486/ReIHuqY/+b+hTeLEQ6xKV8ZvMmDq1DWu7b+96AFGgaBL+q rXEhJ0mYqCPhephhIaCiAi7w54B3GmjUofsem1rPYhxUlqZ8wSgk+hqLXsFEAUDeVHnt tj4tsCcp8DYGNBCXvwmp5hMk00L/FAG9SyfnE13qiv3G30zvXzmaBplvRpnLqEvNxLts rVBxvggCht1wjFJkFKvk/AhhaNAzIdVq+73beK2eR6JRLwsb9K4S6MRAWuWOYvwUA46E wvAnh59T14ZbD0ZXFi1K1HoHJCFxJgPRW4ELOeHVA8igKI+0kKi50wB2co4amdycMrz9 EHQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="REhG/YvE"; 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=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a635052000000b003f9f28dd8e9si21193170pgl.794.2022.06.21.13.39.13; Tue, 21 Jun 2022 13:39:25 -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=@canonical.com header.s=20210705 header.b="REhG/YvE"; 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=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353804AbiFUU1y (ORCPT + 99 others); Tue, 21 Jun 2022 16:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235086AbiFUU1t (ORCPT ); Tue, 21 Jun 2022 16:27:49 -0400 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F079D2EA03; Tue, 21 Jun 2022 13:27:47 -0700 (PDT) Received: from [192.168.192.153] (unknown [50.126.114.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 942D241625; Tue, 21 Jun 2022 20:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1655843265; bh=FHOjmjAGhb/jKh/X38HObStif09xq2VOvZEQFXt3zqo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=REhG/YvE5Y5HZv8PaXPYcPM44vP8IEJ8IMzZFA32j0rDjJBvP54vgsg5TljnEVb2C 6l9Gw8xSjfI1zJUVeqU706hHjnfTfXBQg2mjFR6AwzXgBae9AkqRIO3MW8Nnl/QIYx a1aXnHf31tgETQ71gAcLHrFbepqdBlwyN+w4B9rXjnOL0oVRtEXzi0mdktd1n9nhlu c44GHwZtTKZGR9nZxxQNYa84k7b7lT8U8Rrb1bb1ojiaT2SzJ9CuwKDkd0rVfWt/0m kvplSORt2LLsRq1jQmvt49GetCZG97LSsyDGbhwWhE+cCGxDZom8/JBlMrQKyYTzOo 3XS9YZXjztRIg== Message-ID: Date: Tue, 21 Jun 2022 13:27:33 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Linux 5.18-rc4 Content-Language: en-US To: Matthew Wilcox Cc: Linus Torvalds , "Eric W. Biederman" , Ammar Faizi , James Morris , LSM List , Linux Kernel Mailing List , Al Viro , Kees Cook , linux-fsdevel@vger.kernel.org, Linux-MM , gwml@vger.gnuweeb.org References: <226cee6a-6ca1-b603-db08-8500cd8f77b7@gnuweeb.org> <87r1414y5v.fsf@email.froward.int.ebiederm.org> <266e648a-c537-66bc-455b-37105567c942@canonical.com> From: John Johansen Organization: Canonical In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 6/13/22 15:48, Matthew Wilcox wrote: > On Mon, Jun 06, 2022 at 02:00:33PM -0700, John Johansen wrote: >> On 6/6/22 13:23, Matthew Wilcox wrote: >>> On Mon, Jun 06, 2022 at 12:19:36PM -0700, John Johansen wrote: >>>>> I suspect that part is that both Apparmor and IPC use the idr local lock. >>>>> >>>> bingo, >>>> >>>> apparmor moved its secids allocation from a custom radix tree to idr in >>>> >>>> 99cc45e48678 apparmor: Use an IDR to allocate apparmor secids >>>> >>>> and ipc is using the idr for its id allocation as well >>>> >>>> I can easily lift the secid() allocation out of the ctx->lock but that >>>> would still leave it happening under the file_lock and not fix the problem. >>>> I think the quick solution would be for apparmor to stop using idr, reverting >>>> back at least temporarily to the custom radix tree. >>> >>> How about moving forward to the XArray that doesn't use that horrid >>> prealloc gunk? Compile tested only. >>> >> >> I'm not very familiar with XArray but it does seem like a good fit. We do try >> to keep the secid allocation dense, ideally no holes. Wrt the current locking >> issue I want to hear what Thomas has to say. Regardless I am looking into >> whether we should just switch to XArrays going forward. > > Nothing from Thomas ... shall we just go with this? Do you want a > commit message, etc for the patch? Hey Matthew, I have done testing with this and the patch looks good. We will certainly go this route going forward so a commit message, would be good. As for fixing the issue in current kernels. I am not opposed to pulling this back as fixes for 99cc45e48678 apparmor: Use an IDR to allocate apparmor secids but I would like some other peoples opinions on doing that, because we don't understand why we are getting the current lock splat, and without understanding it is a fix by avoiding the issue rather than being sure the actual issue is fixed.