[libvirt] [PATCH] cpu: Don't access invalid memory in virCPUx86Translate

Ján Tomko jtomko at redhat.com
Thu Mar 7 14:23:32 UTC 2019


On Thu, Mar 07, 2019 at 02:38:03PM +0100, Michal Privoznik wrote:
>Problem is that if there are no signatures for a CPU, then we
>still allocate cpu->signatures (even though with size 0). Later,
>we access cpu->signatures[0] if cpu->signatures is not NULL.
>
> Invalid read of size 4
>    at 0x5F439D7: virCPUx86Translate (cpu_x86.c:2930)
>    by 0x5F3C239: virCPUTranslate (cpu.c:927)
>    by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
>    ...
>  Address 0xf752d40 is 0 bytes after a block of size 0 alloc'd
>    at 0x4C30EC6: calloc (vg_replace_malloc.c:711)
>    by 0x5DBDE4E: virAllocN (viralloc.c:190)
>    by 0x5F3E4FA: x86ModelCopySignatures (cpu_x86.c:990)
>    by 0x5F3E60F: x86ModelCopy (cpu_x86.c:1008)
>    by 0x5F3E7CB: x86ModelFromCPU (cpu_x86.c:1068)
>    by 0x5F4397E: virCPUx86Translate (cpu_x86.c:2922)
>    by 0x5F3C239: virCPUTranslate (cpu.c:927)
>    by 0x57CE7A1: qemuProcessUpdateGuestCPU (qemu_process.c:5870)
>    ...
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

One sign-off ought to be enough for everybody.

Jano

>---
> src/cpu/cpu_x86.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190307/4f4d7a04/attachment-0001.sig>


More information about the libvir-list mailing list