Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2487547rwb; Mon, 15 Aug 2022 06:24:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4lmI14mvy2eBbkSpuWhmmkvkULxx+7o7KZu6AWXprItXPuj1nX+WA4V/a55WiHxe3fV3/l X-Received: by 2002:a17:907:2da6:b0:730:8b30:e517 with SMTP id gt38-20020a1709072da600b007308b30e517mr10578178ejc.291.1660569850928; Mon, 15 Aug 2022 06:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660569850; cv=none; d=google.com; s=arc-20160816; b=e6Pol26ao6le24nthC32DJo3LbyPhsh7ufHbuI73oQTOf2n69jyUM6gQ2FhNrrd5uY rDdW8GXsDVw5M+WtTeR+TI72XlKWVmPSrVE+SKKP9ezxwP+EkAKWG4oO0ALRjHN4bXLw bsoE8IQwOgXsb2YcuSwsJR25cSy5EkPp8/KktJar6HlDO8fpQaYp6qh20I9SXcf5NLEP 1MTDWwWim/omToud+gkQZIbV1n1qkMB4BoCWCeYJTWrkxiwsb6BtyhF3YCLpKIXO0uks M1+DpOKsAZf5o3R4qPiVGz3EEUjAVy4BxRVsX+/sAW9pVL8MOlv0bzTQAbK/A9MNJMJe u9RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0O1sf920eUihvgTY7T5XThUehKdDUHn2aHkaf8kBbAc=; b=ebbCgKm0cQG1sAtk4xQwq1Pl57vGlNnd9/+CDINqDXCOy1C8Qgf08Wwm47GdF1XMql KsyQZJKhl61n/iZfqXeCHJDZzWKhN/Yo5IRJlH6XP+BMFF1X1Poe7gRCmQbSrwu7upZM jwniB7sSzNdsUmgKGbxi0YeInN2IYGRRqV9ehJSxgyOXgf4ej6EPK9mcNkuAz+ZyEnV+ 2O62neVy2tzEpIKcQUfZRwmAO+nD6z642F1UaHeOGLndhO0U27Kt7BOH11zZdhlTqdNe EJZAAFYJp7+VZ/UDvqLNcGcC6DSUrSroq+AXVHW+4dA5DKiT8m3m8ieVw1xC+T2HSbAU vj7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=U5+YgxZR; 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 f19-20020a170906139300b007303646197csi6250507ejc.596.2022.08.15.06.23.44; Mon, 15 Aug 2022 06:24:10 -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=@infradead.org header.s=casper.20170209 header.b=U5+YgxZR; 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 S242376AbiHONFb (ORCPT + 99 others); Mon, 15 Aug 2022 09:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231493AbiHONF3 (ORCPT ); Mon, 15 Aug 2022 09:05:29 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2381146D for ; Mon, 15 Aug 2022 06:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0O1sf920eUihvgTY7T5XThUehKdDUHn2aHkaf8kBbAc=; b=U5+YgxZRQJLUsZVFGa8jpjISiZ KXqYNcUc1MqF7NtePqt0KqehSGtnJdqqCaFozy4CIyCEG6PLW/qQes26YDnOMVQ7G9mxk7meBbkX+ Ad4seMTumPH4iTpcmCefpeyUQ+qVxQhzFYz/j/t9etjlPQjX5JQ03IYKDb2gYC5TPlN48pYtMGiAi soblL2ptmaA4v/24nrXFZArqKunBh0PexOXZh4iM240WD+YmP+Ce97qrjFhtFx11cqXGzPFW2txRB AS7yxj+/PzcEzLVuX8SetJ1HDhR6MhalKy1VrMxU6zfk33PbOSVI24Vt/vat1p2DbSX83vhstHv3Y W6LzNG8Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNZmT-005jhz-Cz; Mon, 15 Aug 2022 13:05:21 +0000 Date: Mon, 15 Aug 2022 14:05:21 +0100 From: Matthew Wilcox To: Arnd Bergmann Cc: kernel test robot , llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: fs/ntfs/aops.c:378:12: warning: stack frame size (2216) exceeds limit (1024) in 'ntfs_read_folio' Message-ID: References: <202208140835.W6F1j6Da-lkp@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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 Mon, Aug 15, 2022 at 02:56:11PM +0200, Arnd Bergmann wrote: > On Mon, Aug 15, 2022 at 2:29 PM Matthew Wilcox wrote: > > > > On Sun, Aug 14, 2022 at 08:21:36AM +0800, kernel test robot wrote: > > > Hi Matthew, > > > > > > FYI, the error/warning still remains. > > > > FYI, this is still not interesting. > > This is a hexagon 256kB PAGE_SIZE config, and so the amount of stack > > space is correspondingly larger. The frame size warning should be > > increased to allow for this. > > > > > >> fs/ntfs/aops.c:378:12: warning: stack frame size (2216) exceeds limit (1024) in 'ntfs_read_folio' [-Wframe-larger-than] > > I don't think we should change the frame size warning for this, there is not > generally any correlation between page size and stack usage, so that would > just hide bugs elsewhere. In this specific case, there is. It's a stack allocation of an array that depends on the number of 512-byte blocks per page. With 4k pages, that's only 8. With 256k pages, that's 512. With an 8-byte pointer, that's a 4kB allocation, and even with a 4-byte pointer, that's a 2kB stack allocation, which is still going to blow the prescribed stack limit. This is not unique to NTFS! An NTFS-specific "fix" is inappropriate. It's just that nobody's paying attention to the warnings coming from fs/buffer.c: include/linux/buffer_head.h:#define MAX_BUF_PER_PAGE (PAGE_SIZE / 512) int block_read_full_folio(struct folio *folio, get_block_t *get_block) { ... struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; I don't know why I'm not getting a nastygram about that one, but it's all bufferhead based filesystems. > NTFS has had problems with stack usage on 64K+ pages before, the last > time we addressed this using 4eec7faf6775 ("fs: ntfs: Limit NTFS_RW to > page sizes smaller than 64k"), but it looks like this time it affects both > write and read support. The reasoning there is faulty. If you have a 64k (or 256k) page size, your stack is correspondingly huge and can handle these kinds of allocations.