Re: [PATCH 4.19 094/105] parisc: Increase size of gcc stack frame check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/5/22 20:27, Arnd Bergmann wrote:
On Mon, Dec 5, 2022, at 20:10, Greg Kroah-Hartman wrote:
From: Helge Deller <deller@xxxxxx>

[ Upstream commit 55b70eed81cba1331773d4aaf5cba2bb07475cd8 ]

parisc uses much bigger frames than other architectures, so increase the
stack frame check value to avoid compiler warnings.

I had not seen this one originally, commenting on it now:

Hi Arnd,
Thanks for commenting!
By the way, those patches went in for 5.16 kernel, so I nearly forgot
about them in the meantime and wonder why they pop up now... (they weren't
tagged for stable, but I think it's ok to push them backwards).

index 9ded3c1f68eb..556aae95d69b 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -224,7 +224,7 @@ config FRAME_WARN
  	range 0 8192
  	default 3072 if KASAN_EXTRA
  	default 2048 if GCC_PLUGIN_LATENT_ENTROPY
-	default 1280 if (!64BIT && PARISC)
+	default 1536 if (!64BIT && PARISC)
  	default 1024 if (!64BIT && !PARISC)

1536 is a /lot/ when we're dealing with 32-bit platforms.

True.
It's actually 2048 bytes in the meantime, see commit
8d192bec534bd5b778135769a12e5f04580771f7

My understanding of the parisc overhead was that this
was just based on a few bytes per function call,

What exactly do you mean by a few bytes?
On parisc the frame size is a multiple of 64-bytes (on 32-bit)
and 128 bytes (on 64bit).
For function calls with more than 5 (need to check exact number)
parameters those will be put on the stack as well.

not something that makes everything bigger. We have a few functions
that get close to the normal 1024 byte limit, everything else should
be no more than a few hundred bytes on any architecture.

Sadly not on parisc.
Again, see commit message of 8d192bec534b, which mentions
compile warnings from the kernel test robot for lib/xxhash.c.

Could it be that this only happens when KASAN or some
other feature is enabled?

No, it happens even without KASAN or such.

If this happens for normal parisc builds without any
special compilation options, that would indicate that the
compiler is very broken.

No, it does a good job. It's the ABI which requires so big stacks.
I see problems with some userspace apps as well which configure too
small stacks.

By the way, since those patches are in I don't see any stack
overflows any longer. Those happened rarely in the past though.

Helge




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux