Skip to contentSkip to conversation

debugexit: support for custom exit port (LGPL VGA BIOS port 0x501)

PATCH Jan Kiszka 4 participants 8 messages Oct 5, 2012 4 messages not in the archive

lore
Share & tools
lore

Jan Kiszka

author
#4 lore raw
In reply to a message not in the archive

[was a private thread due to typo in qemu list address]

Quoted 13 lines · Anthony Liguori
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 00:06, Lucas Meneghel Rodrigues ha scritto:

Review

Quoted 5 lines
(quoted diff) +5 -0
+static void debugexit_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+{
+    exit((val << 1) | 1);
+}
+

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

Quoted 5 lines

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

assert(val); (or hw_error)
exit(val);

I would suggest.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
#5 lore raw

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

Paolo

author
#6 lore raw
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

Quoted 7 lines
Quoted 4 lines

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

To avoid spurious exits on port scans etc. that appear like regular ones. However, as we configure this device explicitly in, not adding it in some default, that risk is likely low.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux
#7 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

Quoted 7 lines
Quoted 4 lines

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

Mainly to differientiate between an open coded exit(0)/exit(1) and something triggered by the unit test.

The problem I tried to cope with was:

anthony@titi:~/git/qemu$ grep 'exit([01])' hw/*.c | wc -l
249

Regards,

Anthony Liguori

Quoted 2 lines

Paolo

#8 lore raw

Il 05/10/2012 15:58, Anthony Liguori ha scritto:

Quoted 20 lines
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

Quoted 7 lines
Quoted 4 lines

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

Quoted 7 lines

Mainly to differientiate between an open coded exit(0)/exit(1) and something triggered by the unit test.

The problem I tried to cope with was:

anthony@titi:~/git/qemu$ grep 'exit([01])' hw/*.c | wc -l
249

Understood. The right solution is of course to fix hw/*.c.

Let's start with exit(0).

hw/eeprom93xx.c:    exit(0);           <--- should be hw_error
hw/pci.c:        exit(0);              <--- move to qemu_show_nic_models
hw/spapr.c:        exit(0);            <--- should be exit(1) !!

For exit(1), many of them should become hw_error, especially those in this files:

hw/bonito.c
hw/ivshmem.c
hw/lsi53c895a.c
hw/pci.c
hw/pl022.c
hw/pl061.c
hw/pl110.c
hw/qxl.c
hw/smbus.c
hw/ssd0303.c
hw/ssi-sd.c
hw/stellaris_enet.c
hw/virtio-blk.c
hw/virtio.c
hw/virtio-net.c
hw/virtio-scsi.c

Any takers?

Paolo

#9 lore raw
Quoted 24 lines · Paolo Bonzini

Il 05/10/2012 15:58, Anthony Liguori ha scritto:

Quoted 23 lines
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

Quoted 7 lines
Quoted 4 lines

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

Mainly to differientiate between an open coded exit(0)/exit(1) and something triggered by the unit test.

Quoted 6 lines
Quoted 4 lines

The problem I tried to cope with was:

anthony@titi:~/git/qemu$ grep 'exit([01])' hw/*.c | wc -l
249

Understood. The right solution is of course to fix hw/*.c.

I don't think it's an awful thing for test harnesses to just use a reserved range of exit reasons.

Should be easy enough to change kvm-unittests, no?

Regards,

Anthony Liguori

Quoted 30 lines

Let's start with exit(0).

hw/eeprom93xx.c:    exit(0);           <--- should be hw_error
hw/pci.c:        exit(0);              <--- move to qemu_show_nic_models
hw/spapr.c:        exit(0);            <--- should be exit(1) !!

For exit(1), many of them should become hw_error, especially those in this files:

hw/bonito.c
hw/ivshmem.c
hw/lsi53c895a.c
hw/pci.c
hw/pl022.c
hw/pl061.c
hw/pl110.c
hw/qxl.c
hw/smbus.c
hw/ssd0303.c
hw/ssi-sd.c
hw/stellaris_enet.c
hw/virtio-blk.c
hw/virtio.c
hw/virtio-net.c
hw/virtio-scsi.c

Any takers?

Paolo

#10 lore raw

Il 05/10/2012 16:23, Anthony Liguori ha scritto:

Quoted 3 lines
Quoted 1 line
Quoted 1 line

Understood. The right solution is of course to fix hw/*.c.

I don't think it's an awful thing for test harnesses to just use a reserved range of exit reasons.

But that's not what exit((val << 1) | 1) does, since it allows you to do exit(1)...

Paolo

Quoted 1 line

Should be easy enough to change kvm-unittests, no?

#11 lore raw
In reply to Paolo Bonzini
Quoted 24 lines · Paolo Bonzini

Il 05/10/2012 15:58, Anthony Liguori ha scritto:

Quoted 23 lines
Quoted 10 lines · Paolo Bonzini

Il 05/10/2012 14:43, Jan Kiszka ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

This "| 1" might be the problem. Anthony, are you relying on it in qemu-test and/or can you work out the changes if we use just "exit(val)"?

The reason for ' | 1' was to make sure that the guest couldn't trigger an exit(0).

If there's a compelling reason to drop '| 1', I can adjust my tests accordingly.

Quoted 7 lines
Quoted 4 lines

assert(val); (or hw_error)
exit(val);

I would suggest.

I think what the kvm_unittests want is exactly to trigger an exit(0). Why did you rule it out?

Mainly to differientiate between an open coded exit(0)/exit(1) and something triggered by the unit test.

Quoted 6 lines
Quoted 4 lines

The problem I tried to cope with was:

anthony@titi:~/git/qemu$ grep 'exit([01])' hw/*.c | wc -l
249

Understood. The right solution is of course to fix hw/*.c.

While fixing, let's also avoid guest triggerable exits and use logging for unimplemented features.

Quoted 32 lines

Let's start with exit(0).

hw/eeprom93xx.c:    exit(0);           <--- should be hw_error
hw/pci.c:        exit(0);              <--- move to qemu_show_nic_models
hw/spapr.c:        exit(0);            <--- should be exit(1) !!

For exit(1), many of them should become hw_error, especially those in this files:

hw/bonito.c
hw/ivshmem.c
hw/lsi53c895a.c
hw/pci.c
hw/pl022.c
hw/pl061.c
hw/pl110.c
hw/qxl.c
hw/smbus.c
hw/ssd0303.c
hw/ssi-sd.c
hw/stellaris_enet.c
hw/virtio-blk.c
hw/virtio.c
hw/virtio-net.c
hw/virtio-scsi.c

Any takers?

Paolo