Skip to contentSkip to conversation

Limit NTFS_RW to page sizes smaller than 64k

PATCH In review Guenter Roeck 3 participants 8 messages Nov 27, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Limit NTFS_RW to page sizes smaller than 64k

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.

#1 lore raw

PATCH v3 1/3 arch: Add generic Kconfig option indicating page size smaller than 64k

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.

---
v3: Added patch: declare new configuration flag in generic code

 arch/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/Kconfig +10 -0
index 26b8ed11639d..d3c4ab249e9c 100644
@@ -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
Signature · 1 line
2.33.0
#2 lore raw

PATCH v3 2/3 fs: ntfs: Limit NTFS_RW to page sizes smaller than 64k

In reply to 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.

---
v3: Use generic configuration flag
v2: More comprehensive dependencies

 fs/ntfs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
fs/ntfs/Kconfig +1 -0
index 1667a7e590d8..f93e69a61283 100644
@@ -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.
 
Signature · 1 line
2.33.0
#3 lore raw

PATCH v3 3/3 vmxnet3: Use generic Kconfig option for page size limit

In reply to Guenter Roeck

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

---
v3: Added patch to make VMXNET3 page size dependency architecture
independent

 drivers/net/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/Kconfig +1 -3
index 10506a4b66ef..6cccc3dc00bc 100644
@@ -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
Signature · 1 line
2.33.0
#4 lore raw
In reply to Guenter Roeck
Quoted 2 lines · Guenter Roeck

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

#5 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Guenter Roeck

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

#6 lore raw
Quoted 4 lines · Guenter Roeck

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

#7 lore raw

Hi Linus, Guenter,

Quoted 9 lines · Linus Torvalds
Quoted 4 lines · Guenter Roeck

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

Quoted 3 lines

Thanks,

Linus

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