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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A308C433EF for ; Mon, 29 Nov 2021 21:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1PcBubYUCFZ97Ly2h2s3fr+N4X3sxbDf+iwo5s0Xnvs=; b=Wo9kFwTEhtRzs7 sd3wd50mPlZ7foqtWM9pXL/EpzXCEgYG6GzPAFf1DVJ31nk2eVAi7r9hJoWnUc7V2BVsgVp6VhosX FtMg8+75641JRmh+Mzo5I7SKs72iWOkLhgFgvFl6lGXIhURU7seiY1ZiRxZOfgCwVpcdlCX3F9jg4 b1mUsmHp75YmP4RG5sdFL0gWPHH/ZdZtVC93fi5yOmQYanVTY9vs+f2j3VyQuLNY+SheCWJXnV8sm S/+LRIqjDUdmCJ3NGOQ8F24rkPdDUmlMS0cPYPCSvNj5r6G10AnfMTt1atr37EeELbXcqxcavCUi2 fbLUBJsIjLVgrFmN+4ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mroaU-002q41-Sm; Mon, 29 Nov 2021 21:53:27 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mroaR-002q33-5A for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 21:53:24 +0000 Received: by mail-ed1-x533.google.com with SMTP id y12so77938627eda.12 for ; Mon, 29 Nov 2021 13:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=slW4IJtLPUe+dCTHZwT8J5Hyfi+JKfCkiz5Jx8MZKyY=; b=OIIkDWpAmMxBagMHTq19qfJ/pA9QYr/FKz8j6+SnJ2OrelhnpGAnnKmCIO3mUxo8Q6 3kiR81AGz32H1FqBqW5zns775gFrUt+SLbtgMVdaHVpW1sxT7KmTN6wWstYt3DlOV4Dj +J3pR3O4PkRhYpRorn4h4+cgIw+4SIqeCwE5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=slW4IJtLPUe+dCTHZwT8J5Hyfi+JKfCkiz5Jx8MZKyY=; b=TkCJX32bMZBcQwgmLgZOsWGkt1gzu3MxmskfEjJno5n7jbj5KQoUNw2p1Fg+TJENVa biqrZn4jxv2D4qeSJeM0vMwxr7739P1RM1Ybqgvy4edghDI10hlHu+NkAz1joRCdZGy0 sdUmrh6SNL5Ut4o7Is6lFdqynzQjI0NqdpuU6EldN+nyP5rgaZCc6lBgZWIJ0uBsjeA9 Y3mX+FvTD3aB+XuYCHG42ZGpe08AhiW6n6NaY5SfgSPsH1U5dVcYHrGFxRUdC540hX4z sYjC3m1xa4Ck2qFrBgv2ubEF2N+Iv7L1o3LxpNvWVQhuLmWxhuXOEHJJN0+Dw9WjfkFF h16w== X-Gm-Message-State: AOAM5328a3+NxOyAnzwiZOiD1jz5vTtqdBQ+KzPCn2/A/+kFHC6kf1C4 0YkJdNWP2/apofUDyO4vXWDeYpopyyk6O9/52FU= X-Google-Smtp-Source: ABdhPJwvBKFJB/A7SqzLfuHZ3HR/JhBPONhu3r6Pw37zBKjnyBBMJLIHxK328IgGW4LadrK4Vhjq0A== X-Received: by 2002:a17:907:60cf:: with SMTP id hv15mr17860245ejc.561.1638222801091; Mon, 29 Nov 2021 13:53:21 -0800 (PST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com. [209.85.221.43]) by smtp.gmail.com with ESMTPSA id gn16sm8099674ejc.67.2021.11.29.13.53.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 13:53:19 -0800 (PST) Received: by mail-wr1-f43.google.com with SMTP id a9so39883523wrr.8 for ; Mon, 29 Nov 2021 13:53:18 -0800 (PST) X-Received: by 2002:adf:e5c7:: with SMTP id a7mr37419983wrn.318.1638222798596; Mon, 29 Nov 2021 13:53:18 -0800 (PST) MIME-Version: 1.0 References: <20211127123958.588350-1-agruenba@redhat.com> In-Reply-To: From: Linus Torvalds Date: Mon, 29 Nov 2021 13:53:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] btrfs: Avoid live-lock in search_ioctl() on hardware with sub-page faults To: Catalin Marinas Cc: Andreas Gruenbacher , Matthew Wilcox , Josef Bacik , David Sterba , Al Viro , Andrew Morton , Will Deacon , linux-fsdevel , LKML , Linux ARM , linux-btrfs X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211129_135323_213897_7E225E0B X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Nov 29, 2021 at 12:56 PM Catalin Marinas wrote: > > For arm64 at least __put_user() does the access_ok() check. I thought > only unsafe_put_user() should skip the checks. If __put_user() can write > arbitrary memory, we may have a bigger problem. That's literally be the historical difference between __put_user() and put_user() - the access check. > I think that would be useful, though it doesn't solve the potential > livelock with sub-page faults. I was assuming we'd just do the sub-page faults. In fact, I was assuming we'd basically just replace all the PAGE_ALIGN and PAGE_SIZE with SUBPAGE_{ALIGN,SIZE}, together with something like if (size > PAGE_SIZE) size = PAGE_SIZE; to limit that size thing (or possibly make that "min size" be a parameter, so that people who have things like that "I need at least this initial structure to be copied" issue can document their minimum size needs). Linus _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97BE2C433FE for ; Mon, 29 Nov 2021 22:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231861AbhK2WQv (ORCPT ); Mon, 29 Nov 2021 17:16:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232362AbhK2WQk (ORCPT ); Mon, 29 Nov 2021 17:16:40 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47D19C0FE6D3 for ; Mon, 29 Nov 2021 13:53:23 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id x6so77650341edr.5 for ; Mon, 29 Nov 2021 13:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=slW4IJtLPUe+dCTHZwT8J5Hyfi+JKfCkiz5Jx8MZKyY=; b=OIIkDWpAmMxBagMHTq19qfJ/pA9QYr/FKz8j6+SnJ2OrelhnpGAnnKmCIO3mUxo8Q6 3kiR81AGz32H1FqBqW5zns775gFrUt+SLbtgMVdaHVpW1sxT7KmTN6wWstYt3DlOV4Dj +J3pR3O4PkRhYpRorn4h4+cgIw+4SIqeCwE5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=slW4IJtLPUe+dCTHZwT8J5Hyfi+JKfCkiz5Jx8MZKyY=; b=ttkkB2D0yREmFmX8aALaExH9U3sqEOAcdEkBcOHZhw5LD8puZSHazNUKjO8Pq6+V17 2xGYEZhyGhigEMnWnjkH/SDl3UUX/FpMgIt9DyiZc1MJazKY0JEYRzc5RncpbZ4fre1h dvJztJpuLf/xSLuSc3a7b/GE31KUS3vVj5nyHfJSQP1kaszfjbglQvuIDvodQcbT+go9 BX8DJVLf/vo1I3d2rygkXgHtttZq+lCLc0yLufeb3g+0h7MdljxTIhqrfoeUbS6peCDG aCewqZY5Hyxcu508tCswMaAa46LxvrnTnmlUYIo25VHhmNREABPCPvVYbfVUfn31jBhH +3SQ== X-Gm-Message-State: AOAM5324kdbTgVueFqg52DzwwIwhsdEwJJK8vRriEkvDPKsobpp18mtf JzCEEZNBXdAQnc8CkPz6s28Wu5s//SEDOh+Fpck= X-Google-Smtp-Source: ABdhPJwmloabAAK61KzIBjuctJ8G4Pij0F6c9nXgflOIw5EV+7wy1TLzac8MfAY5sdeCN+yNpADhnQ== X-Received: by 2002:a17:906:79c8:: with SMTP id m8mr59487409ejo.511.1638222801629; Mon, 29 Nov 2021 13:53:21 -0800 (PST) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com. [209.85.221.42]) by smtp.gmail.com with ESMTPSA id b14sm10024138edw.6.2021.11.29.13.53.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 13:53:19 -0800 (PST) Received: by mail-wr1-f42.google.com with SMTP id d9so19003080wrw.4 for ; Mon, 29 Nov 2021 13:53:18 -0800 (PST) X-Received: by 2002:adf:e5c7:: with SMTP id a7mr37419983wrn.318.1638222798596; Mon, 29 Nov 2021 13:53:18 -0800 (PST) MIME-Version: 1.0 References: <20211127123958.588350-1-agruenba@redhat.com> In-Reply-To: From: Linus Torvalds Date: Mon, 29 Nov 2021 13:53:01 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] btrfs: Avoid live-lock in search_ioctl() on hardware with sub-page faults To: Catalin Marinas Cc: Andreas Gruenbacher , Matthew Wilcox , Josef Bacik , David Sterba , Al Viro , Andrew Morton , Will Deacon , linux-fsdevel , LKML , Linux ARM , linux-btrfs Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Nov 29, 2021 at 12:56 PM Catalin Marinas wrote: > > For arm64 at least __put_user() does the access_ok() check. I thought > only unsafe_put_user() should skip the checks. If __put_user() can write > arbitrary memory, we may have a bigger problem. That's literally be the historical difference between __put_user() and put_user() - the access check. > I think that would be useful, though it doesn't solve the potential > livelock with sub-page faults. I was assuming we'd just do the sub-page faults. In fact, I was assuming we'd basically just replace all the PAGE_ALIGN and PAGE_SIZE with SUBPAGE_{ALIGN,SIZE}, together with something like if (size > PAGE_SIZE) size = PAGE_SIZE; to limit that size thing (or possibly make that "min size" be a parameter, so that people who have things like that "I need at least this initial structure to be copied" issue can document their minimum size needs). Linus