All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: increase command line size to 2048
@ 2018-06-26 19:47 Munehisa Kamata
  2018-06-26 19:47 ` [PATCH 2/2] arm64: error out if kernel command line is too long Munehisa Kamata
  2018-06-27  6:49 ` [PATCH 1/2] arm64: increase command line size to 2048 Simon Horman
  0 siblings, 2 replies; 6+ messages in thread
From: Munehisa Kamata @ 2018-06-26 19:47 UTC (permalink / raw)
  To: kexec; +Cc: Munehisa Kamata

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

Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
---
 kexec/arch/arm64/kexec-arm64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
index bf724ef..22e4b69 100644
--- a/kexec/arch/arm64/kexec-arm64.h
+++ b/kexec/arch/arm64/kexec-arm64.h
@@ -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)
-- 
2.7.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* [PATCH 2/2] arm64: error out if kernel command line is too long
  2018-06-26 19:47 [PATCH 1/2] arm64: increase command line size to 2048 Munehisa Kamata
@ 2018-06-26 19:47 ` Munehisa Kamata
  2018-06-27  6:51   ` Simon Horman
  2018-06-27  6:49 ` [PATCH 1/2] arm64: increase command line size to 2048 Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Munehisa Kamata @ 2018-06-26 19:47 UTC (permalink / raw)
  To: kexec; +Cc: 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.

Suggested-by: Tom Kirchner <tjk@amazon.com>
Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
---
 kexec/arch/arm64/kexec-arm64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
index 62f3758..8200064 100644
--- a/kexec/arch/arm64/kexec-arm64.c
+++ b/kexec/arch/arm64/kexec-arm64.c
@@ -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;
 	}
 
-- 
2.7.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 1/2] arm64: increase command line size to 2048
  2018-06-26 19:47 [PATCH 1/2] arm64: increase command line size to 2048 Munehisa Kamata
  2018-06-26 19:47 ` [PATCH 2/2] arm64: error out if kernel command line is too long Munehisa Kamata
@ 2018-06-27  6:49 ` Simon Horman
  2018-06-29 14:43   ` Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2018-06-27  6:49 UTC (permalink / raw)
  To: Munehisa Kamata; +Cc: kexec

On Tue, Jun 26, 2018 at 12:47:28PM -0700, Munehisa Kamata wrote:
> Otherwise, we can hit the current 512 chars limit before hitting the
> Linux kernel's one, where allows 2048 chars in arm64.
> 
> Signed-off-by: Munehisa Kamata <kamatam@amazon.com>

Hi,

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

Reviewed-by: Simon Horman <horms@verge.net.au>

> ---
>  kexec/arch/arm64/kexec-arm64.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
> index bf724ef..22e4b69 100644
> --- a/kexec/arch/arm64/kexec-arm64.h
> +++ b/kexec/arch/arm64/kexec-arm64.h
> @@ -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)
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 2/2] arm64: error out if kernel command line is too long
  2018-06-26 19:47 ` [PATCH 2/2] arm64: error out if kernel command line is too long Munehisa Kamata
@ 2018-06-27  6:51   ` Simon Horman
  2018-06-29 14:43     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2018-06-27  6:51 UTC (permalink / raw)
  To: Munehisa Kamata; +Cc: kexec

On Tue, Jun 26, 2018 at 12:47:29PM -0700, Munehisa Kamata wrote:
> 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.
> 
> Suggested-by: Tom Kirchner <tjk@amazon.com>
> Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
> ---
>  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.

Reviewed-by: Simon Horman <horms@verge.net.au>

> 
> diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
> index 62f3758..8200064 100644
> --- a/kexec/arch/arm64/kexec-arm64.c
> +++ b/kexec/arch/arm64/kexec-arm64.c
> @@ -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;
>  	}
>  
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 1/2] arm64: increase command line size to 2048
  2018-06-27  6:49 ` [PATCH 1/2] arm64: increase command line size to 2048 Simon Horman
@ 2018-06-29 14:43   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2018-06-29 14:43 UTC (permalink / raw)
  To: Munehisa Kamata; +Cc: kexec

On Wed, Jun 27, 2018 at 08:49:47AM +0200, Simon Horman wrote:
> On Tue, Jun 26, 2018 at 12:47:28PM -0700, Munehisa Kamata wrote:
> > Otherwise, we can hit the current 512 chars limit before hitting the
> > Linux kernel's one, where allows 2048 chars in arm64.
> > 
> > Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
> 
> Hi,
> 
> This looks fine to me but I will wait to see if there are other reviews
> before applying.
> 
> Reviewed-by: Simon Horman <horms@verge.net.au>

Thanks, applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH 2/2] arm64: error out if kernel command line is too long
  2018-06-27  6:51   ` Simon Horman
@ 2018-06-29 14:43     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2018-06-29 14:43 UTC (permalink / raw)
  To: Munehisa Kamata; +Cc: kexec

On Wed, Jun 27, 2018 at 08:51:25AM +0200, Simon Horman wrote:
> On Tue, Jun 26, 2018 at 12:47:29PM -0700, Munehisa Kamata wrote:
> > 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.
> > 
> > Suggested-by: Tom Kirchner <tjk@amazon.com>
> > Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
> > ---
> >  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.
> 
> Reviewed-by: Simon Horman <horms@verge.net.au>

Thanks, applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2018-06-29 14:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 19:47 [PATCH 1/2] arm64: increase command line size to 2048 Munehisa Kamata
2018-06-26 19:47 ` [PATCH 2/2] arm64: error out if kernel command line is too long Munehisa Kamata
2018-06-27  6:51   ` Simon Horman
2018-06-29 14:43     ` Simon Horman
2018-06-27  6:49 ` [PATCH 1/2] arm64: increase command line size to 2048 Simon Horman
2018-06-29 14:43   ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.