Skip to contentSkip to conversation

arm64: increase command line size to 2048

PATCH Applied Munehisa Kamata 2 participants 6 messages Jun 26, 2018 – Jun 29, 2018

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

PATCH 1/2 arm64: increase command line size to 2048

Otherwise, we can hit the current 512 chars limit before hitting the Linux kernel's one, where allows 2048 chars in arm64.

---
 kexec/arch/arm64/kexec-arm64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/arm64/kexec-arm64.h +1 -1
index bf724ef..22e4b69 100644
@@ -15,7 +15,7 @@
 
 #define BOOT_BLOCK_VERSION 17
 #define BOOT_BLOCK_LAST_COMP_VERSION 16
-#define COMMAND_LINE_SIZE 512
+#define COMMAND_LINE_SIZE 2048 /* from kernel */
 
 #define KiB(x) ((x) * 1024UL)
 #define MiB(x) (KiB(x) * 1024UL)
Signature · 7 lines
2.7.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

PATCH 2/2 arm64: error out if kernel command line is too long

Currently, in arm64, kexec silently truncates kernel command line longer than COMMAND_LINE_SIZE - 1. Error out in that case as some other architectures already do that. The error message is copied from x86_64.

---
 kexec/arch/arm64/kexec-arm64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
kexec/arch/arm64/kexec-arm64.c +8 -1
index 62f3758..8200064 100644
@@ -536,8 +536,15 @@ int arm64_load_other_segments(struct kexec_info *info,
 	char command_line[COMMAND_LINE_SIZE] = "";
 
 	if (arm64_opts.command_line) {
+		if (strlen(arm64_opts.command_line) >
+		    sizeof(command_line) - 1) {
+			fprintf(stderr,
+				"Kernel command line too long for kernel!\n");
+			return EFAILED;
+		}
+
 		strncpy(command_line, arm64_opts.command_line,
-			sizeof(command_line));
+			sizeof(command_line) - 1);
 		command_line[sizeof(command_line) - 1] = 0;
 	}
 
Signature · 7 lines
2.7.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] arm64: error out if kernel command line is too long

Quoted 9 lines · Munehisa Kamata

Currently, in arm64, kexec silently truncates kernel command line longer than COMMAND_LINE_SIZE - 1. Error out in that case as some other architectures already do that. The error message is copied from x86_64.

---
 kexec/arch/arm64/kexec-arm64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Hi,

This looks fine to me but I will wait to see if there are other reviews before applying.

Quoted 32 lines
kexec/arch/arm64/kexec-arm64.c +8 -1
index 62f3758..8200064 100644
@@ -536,8 +536,15 @@ int arm64_load_other_segments(struct kexec_info *info,
 	char command_line[COMMAND_LINE_SIZE] = "";
 
 	if (arm64_opts.command_line) {
+		if (strlen(arm64_opts.command_line) >
+		    sizeof(command_line) - 1) {
 
+			fprintf(stderr,
+				"Kernel command line too long for kernel!\n");
+			return EFAILED;
+		}
+
 		strncpy(command_line, arm64_opts.command_line,
-			sizeof(command_line));
+			sizeof(command_line) - 1);
 		command_line[sizeof(command_line) - 1] = 0;
 	}
Signature · 8 lines
-- 
2.7.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#3 lore raw

Re: [PATCH 2/2] arm64: error out if kernel command line is too long

Quoted 12 lines · Simon Horman
Quoted 9 lines · Munehisa Kamata

Currently, in arm64, kexec silently truncates kernel command line longer than COMMAND_LINE_SIZE - 1. Error out in that case as some other architectures already do that. The error message is copied from x86_64.

---
 kexec/arch/arm64/kexec-arm64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Quoted 6 lines

Hi,

This looks fine to me but I will wait to see if there are other reviews before applying.

Thanks, applied.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Reviewed-by on v1 1/2
#4 lore raw
In reply to Munehisa Kamata
Quoted 4 lines · Munehisa Kamata

Otherwise, we can hit the current 512 chars limit before hitting the Linux kernel's one, where allows 2048 chars in arm64.

Hi,

This looks fine to me but I will wait to see if there are other reviews before applying.

Quoted 26 lines
---
 kexec/arch/arm64/kexec-arm64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/arm64/kexec-arm64.h +1 -1
index bf724ef..22e4b69 100644
@@ -15,7 +15,7 @@
 
 #define BOOT_BLOCK_VERSION 17
 #define BOOT_BLOCK_LAST_COMP_VERSION 16
-#define COMMAND_LINE_SIZE 512
+#define COMMAND_LINE_SIZE 2048 /* from kernel */
 
 #define KiB(x) ((x) * 1024UL)
 #define MiB(x) (KiB(x) * 1024UL)
Signature · 7 lines
2.7.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#5 lore raw
Quoted 4 lines · Simon Horman
Quoted 3 lines · Munehisa Kamata

Otherwise, we can hit the current 512 chars limit before hitting the Linux kernel's one, where allows 2048 chars in arm64.

Quoted 8 lines
Quoted 1 line

Hi,

This looks fine to me but I will wait to see if there are other reviews before applying.

Thanks, applied.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec