* [PATCH] mtdchar: mark bits of ioctl handler noinline
@ 2023-04-17 20:56 Arnd Bergmann
2023-04-17 21:20 ` Richard Weinberger
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-04-17 20:56 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Michał Kępień
Cc: Arnd Bergmann, linux-mtd, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The addition of the mtdchar_read_ioctl() function caused the stack usage
of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures
with gcc-13:
drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl':
drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Mark both the read and write portions as noinline_for_stack to ensure
they don't get inlined and use separate stack slots to reduce the
maximum usage, both in the mtdchar_ioctl() and combined with any
of its callees.
Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mtd/mtdchar.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 01f1c6792df9..8dc4f5c493fc 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start,
(end_page - start_page + 1) * oob_per_page);
}
-static int mtdchar_write_ioctl(struct mtd_info *mtd,
- struct mtd_write_req __user *argp)
+static noinline_for_stack int
+mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp)
{
struct mtd_info *master = mtd_get_master(mtd);
struct mtd_write_req req;
@@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd,
return ret;
}
-static int mtdchar_read_ioctl(struct mtd_info *mtd,
- struct mtd_read_req __user *argp)
+static noinline_for_stack int
+mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp)
{
struct mtd_info *master = mtd_get_master(mtd);
struct mtd_read_req req;
--
2.39.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtdchar: mark bits of ioctl handler noinline
2023-04-17 20:56 [PATCH] mtdchar: mark bits of ioctl handler noinline Arnd Bergmann
@ 2023-04-17 21:20 ` Richard Weinberger
2023-05-22 15:46 ` Miquel Raynal
2023-05-23 13:43 ` Miquel Raynal
2 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2023-04-17 21:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Miquel Raynal, Vignesh Raghavendra, Michał Kępień,
Arnd Bergmann, linux-mtd, linux-kernel
----- Ursprüngliche Mail -----
> Von: "Arnd Bergmann" <arnd@kernel.org>
> The addition of the mtdchar_read_ioctl() function caused the stack usage
> of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures
> with gcc-13:
>
> drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl':
> drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than
> 1024 bytes [-Werror=frame-larger-than=]
>
> Mark both the read and write portions as noinline_for_stack to ensure
> they don't get inlined and use separate stack slots to reduce the
> maximum usage, both in the mtdchar_ioctl() and combined with any
> of its callees.
>
> Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtdchar: mark bits of ioctl handler noinline
2023-04-17 20:56 [PATCH] mtdchar: mark bits of ioctl handler noinline Arnd Bergmann
2023-04-17 21:20 ` Richard Weinberger
@ 2023-05-22 15:46 ` Miquel Raynal
2023-05-23 12:14 ` Arnd Bergmann
2023-05-23 13:43 ` Miquel Raynal
2 siblings, 1 reply; 5+ messages in thread
From: Miquel Raynal @ 2023-05-22 15:46 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Richard Weinberger, Vignesh Raghavendra,
Michał Kępień, Arnd Bergmann, linux-mtd,
linux-kernel
Hi Arnd,
arnd@kernel.org wrote on Mon, 17 Apr 2023 22:56:50 +0200:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The addition of the mtdchar_read_ioctl() function caused the stack usage
> of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures
> with gcc-13:
>
> drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl':
> drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> Mark both the read and write portions as noinline_for_stack to ensure
> they don't get inlined and use separate stack slots to reduce the
> maximum usage, both in the mtdchar_ioctl() and combined with any
> of its callees.
>
> Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I am about to take this as part of my next fixes PR, should we Cc:
stable? What is the current policy wrt gcc version issues?
> ---
> drivers/mtd/mtdchar.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
> index 01f1c6792df9..8dc4f5c493fc 100644
> --- a/drivers/mtd/mtdchar.c
> +++ b/drivers/mtd/mtdchar.c
> @@ -590,8 +590,8 @@ static void adjust_oob_length(struct mtd_info *mtd, uint64_t start,
> (end_page - start_page + 1) * oob_per_page);
> }
>
> -static int mtdchar_write_ioctl(struct mtd_info *mtd,
> - struct mtd_write_req __user *argp)
> +static noinline_for_stack int
> +mtdchar_write_ioctl(struct mtd_info *mtd, struct mtd_write_req __user *argp)
> {
> struct mtd_info *master = mtd_get_master(mtd);
> struct mtd_write_req req;
> @@ -688,8 +688,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd,
> return ret;
> }
>
> -static int mtdchar_read_ioctl(struct mtd_info *mtd,
> - struct mtd_read_req __user *argp)
> +static noinline_for_stack int
> +mtdchar_read_ioctl(struct mtd_info *mtd, struct mtd_read_req __user *argp)
> {
> struct mtd_info *master = mtd_get_master(mtd);
> struct mtd_read_req req;
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtdchar: mark bits of ioctl handler noinline
2023-05-22 15:46 ` Miquel Raynal
@ 2023-05-23 12:14 ` Arnd Bergmann
0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-05-23 12:14 UTC (permalink / raw)
To: Miquel Raynal, Arnd Bergmann
Cc: Richard Weinberger, Vignesh Raghavendra,
Michał Kępień, linux-mtd, linux-kernel
On Mon, May 22, 2023, at 17:46, Miquel Raynal wrote:
>
> I am about to take this as part of my next fixes PR, should we Cc:
> stable? What is the current policy wrt gcc version issues?
I think in general we do want stable kernels to work with the latest
gcc, so please add the Cc:stable annotation.
Arnd
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtdchar: mark bits of ioctl handler noinline
2023-04-17 20:56 [PATCH] mtdchar: mark bits of ioctl handler noinline Arnd Bergmann
2023-04-17 21:20 ` Richard Weinberger
2023-05-22 15:46 ` Miquel Raynal
@ 2023-05-23 13:43 ` Miquel Raynal
2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2023-05-23 13:43 UTC (permalink / raw)
To: Arnd Bergmann, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Michał Kępień
Cc: Arnd Bergmann, linux-mtd, linux-kernel
On Mon, 2023-04-17 at 20:56:50 UTC, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The addition of the mtdchar_read_ioctl() function caused the stack usage
> of mtdchar_ioctl() to grow beyond the warning limit on 32-bit architectures
> with gcc-13:
>
> drivers/mtd/mtdchar.c: In function 'mtdchar_ioctl':
> drivers/mtd/mtdchar.c:1229:1: error: the frame size of 1488 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> Mark both the read and write portions as noinline_for_stack to ensure
> they don't get inlined and use separate stack slots to reduce the
> maximum usage, both in the mtdchar_ioctl() and combined with any
> of its callees.
>
> Fixes: 095bb6e44eb1 ("mtdchar: add MEMREAD ioctl")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Richard Weinberger <richard@nod.at>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-23 13:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 20:56 [PATCH] mtdchar: mark bits of ioctl handler noinline Arnd Bergmann
2023-04-17 21:20 ` Richard Weinberger
2023-05-22 15:46 ` Miquel Raynal
2023-05-23 12:14 ` Arnd Bergmann
2023-05-23 13:43 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).