From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F318C43334 for ; Tue, 21 Jun 2022 20:27:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9A5E8E0017; Tue, 21 Jun 2022 16:27:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A22FC8E0014; Tue, 21 Jun 2022 16:27:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C41F8E0017; Tue, 21 Jun 2022 16:27:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 792D58E0014 for ; Tue, 21 Jun 2022 16:27:49 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 4E64C80468 for ; Tue, 21 Jun 2022 20:27:49 +0000 (UTC) X-FDA: 79603379058.27.B2488AA Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by imf06.hostedemail.com (Postfix) with ESMTP id 7D89E1800AC for ; Tue, 21 Jun 2022 20:27:48 +0000 (UTC) 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 ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b="REhG/YvE"; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf06.hostedemail.com: domain of john.johansen@canonical.com designates 185.125.188.120 as permitted sender) smtp.mailfrom=john.johansen@canonical.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655843268; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FHOjmjAGhb/jKh/X38HObStif09xq2VOvZEQFXt3zqo=; b=t/b5WtwNe4jrsARAlsqv9wbWPghuy7SAiq+y33xy5KwGTPwE1odEiLzv6P+0YcZqqXQwA1 C3sCRLoAJLf4sLfec33SeEOm+M405gQZyiIFJtQrCIQnfZ1XEfR58JkdYkOl7O7Tk41zyG 9eoYZ0kHAndc4Vubxh1CPuJqVUROp/w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655843268; a=rsa-sha256; cv=none; b=7+ugxHVwekrQ+jRMQEqHgtYTOj5RUvcPe5BqitFe8e1paYmMUHskd+C+44kiBazK/VTst9 WallB6TUEgX8ZVBt1bfNmTNYqi4Y3Kpqo2TOLOmtTelqIVI24xIEU7ojazvild1Viv6mEv DCirXm/F+TXu/+//YJjnGUW1NFeZVc4= X-Stat-Signature: 1o6rdswqbmaapu861eums1fdq1ecem7q X-Rspamd-Queue-Id: 7D89E1800AC X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=canonical.com header.s=20210705 header.b="REhG/YvE"; dmarc=pass (policy=none) header.from=canonical.com; spf=pass (imf06.hostedemail.com: domain of john.johansen@canonical.com designates 185.125.188.120 as permitted sender) smtp.mailfrom=john.johansen@canonical.com X-Rspamd-Server: rspam10 X-HE-Tag: 1655843268-104757 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.