qemu crashes with "GLib-ERROR **: gmem.c" error when a negative value passed to "maxcpus"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
# ppc64-softmmu/
(process:12149): GLib-ERROR **: gmem.c:130: failed to allocate 184467440737095
From GDB:
[New Thread 0x3fffb5aceb60 (LWP 12190)]
(process:12184): GLib-ERROR **: gmem.c:130: failed to allocate 184467440737095
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00003fffb75e5408 in raise () from /lib64/
Missing separate debuginfos, use: debuginfo-install glib2-2.
(gdb) bt
#0 0x00003fffb75e5408 in raise () from /lib64/
#1 0x00003fffb796be9c in _g_log_abort () from /lib64/
#2 0x00003fffb796d4c4 in g_log_default_
#3 0x00003fffb796d86c in g_logv () from /lib64/
#4 0x00003fffb796db00 in g_log () from /lib64/
#5 0x00003fffb796b694 in g_malloc0 () from /lib64/
#6 0x000000001018fa84 in spapr_possible_
#7 0x000000001018b444 in spapr_init_cpus (spapr=0x11165660) at /home/nasastry/
#8 0x000000001018bc6c in ppc_spapr_init (machine=
#9 0x000000001041ca38 in machine_
#10 0x000000001037723c in main (argc=24, argv=0x3fffffff
(gdb) i r
r0 0xfa 250
r1 0x3fffffffe450 70368744170576
r2 0x3fffb7608100 70367525765376
r3 0x0 0
r4 0x2f98 12184
r5 0x5 5
r6 0x0 0
r7 0x3fffa8000020 70367267782688
r8 0x2f98 12184
r9 0x0 0
r10 0x0 0
r11 0x0 0
r12 0x0 0
r13 0x3fffb64fccb0 70367507893424
r14 0x0 0
r15 0x0 0
r16 0x0 0
r17 0x0 0
r18 0x1 1
r19 0x0 0
r20 0x3fffb796d3f0 70367529325552
r21 0x0 0
r22 0x20000000 536870912
r23 0x1 1
r24 0x3fffb7a61498 70367530325144
r25 0x3fffb7a614e8 70367530325224
r26 0x3fffb7a61488 70367530325128
r27 0x3fffa80008c0 70367267784896
r28 0x3fffb79cd2a8 70367529718440
r29 0x3fffb79cd2a8 70367529718440
r30 0xffffffffffffffff 184467440737095
r31 0x1 1
pc 0x3fffb75e5408 0x3fffb75e5408 <raise+56>
msr 0x900000000000d033 103762935414616
cr 0x42244842 1109674050
lr 0x3fffb796be9c 0x3fffb796be9c <_g_log_abort+60>
ctr 0x0 0
xer 0x0 0
orig_r3 0x2f98 12184
trap 0xc00 3072
Similar error observed on x86_64 and PPC64LE architectures.
Changed in qemu: | |
status: | Fix Committed → Fix Released |
3308 static const CPUArchIdList *spapr_ possible_ cpu_arch_ ids(MachineStat e *machine)
3309 {
3310 int i;
3311 int spapr_max_cores = max_cpus / smp_threads; <<<<<< max_cpus is -ve and spapr_max_cores will also be -ve
...
3321 >possible_ cpus = g_malloc0( sizeof( CPUArchIdList) +
3322 machine-
3323 sizeof(CPUArchId) * spapr_max_cores);
g_malloc0(is getting a -ve value) and then fails with a trap.