On 12/11/2014 06:27 AM, Dave Anderson wrote:
First, please address all of these warnings:
$ make warn
... [ cut ] ...
cc -c -g -DX86_64 -DLZO -DSNAPPY -DGDB_7_6 netdump.c -Wall -O2 -Wstrict-prototypes
-Wmissing-prototypes -fstack-protector -Wformat-security
netdump.c: In function 'dump_Elf32_Nhdr':
netdump.c:1987:4: warning: format not a string literal and no format arguments
[-Wformat-security]
netdump.c: In function 'dump_Elf64_Nhdr':
netdump.c:2272:4: warning: format not a string literal and no format arguments
[-Wformat-security]
netdump.c:2303:4: warning: format not a string literal and no format arguments
[-Wformat-security]
...
Hello Dave,
These warnings have been addressed.
Secondly, for compressed kdumps in diskdump.c, you have this
construct:
if (dd->machine_type == EM_386)
display_note_elf32(dd->nt_prstatus_percpu[i],l_buf);
else if (dd->machine_type == EM_X86_64)
display_note_elf64(dd->nt_prstatus_percpu[i],l_buf);
But for ELF kdumps in netdump.c, display_note_elf32() are display_note_elf64()
look to be called unconditionally. What about the other architectures?
I distinguish the architectures by the struct size in display_note(). I wonder
if it is needed to add other conditions like machine_type.
display_note(void *note_ptr, char *buf, int descsz)
{
if (descsz == (2 * sizeof(struct x86_64_prstatus)))
display_prstatus_elf64(note_ptr, buf);
else if (descsz == sizeof(struct x86_prstatus))
display_prstatus_elf32(note_ptr, buf);
else if (descsz == (2 * sizeof(QEMUCPUState)))
display_qemu_elf64(note_ptr, buf);
else if (descsz == sizeof(QEMUCPUState))
display_qemu_elf32(note_ptr, buf);
}
Also, are there any dumping facilities that actually utilize any of
the nt_prstatus fields besides the registers and maybe the pid?:
struct x86_64_prstatus {
int si_signo;
int si_code;
int si_errno;
short cursig;
unsigned long sigpend;
unsigned long sighold;
int pid;
int ppid;
int pgrp;
int sid;
struct timeval utime;
struct timeval stime;
struct timeval cutime;
struct timeval cstime;
struct x86_64_user_regs_struct regs;
int fpvalid;
};
For example, kdump just does this:
memset(&prstatus, 0, sizeof(prstatus));
prstatus.pr_pid = current->pid;
elf_core_copy_kernel_regs(&prstatus.pr_reg, regs);
So I guess I wonder what is the point of displaying of all the other fields?
These patches are just used to make the original information readable.
I'm not sure whether it is a good idea to display only the registers contents here,
for help -r can show them well.
Also, can you explain to me the difference between the register
contents
in the QEMUCPUState structure vs. the register contents in the NT_PRSTATUS
note?
They are almost the same except that there are more information in QEMUCPUState.
And related to that question, why doesn't your dump_qemu_elf()
function
display the rip and rflags registers?
It's my fault that I left them. And they have been added.
Dave
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
--
Thanks
Zhou Wenjian