Don't write undefined values to disk
Subsystems (2)
PATCH 1/1 Don't write undefined values to disk
Because of structure member alignment, the simple structure
struct kdump_sub_header {
unsigned long phys_base;
int dump_level;
}; is 16 bytes large on x86_64. So if you fill the two members phys_base and dump_level with values, you still have uninitialised memory if you write sizeof(struct kdump_sub_header) to disk.
This patch initialises everything with zero first to get rid of that problem. The patch fixes valgrind warning
==24152== Syscall param write(buf) points to uninitialised byte(s)
==24152== at 0x4EEFFC0: write (in /lib64/libc-2.8.so)
==24152== by 0x40A97D: (within /bin/makedumpfile)
==24152== by 0x40ACEF: (within /bin/makedumpfile)
==24152== by 0x41896C: (within /bin/makedumpfile)
==24152== by 0x4191AA: (within /bin/makedumpfile)
==24152== by 0x4E48435: (below main) (in /lib64/libc-2.8.so)
==24152== Address 0x7fefffbfc is on thread 1's stack--- makedumpfile.c | 1 + 1 file changed, 1 insertion(+)
makedumpfile.c +1 -0
@@ -4707,6 +4707,7 @@ write_kdump_header(void)/* * Write sub header */ +memset (&sub_dump_header,0 ,sizeof (struct kdump_sub_header )); sub_dump_header.phys_base = info->phys_base; sub_dump_header.dump_level = info->dump_level; size =sizeof (struct kdump_sub_header );
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Bernhard,
Thank you for the patch.
It will be merged to the next release.
Thanks
Ken'ichi Ohmichi
Quoted 41 lines · Bernhard Walle
Because of structure member alignment, the simple structure
struct kdump_sub_header { unsigned long phys_base; int dump_level; };is 16 bytes large on
x86_64. So if you fill the two membersphys_baseanddump_levelwith values, you still have uninitialised memory if you writesizeof(struct kdump_sub_header)to disk.This patch initialises everything with zero first to get rid of that problem. The patch fixes valgrind warning
==24152== Syscall param write(buf) points to uninitialised byte(s) ==24152== at 0x4EEFFC0: write (in /lib64/libc-2.8.so) ==24152== by 0x40A97D: (within /bin/makedumpfile) ==24152== by 0x40ACEF: (within /bin/makedumpfile) ==24152== by 0x41896C: (within /bin/makedumpfile) ==24152== by 0x4191AA: (within /bin/makedumpfile) ==24152== by 0x4E48435: (below main) (in /lib64/libc-2.8.so) ==24152== Address 0x7fefffbfc is on thread 1's stackSigned-off-by Bernhard Walle <[email protected]>--- makedumpfile.c | 1 + 1 file changed, 1 insertion(+)makedumpfile.c +1
-0@@ -4707,6 +4707,7 @@ write_kdump_header(void)/* * Write sub header */ +memset (&sub_dump_header,0 ,sizeof (struct kdump_sub_header )); sub_dump_header.phys_base = info->phys_base; sub_dump_header.dump_level = info->dump_level; size =sizeof (struct kdump_sub_header );
Quoted 5 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec