Skip to contentSkip to conversation

fs: ntfs: Disable NTFS_RW for PPC

PATCH In review Guenter Roeck 3 participants 5 messages Nov 22, 2021 – Nov 23, 2021 NTFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs: ntfs: Disable NTFS_RW for PPC

NTFS_RW code allocates page size dependent arrays on the stack. This results in build failures if the page size is 64k, which is now the default for PPC.

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

Increasing the maximum frame size for PPC just to silence this error does not really help. It would have to be set to a really large value for 256k pages. Such a large frame size could potentially result in stack overruns in this code and elsewhere and is therefore not desirable. Disable NTFS_RW for PPC instead.

Cc Michael Ellerman <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Linus Torvalds <[email protected]>

---
v2: Introduce new configuration flag DISABLE_NTFS_RW and use it to disable NTFS_RW
for PPC

 fs/ntfs/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
fs/ntfs/Kconfig +5 -0
index 1667a7e590d8..324224febb6a 100644
@@ -49,8 +49,13 @@ config NTFS_DEBUG
 	  When reporting bugs, please try to have available a full dump of
 	  debugging messages while the misbehaviour was occurring.
 
+config DISABLE_NTFS_RW
+	bool
+	default y if PPC
+
 config NTFS_RW
 	bool "NTFS write support"
+	depends on !DISABLE_NTFS_RW
 	depends on NTFS_FS
 	help
 	  This enables the partial, but safe, write support in the NTFS driver.
Signature · 1 line
2.33.0
#1 lore raw
Quoted 4 lines · Guenter Roeck

NTFS_RW code allocates page size dependent arrays on the stack. This results in build failures if the page size is 64k, which is now the default for PPC.

It became the default for PPC_BOOK3S_64, which doesn't include all of PPC, in f22969a66041 ("powerpc/64s: Default to 64K pages for 64 bit book3s").

You might want to add a mention of this commit in your commit message.

Quoted 27 lines

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

Increasing the maximum frame size for PPC just to silence this error does not really help. It would have to be set to a really large value for 256k pages. Such a large frame size could potentially result in stack overruns in this code and elsewhere and is therefore not desirable. Disable NTFS_RW for PPC instead.

Cc Michael Ellerman <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Linus Torvalds <[email protected]>

---
v2: Introduce new configuration flag DISABLE_NTFS_RW and use it to disable NTFS_RW
for PPC

 fs/ntfs/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)
fs/ntfs/Kconfig +0 -0
index 1667a7e590d8..324224febb6a 100644

fs/ntfs/Kconfig config NTFS_DEBUG · line 54

Quoted 6 lines
fs/ntfs/Kconfig +3 -0
@@ -49,8 +49,13 @@ config NTFS_DEBUG
          When reporting bugs, please try to have available a full dump of
          debugging messages while the misbehaviour was occurring.
 
+config DISABLE_NTFS_RW
+       bool
+       default y if PPC

PPC_64K_PAGES would be more accurate.

I think arm64 was seeing a similar build error, so you could include ARM64_64K_PAGES as well?

Quoted 10 lines
fs/ntfs/Kconfig +2 -1
+
 config NTFS_RW
        bool "NTFS write support"
+       depends on !DISABLE_NTFS_RW
        depends on NTFS_FS
        help
          This enables the partial, but safe, write support in the NTFS driver.
--

2.33.0

#2 lore raw
Quoted 42 lines · Joel Stanley
Quoted 4 lines · Guenter Roeck

NTFS_RW code allocates page size dependent arrays on the stack. This results in build failures if the page size is 64k, which is now the default for PPC.

It became the default for PPC_BOOK3S_64, which doesn't include all of PPC, in f22969a66041 ("powerpc/64s: Default to 64K pages for 64 bit book3s").

You might want to add a mention of this commit in your commit message.

Quoted 30 lines

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

Increasing the maximum frame size for PPC just to silence this error does not really help. It would have to be set to a really large value for 256k pages. Such a large frame size could potentially result in stack overruns in this code and elsewhere and is therefore not desirable. Disable NTFS_RW for PPC instead.

Cc Michael Ellerman <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Linus Torvalds <[email protected]>

---
v2: Introduce new configuration flag DISABLE_NTFS_RW and use it to disable NTFS_RW
for PPC

  fs/ntfs/Kconfig | 5 +++++
  1 file changed, 5 insertions(+)
fs/ntfs/Kconfig +0 -0
index 1667a7e590d8..324224febb6a 100644
@@ -49,8 +49,13 @@ config NTFS_DEBUG
           When reporting bugs, please try to have available a full dump of
           debugging messages while the misbehaviour was occurring.
 
Quoted 9 lines

fs/ntfs/Kconfig config NTFS_DEBUG · line 54

Quoted 3 lines
fs/ntfs/Kconfig +3 -0
+config DISABLE_NTFS_RW
+       bool
+       default y if PPC

PPC_64K_PAGES would be more accurate.

I think arm64 was seeing a similar build error, so you could include ARM64_64K_PAGES as well?

Yes, you are correct.

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

Ok, I'll do that. And, digging for it, I see

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)

That adds hexagon, ia64, mips, parisc, and sh to the list of affected architectures. Plus, of course, there is PAGE_SIZE_256KB and PPC_256K_PAGES.

So we are looking for something like

config DISABLE_NTFS_RW

	bool
	default y if PAGE_SIZE_256KB || PPC_256K_PAGES || \
		PAGE_SIZE_64KB || ARM64_64K_PAGES || IA64_PAGE_SIZE_64KB || \
		PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES

Anything else ?

Guenter

Quoted 10 lines
Quoted 10 lines
fs/ntfs/Kconfig +2 -1
+
  config NTFS_RW
         bool "NTFS write support"
+       depends on !DISABLE_NTFS_RW
         depends on NTFS_FS
         help
           This enables the partial, but safe, write support in the NTFS driver.
--

2.33.0

#3 lore raw
Quoted 71 lines · Guenter Roeck
Quoted 42 lines · Joel Stanley
Quoted 4 lines · Guenter Roeck

NTFS_RW code allocates page size dependent arrays on the stack. This results in build failures if the page size is 64k, which is now the default for PPC.

It became the default for PPC_BOOK3S_64, which doesn't include all of PPC, in f22969a66041 ("powerpc/64s: Default to 64K pages for 64 bit book3s").

You might want to add a mention of this commit in your commit message.

Quoted 30 lines

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

Increasing the maximum frame size for PPC just to silence this error does not really help. It would have to be set to a really large value for 256k pages. Such a large frame size could potentially result in stack overruns in this code and elsewhere and is therefore not desirable. Disable NTFS_RW for PPC instead.

Cc Michael Ellerman <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Linus Torvalds <[email protected]>

---
v2: Introduce new configuration flag DISABLE_NTFS_RW and use it to disable NTFS_RW
for PPC

  fs/ntfs/Kconfig | 5 +++++
  1 file changed, 5 insertions(+)
fs/ntfs/Kconfig +0 -0
index 1667a7e590d8..324224febb6a 100644
@@ -49,8 +49,13 @@ config NTFS_DEBUG
           When reporting bugs, please try to have available a full dump of
           debugging messages while the misbehaviour was occurring.
 
Quoted 9 lines

fs/ntfs/Kconfig config NTFS_DEBUG · line 54

Quoted 3 lines
fs/ntfs/Kconfig +3 -0
+config DISABLE_NTFS_RW
+       bool
+       default y if PPC

PPC_64K_PAGES would be more accurate.

I think arm64 was seeing a similar build error, so you could include ARM64_64K_PAGES as well?

Yes, you are correct.

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

Ok, I'll do that. And, digging for it, I see

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)

That adds hexagon, ia64, mips, parisc, and sh to the list of affected architectures. Plus, of course, there is PAGE_SIZE_256KB and PPC_256K_PAGES.

So we are looking for something like

Quoted 7 lines

config DISABLE_NTFS_RW

	bool
	default y if PAGE_SIZE_256KB || PPC_256K_PAGES || \
		PAGE_SIZE_64KB || ARM64_64K_PAGES || IA64_PAGE_SIZE_64KB || \
		PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES

Anything else ?

Can we do something like this instead?

I'm pretty sure it does what we want for NTFS, and also for VMXNET3.

It is not pretty, but at least keeps the arch specifics out of driver Kconfigs.

cheers

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
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.
 
#4 lore raw

On Tue, Nov 23, 2021 at 10:43:48PM +1100, Michael Ellerman wrote:
[ ... ]

Quoted 29 lines
Quoted 10 lines

So we are looking for something like

config DISABLE_NTFS_RW

	bool
	default y if PAGE_SIZE_256KB || PPC_256K_PAGES || \
		PAGE_SIZE_64KB || ARM64_64K_PAGES || IA64_PAGE_SIZE_64KB || \
		PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES

Anything else ?

Can we do something like this instead?

I'm pretty sure it does what we want for NTFS, and also for VMXNET3.

It is not pretty, but at least keeps the arch specifics out of driver Kconfigs.

cheers

arch/Kconfig +0 -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.
 

arch/Kconfig config HAVE_ARCH_COMPAT_MMAP_BASES · line 1003

Quoted 10 lines
arch/Kconfig +10 -0
+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
+

Sure, works for me. I'll wait another day or two for additional feedback before sending out v3.

Guenter

Quoted 15 lines
arch/Kconfig +0 -0
 # 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
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.