All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k
@ 2021-11-27 15:44 Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 1/3] arch: Add generic Kconfig option indicating page size " Guenter Roeck
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-11-27 15:44 UTC (permalink / raw)
  To: Anton Altaparmakov
  Cc: linux-ntfs-dev, linux-kernel, David S . Miller, netdev,
	Joel Stanley, Michael Ellerman, Stephen Rothwell, Linus Torvalds,
	Arnd Bergmann, Guenter Roeck

This is the third attempt to fix the following build error.

fs/ntfs/aops.c: In function 'ntfs_write_mst_block':
fs/ntfs/aops.c:1311:1: error:
	the frame size of 2240 bytes is larger than 2048 bytes

The problem is that NTFS_RW code allocates page size dependent arrays on
the stack. This results in build failures if the page size is 64k or
larger.

Since commit f22969a66041 ("powerpc/64s: Default to 64K pages for 64 bit
book3s") this affects ppc:allmodconfig builds, but other architectures
supporting page sizes of 64k or larger are also affected.

Increasing the maximum frame size for affected architectures just to
silence this error does not really help. The frame size would have to be
set to a really large value for 256k pages. Also, a large frame size could
potentially result in stack overruns in this code and elsewhere and is
therefore not desirable. Make NTFS_RW dependent on page sizes smaller than
64k instead.

Previous attempts to fix the problem were local to the ntfs subsystem.
This attempt introduces the architecture independent configuration flag
PAGE_SIZE_LESS_THAN_64KB and uses it to restrict NTFS_RW. The last patch
of the series replaces a similar restriction for VMXNET3 with the new
flag. This patch is not necessary to fix the NTFS_RW problem and is
provided only for completeness.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/3] arch: Add generic Kconfig option indicating page size smaller than 64k
  2021-11-27 15:44 [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Guenter Roeck
@ 2021-11-27 15:44 ` Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 2/3] fs: ntfs: Limit NTFS_RW to page sizes " Guenter Roeck
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-11-27 15:44 UTC (permalink / raw)
  To: Anton Altaparmakov
  Cc: linux-ntfs-dev, linux-kernel, David S . Miller, netdev,
	Joel Stanley, Michael Ellerman, Stephen Rothwell, Linus Torvalds,
	Arnd Bergmann, Guenter Roeck

NTFS_RW and VMXNET3 require a page size smaller than 64kB. Add generic
Kconfig option for use outside architecture code to avoid architecture
specific Kconfig options in that code.

Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v3: Added patch: declare new configuration flag in generic code

 arch/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/Kconfig b/arch/Kconfig
index 26b8ed11639d..d3c4ab249e9c 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -991,6 +991,16 @@ config HAVE_ARCH_COMPAT_MMAP_BASES
 	  and vice-versa 32-bit applications to call 64-bit mmap().
 	  Required for applications doing different bitness syscalls.
 
+config PAGE_SIZE_LESS_THAN_64KB
+	def_bool y
+	depends on !ARM64_64K_PAGES
+	depends on !IA64_PAGE_SIZE_64KB
+	depends on !PAGE_SIZE_64KB
+	depends on !PARISC_PAGE_SIZE_64KB
+	depends on !PPC_64K_PAGES
+	depends on !PPC_256K_PAGES
+	depends on !PAGE_SIZE_256KB
+
 # This allows to use a set of generic functions to determine mmap base
 # address by giving priority to top-down scheme only if the process
 # is not in legacy mode (compat task, unlimited stack size or
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] fs: ntfs: Limit NTFS_RW to page sizes smaller than 64k
  2021-11-27 15:44 [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 1/3] arch: Add generic Kconfig option indicating page size " Guenter Roeck
@ 2021-11-27 15:44 ` Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 3/3] vmxnet3: Use generic Kconfig option for page size limit Guenter Roeck
  2021-11-27 17:49 ` [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Linus Torvalds
  3 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-11-27 15:44 UTC (permalink / raw)
  To: Anton Altaparmakov
  Cc: linux-ntfs-dev, linux-kernel, David S . Miller, netdev,
	Joel Stanley, Michael Ellerman, Stephen Rothwell, Linus Torvalds,
	Arnd Bergmann, Guenter Roeck

NTFS_RW code allocates page size dependent arrays on the stack. This
results in build failures if the page size is 64k or larger.

fs/ntfs/aops.c: In function 'ntfs_write_mst_block':
fs/ntfs/aops.c:1311:1: error:
	the frame size of 2240 bytes is larger than 2048 bytes

Since commit f22969a66041 ("powerpc/64s: Default to 64K pages for 64 bit
book3s") this affects ppc:allmodconfig builds, but other architectures
supporting page sizes of 64k or larger are also affected.

Increasing the maximum frame size for affected architectures just to
silence this error does not really help. The frame size would have to be
set to a really large value for 256k pages. Also, a large frame size could
potentially result in stack overruns in this code and elsewhere and is
therefore not desirable. Make NTFS_RW dependent on page sizes smaller than
64k instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v3: Use generic configuration flag
v2: More comprehensive dependencies

 fs/ntfs/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ntfs/Kconfig b/fs/ntfs/Kconfig
index 1667a7e590d8..f93e69a61283 100644
--- a/fs/ntfs/Kconfig
+++ b/fs/ntfs/Kconfig
@@ -52,6 +52,7 @@ config NTFS_DEBUG
 config NTFS_RW
 	bool "NTFS write support"
 	depends on NTFS_FS
+	depends on PAGE_SIZE_LESS_THAN_64KB
 	help
 	  This enables the partial, but safe, write support in the NTFS driver.
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] vmxnet3: Use generic Kconfig option for page size limit
  2021-11-27 15:44 [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 1/3] arch: Add generic Kconfig option indicating page size " Guenter Roeck
  2021-11-27 15:44 ` [PATCH v3 2/3] fs: ntfs: Limit NTFS_RW to page sizes " Guenter Roeck
@ 2021-11-27 15:44 ` Guenter Roeck
  2021-11-27 17:49 ` [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Linus Torvalds
  3 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2021-11-27 15:44 UTC (permalink / raw)
  To: Anton Altaparmakov
  Cc: linux-ntfs-dev, linux-kernel, David S . Miller, netdev,
	Joel Stanley, Michael Ellerman, Stephen Rothwell, Linus Torvalds,
	Arnd Bergmann, Guenter Roeck

Use the architecture independent Kconfig option PAGE_SIZE_LESS_THAN_64KB
to indicate that VMXNET3 requires a page size smaller than 64kB.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v3: Added patch to make VMXNET3 page size dependency architecture
    independent

 drivers/net/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 10506a4b66ef..6cccc3dc00bc 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -567,9 +567,7 @@ config XEN_NETDEV_BACKEND
 config VMXNET3
 	tristate "VMware VMXNET3 ethernet driver"
 	depends on PCI && INET
-	depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \
-		     IA64_PAGE_SIZE_64KB || PARISC_PAGE_SIZE_64KB || \
-		     PPC_64K_PAGES)
+	depends on PAGE_SIZE_LESS_THAN_64KB
 	help
 	  This driver supports VMware's vmxnet3 virtual ethernet NIC.
 	  To compile this driver as a module, choose M here: the
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k
  2021-11-27 15:44 [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Guenter Roeck
                   ` (2 preceding siblings ...)
  2021-11-27 15:44 ` [PATCH v3 3/3] vmxnet3: Use generic Kconfig option for page size limit Guenter Roeck
@ 2021-11-27 17:49 ` Linus Torvalds
  2021-11-27 22:26   ` Guenter Roeck
  3 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2021-11-27 17:49 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Anton Altaparmakov, linux-ntfs-dev, Linux Kernel Mailing List,
	David S . Miller, Netdev, Joel Stanley, Michael Ellerman,
	Stephen Rothwell, Arnd Bergmann

On Sat, Nov 27, 2021 at 7:44 AM Guenter Roeck <linux@roeck-us.net> wrote:
>
> This is the third attempt to fix the following build error.

Thanks, looks good to me.

Should I apply the patches directly, or were you planning on sending a
pull request when everybody was happy with it?

           Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k
  2021-11-27 17:49 ` [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Linus Torvalds
@ 2021-11-27 22:26   ` Guenter Roeck
  2021-11-27 22:31     ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2021-11-27 22:26 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Anton Altaparmakov, linux-ntfs-dev, Linux Kernel Mailing List,
	David S . Miller, Netdev, Joel Stanley, Michael Ellerman,
	Stephen Rothwell, Arnd Bergmann

On 11/27/21 9:49 AM, Linus Torvalds wrote:
> On Sat, Nov 27, 2021 at 7:44 AM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> This is the third attempt to fix the following build error.
> 
> Thanks, looks good to me.
> 
> Should I apply the patches directly, or were you planning on sending a
> pull request when everybody was happy with it?
> 

Either way is fine with me. Either apply it now and have it fixed in -rc3,
or we can wait for a few days and I'll send you a pull request if there
are no objections by, say, Wednesday.

Guenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k
  2021-11-27 22:26   ` Guenter Roeck
@ 2021-11-27 22:31     ` Linus Torvalds
  2021-11-27 22:44       ` Anton Altaparmakov
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2021-11-27 22:31 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Anton Altaparmakov, linux-ntfs-dev, Linux Kernel Mailing List,
	David S . Miller, Netdev, Joel Stanley, Michael Ellerman,
	Stephen Rothwell, Arnd Bergmann

On Sat, Nov 27, 2021 at 2:26 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> Either way is fine with me. Either apply it now and have it fixed in -rc3,
> or we can wait for a few days and I'll send you a pull request if there
> are no objections by, say, Wednesday.

I'll just take the patches as-is and we can leave this issue behind us
(knock wood).

Thanks,

           Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k
  2021-11-27 22:31     ` Linus Torvalds
@ 2021-11-27 22:44       ` Anton Altaparmakov
  0 siblings, 0 replies; 8+ messages in thread
From: Anton Altaparmakov @ 2021-11-27 22:44 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Guenter Roeck, linux-ntfs-dev, Linux Kernel Mailing List,
	David S . Miller, Netdev, Joel Stanley, Michael Ellerman,
	Stephen Rothwell, Arnd Bergmann

Hi Linus, Guenter,

> On 27 Nov 2021, at 22:31, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Sat, Nov 27, 2021 at 2:26 PM Guenter Roeck <linux@roeck-us.net> wrote:
>> 
>> Either way is fine with me. Either apply it now and have it fixed in -rc3,
>> or we can wait for a few days and I'll send you a pull request if there
>> are no objections by, say, Wednesday.
> 
> I'll just take the patches as-is and we can leave this issue behind us
> (knock wood).

That sounds good, thank you!

Best regards,

	Anton

> Thanks,
> 
>           Linus

-- 
Anton Altaparmakov <anton at tuxera.com> (replace at with @)
Lead in File System Development, Tuxera Inc., http://www.tuxera.com/
Linux NTFS maintainer


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-27 22:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 15:44 [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Guenter Roeck
2021-11-27 15:44 ` [PATCH v3 1/3] arch: Add generic Kconfig option indicating page size " Guenter Roeck
2021-11-27 15:44 ` [PATCH v3 2/3] fs: ntfs: Limit NTFS_RW to page sizes " Guenter Roeck
2021-11-27 15:44 ` [PATCH v3 3/3] vmxnet3: Use generic Kconfig option for page size limit Guenter Roeck
2021-11-27 17:49 ` [PATCH v3 0/3] Limit NTFS_RW to page sizes smaller than 64k Linus Torvalds
2021-11-27 22:26   ` Guenter Roeck
2021-11-27 22:31     ` Linus Torvalds
2021-11-27 22:44       ` Anton Altaparmakov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.