kexec:i386/kexec-[bzImage|elf-x86]:x86_64/kexec-bzImage64: Use "\0" as command line instead of empty command line
Subsystems (2)
PATCH RESEND 1/1 kexec:i386/kexec-[bzImage|elf-x86]:x86_64/kexec-bzImage64: Use "\0" as command line instead of empty command line
This patch prevents the problems to happen below:
In setup_linux_bootloader_parameters_high
120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';
if cmdline_len == 0, Line 122 will corrupt kernel16 buf just before the commandline. And in do_bzImage_load, for example,
369 cmdline_end = setup_base + kern16_size_needed + command_line_len - 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end", &cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.
---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?
kexec/arch/i386/kexec-bzImage.c | 3 +++ kexec/arch/i386/kexec-elf-x86.c | 3 +++ kexec/arch/x86_64/kexec-bzImage64.c | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-)
kexec/arch/i386/kexec-bzImage.c +3 -0
@@ -435,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; } ramdisk_buf =0 ;if (ramdisk) {
kexec/arch/i386/kexec-elf-x86.c +3 -0
@@ -161,6 +161,9 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; }/* Need to append some command line parameters internally in case of
kexec/arch/x86_64/kexec-bzImage64.c +5 -1
@@ -284,8 +284,12 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len, } command_line =concat_cmdline (command_line, append); command_line_len =0 ; -if (command_line) +if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; + } ramdisk_buf =0 ;if (ramdisk) ramdisk_buf =slurp_file (ramdisk, &ramdisk_length);
Signature · 6 lines
1.7.12.4.dirty _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 13 lines · Wang YanQing
This patch prevents the problems to happen below:
Insetup_linux_bootloader_parameters_high120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';if
cmdline_len== 0, Line 122 will corrupt kernel16 buf just before the commandline. And indo_bzImage_load, for example,
369cmdline_end=setup_base+kern16_size_needed+command_line_len- 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end",&cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.
Quoted 4 lines
Signed-off-by Wang YanQing <[email protected]>---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?
Yeah.
Hi Simon, could you please take a look at this to see if the change is reasonable? After all, if no commadline, we make the commandline_len to 1. I don't know if this behaviour could be accepted by you.
Thanks
Zhang
Quoted 42 lines
kexec/arch/i386/kexec-bzImage.c | 3 +++ kexec/arch/i386/kexec-elf-x86.c | 3 +++ kexec/arch/x86_64/kexec-bzImage64.c | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-)kexec/arch/i386/kexec-bzImage.c +3
-0@@ -435,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; } ramdisk_buf =0 ;if (ramdisk) {kexec/arch/i386/kexec-elf-x86.c +3
-0@@ -161,6 +161,9 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; }/* Need to append some command line parameters internally in case of kexec/arch/x86_64/kexec-bzImage64.c +0
-0@@ -284,8 +284,12 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len, } command_line =concat_cmdline (command_line, append); command_line_len =0 ;
kexec/arch/x86_64/kexec-bzImage64.c int bzImage64_load(int argc, char **argv, const char *buf, off_t len, · line 295
Quoted 10 lines
kexec/arch/x86_64/kexec-bzImage64.c +5
-1-if (command_line) +if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; + } ramdisk_buf =0 ;if (ramdisk) ramdisk_buf =slurp_file (ramdisk, &ramdisk_length);
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 19 lines · Zhang Yanfei
Quoted 13 lines · Wang YanQing
This patch prevents the problems to happen below:
Insetup_linux_bootloader_parameters_high120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';if
cmdline_len== 0, Line 122 will corrupt kernel16 buf just before the commandline. And indo_bzImage_load, for example,
369cmdline_end=setup_base+kern16_size_needed+command_line_len- 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end",&cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.Quoted 4 lines
Signed-off-by Wang YanQing <[email protected]>---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?
Quoted 7 lines
Yeah.
Signed-off-by Zhang Yanfei <[email protected]>Hi Simon, could you please take a look at this to see if the change is reasonable? After all, if no commadline, we make the
commandline_lento 1. I don't know if this behaviour could be accepted by you.
I am now thinking that whether this way is reasonable or not...
Quoted 54 lines
Thanks
ZhangQuoted 50 lines
kexec/arch/i386/kexec-bzImage.c | 3 +++ kexec/arch/i386/kexec-elf-x86.c | 3 +++ kexec/arch/x86_64/kexec-bzImage64.c | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-)kexec/arch/i386/kexec-bzImage.c +3
-0@@ -435,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; } ramdisk_buf =0 ;if (ramdisk) {kexec/arch/i386/kexec-elf-x86.c +3
-0@@ -161,6 +161,9 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; }/* Need to append some command line parameters internally in case of kexec/arch/x86_64/kexec-bzImage64.c +5
-1@@ -284,8 +284,12 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len, } command_line =concat_cmdline (command_line, append); command_line_len =0 ; -if (command_line) +if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; + } ramdisk_buf =0 ;
Quoted 8 lines
kexec/arch/x86_64/kexec-bzImage64.c int bzImage64_load(int argc, char **argv, const char *buf, off_t len, · line 295
Quoted 2 lines
kexec/arch/x86_64/kexec-bzImage64.c +0
-0if (ramdisk) ramdisk_buf =slurp_file (ramdisk, &ramdisk_length);_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 19 lines · Zhang Yanfei
Quoted 13 lines · Wang YanQing
This patch prevents the problems to happen below:
Insetup_linux_bootloader_parameters_high120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';if
cmdline_len== 0, Line 122 will corrupt kernel16 buf just before the commandline. And indo_bzImage_load, for example,
369cmdline_end=setup_base+kern16_size_needed+command_line_len- 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end",&cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.Quoted 4 lines
Signed-off-by Wang YanQing <[email protected]>---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?
Quoted 8 lines
Yeah.
Signed-off-by Zhang Yanfei <[email protected]>Hi Simon, could you please take a look at this to see if the change is reasonable? After all, if no commadline, we make the
commandline_lento 1. I don't know if this behaviour could be accepted by you.
Hi Simon
What is your opinion about this patch?
Quoted 44 lines
Quoted 44 lines
kexec/arch/i386/kexec-bzImage.c | 3 +++ kexec/arch/i386/kexec-elf-x86.c | 3 +++ kexec/arch/x86_64/kexec-bzImage64.c | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-)kexec/arch/i386/kexec-bzImage.c +3
-0@@ -435,6 +435,9 @@ int bzImage_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; } ramdisk_buf =0 ;if (ramdisk) {kexec/arch/i386/kexec-elf-x86.c +3
-0@@ -161,6 +161,9 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, command_line_len =0 ;if (command_line) { command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; }/* Need to append some command line parameters internally in case of kexec/arch/x86_64/kexec-bzImage64.c +1
-1@@ -284,8 +284,12 @@ int bzImage64_load(int argc, char **argv, const char *buf, off_t len, } command_line =concat_cmdline (command_line, append); command_line_len =0 ; -if (command_line) +if (command_line) {
Quoted 9 lines
kexec/arch/x86_64/kexec-bzImage64.c int bzImage64_load(int argc, char **argv, const char *buf, off_t len, · line 295
Quoted 8 lines
kexec/arch/x86_64/kexec-bzImage64.c +4
-0command_line_len =strlen (command_line) +1 ; + }else { + command_line =strdup ("\0" ); + command_line_len =1 ; + } ramdisk_buf =0 ;if (ramdisk) ramdisk_buf =slurp_file (ramdisk, &ramdisk_length);
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 24 lines · Zhang Yanfei
Quoted 23 lines · Zhang Yanfei
Quoted 13 lines · Wang YanQing
This patch prevents the problems to happen below:
Insetup_linux_bootloader_parameters_high120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';if
cmdline_len== 0, Line 122 will corrupt kernel16 buf just before the commandline. And indo_bzImage_load, for example,
369cmdline_end=setup_base+kern16_size_needed+command_line_len- 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end",&cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.Quoted 4 lines
Signed-off-by Wang YanQing <[email protected]>---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?Yeah.
Signed-off-by Zhang Yanfei <[email protected]>
Quoted 8 lines
Quoted 4 lines
Hi Simon, could you please take a look at this to see if the change is reasonable? After all, if no commadline, we make the
commandline_lento 1. I don't know if this behaviour could be accepted by you.Hi Simon
What is your opinion about this patch?
It seems reasonable to me, I have applied it.
I have added your Signed-off-by. However, for reference: unless you are the maintainer or were involved in writing the patch I think an Acked-by or Tested-by would be more appropriate.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 32 lines · Simon Horman
Quoted 31 lines · Zhang Yanfei
Quoted 19 lines · Zhang Yanfei
Quoted 13 lines · Wang YanQing
This patch prevents the problems to happen below:
Insetup_linux_bootloader_parameters_high120 cmdline_ptr = ((char *)real_mode) + cmdline_offset; 121 memcpy(cmdline_ptr, cmdline, cmdline_len); 122 cmdline_ptr[cmdline_len - 1] = '\0';if
cmdline_len== 0, Line 122 will corrupt kernel16 buf just before the commandline. And indo_bzImage_load, for example,
369cmdline_end=setup_base+kern16_size_needed+command_line_len- 1;
370 elf_rel_set_symbol(&info->rhdr, "cmdline_end",&cmdline_end,
371 sizeof(unsigned long));
Line 369 will go wrong, too.Quoted 4 lines
Signed-off-by Wang YanQing <[email protected]>---
Hi Zhang Yanfei, could you give your signed-off-by to this patch?Quoted 8 lines
Yeah.
Signed-off-by Zhang Yanfei <[email protected]>Hi Simon, could you please take a look at this to see if the change is reasonable? After all, if no commadline, we make the
commandline_lento 1. I don't know if this behaviour could be accepted by you.Hi Simon
Quoted 8 lines
Quoted 1 line
What is your opinion about this patch?
It seems reasonable to me, I have applied it.
I have added your Signed-off-by. However, for reference: unless you are the maintainer or were involved in writing the patch I think an Acked-by or Tested-by would be more appropriate.
I added some codes in the mail when we discussed this patch, so I add my Signed-off-by.
Anyway, thanks for your reminding:-)
Thanks
Zhang
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec