linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/1] ARM hangs on boot with CONFIG_FORTIFY_SOURCE and ATAGs
@ 2021-08-19  2:21 bfgithub
  2021-08-19  2:21 ` [PATCH v1 1/1] Set cmdline array size to COMMAND_LINE_SIZE bfgithub
  0 siblings, 1 reply; 2+ messages in thread
From: bfgithub @ 2021-08-19  2:21 UTC (permalink / raw)
  To: linux, linux-arm-kernel; +Cc: Berto Furth

From: Berto Furth <bfgithub@veryspeedy.net>

ARM may hang on boot with ATAGS and CONFIG_FORTIFY_SOURCE.


An ARM 32 device may hang on boot after the

Uncompressing Linux... done, booting the kernel.

message if the bootloader passes a command line via ATAG to the
kernel and CONFIG_FORTIFY_SOURCE is enabled.

Workaround : Disable CONFIG_FORTIFY_SOURCE in kernel build options.

Details : I am trying to build v5.14.0-rc5 for an old 32 bit arm NAS
system (Cavium CNS3420 based Seagate Central).

The embedded u-boot bootloader on this system is very old and uses
ATAGs to pass parameters to the kernel.

I am confident that the hang problem is occurring because of the
fortified string functions which check the declared size of string
objects before working with them.

My tests show that when booting using kernel v4.19.195 (which does not
have fortified string functions) or with kernel v5.14.0-rc5 with
CONFIG_FORTIFY_SOURCE disabled, that the system does not hang on boot.

Berto Furth (1):
  Make cmdline ATAG work with fortified string fn

 arch/arm/include/uapi/asm/setup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: d6d09a6942050f21b065a134169002b4d6b701ef
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 1/1] Set cmdline array size to COMMAND_LINE_SIZE
  2021-08-19  2:21 [PATCH v1 0/1] ARM hangs on boot with CONFIG_FORTIFY_SOURCE and ATAGs bfgithub
@ 2021-08-19  2:21 ` bfgithub
  0 siblings, 0 replies; 2+ messages in thread
From: bfgithub @ 2021-08-19  2:21 UTC (permalink / raw)
  To: linux, linux-arm-kernel; +Cc: Berto Furth

From: Berto Furth <bfgithub@veryspeedy.net>

Use maximum size in declaration of ATAG cmdline string.

The declaration of the cmdline string in the ATAG type tag_cmdline
uses an array size of 1. This means that the fortified versions of
string functions (like strlcpy) will panic when they see that the
actual contents of the cmdline string are bigger than 1 byte.

Fix is to simply indicate that the string can actually be up to
COMMAND_LINE_SIZE bytes by setting the array size as such.

Signed-off-by: Berto Furth <bfgithub@veryspeedy.net>
Tested-by: Berto Furth <bfgithub@veryspeedy.net>
---
 arch/arm/include/uapi/asm/setup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h
index 25ceda63b284..9c88c919467b 100644
--- a/arch/arm/include/uapi/asm/setup.h
+++ b/arch/arm/include/uapi/asm/setup.h
@@ -124,7 +124,7 @@ struct tag_videolfb {
 #define ATAG_CMDLINE	0x54410009
 
 struct tag_cmdline {
-	char	cmdline[1];	/* this is the minimum size */
+	char	cmdline[COMMAND_LINE_SIZE];
 };
 
 /* acorn RiscPC specific information */
-- 
2.32.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-08-19  2:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19  2:21 [PATCH v1 0/1] ARM hangs on boot with CONFIG_FORTIFY_SOURCE and ATAGs bfgithub
2021-08-19  2:21 ` [PATCH v1 1/1] Set cmdline array size to COMMAND_LINE_SIZE bfgithub

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).