79 lines
3.0 KiB
Diff
79 lines
3.0 KiB
Diff
qemu-spoof: storage identity (IDE + NVMe)
|
|
|
|
IDE: model "QEMU HARDDISK"/"QEMU DVD-ROM", firmware rev, and the auto serial now
|
|
route through spoof_disk_*/spoof_cdrom_model. NVMe: model "QEMU NVMe Ctrl",
|
|
serial, and the firmware revision (was QEMU_VERSION -- an information leak) now
|
|
route through spoof_nvme_*. Inert unless a spoof-seed is set.
|
|
diff --git a/hw/ide/core.c b/hw/ide/core.c
|
|
index 7a15d6c..ad5251f 100644
|
|
--- a/hw/ide/core.c
|
|
+++ b/hw/ide/core.c
|
|
@@ -24,6 +24,7 @@
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
+#include "hw/misc/spoof.h"
|
|
#include "hw/core/irq.h"
|
|
#include "hw/isa/isa.h"
|
|
#include "migration/vmstate.h"
|
|
@@ -2641,19 +2642,23 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp)
|
|
} else {
|
|
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
|
|
"QM%05d", s->drive_serial);
|
|
+ if (spoof_enabled()) { /* qemu-spoof: brand-correct serial */
|
|
+ pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str),
|
|
+ spoof_disk_serial(s->drive_serial_str));
|
|
+ }
|
|
}
|
|
if (dev->model) {
|
|
pstrcpy(s->drive_model_str, sizeof(s->drive_model_str), dev->model);
|
|
} else {
|
|
switch (kind) {
|
|
case IDE_CD:
|
|
- strcpy(s->drive_model_str, "QEMU DVD-ROM");
|
|
+ strcpy(s->drive_model_str, spoof_cdrom_model("QEMU DVD-ROM"));
|
|
break;
|
|
case IDE_CFATA:
|
|
strcpy(s->drive_model_str, "QEMU MICRODRIVE");
|
|
break;
|
|
default:
|
|
- strcpy(s->drive_model_str, "QEMU HARDDISK");
|
|
+ strcpy(s->drive_model_str, spoof_disk_model("QEMU HARDDISK"));
|
|
break;
|
|
}
|
|
}
|
|
@@ -2661,7 +2666,7 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp)
|
|
if (dev->version) {
|
|
pstrcpy(s->version, sizeof(s->version), dev->version);
|
|
} else {
|
|
- pstrcpy(s->version, sizeof(s->version), QEMU_HW_VERSION);
|
|
+ pstrcpy(s->version, sizeof(s->version), spoof_disk_fw(QEMU_HW_VERSION));
|
|
}
|
|
|
|
ide_reset(s);
|
|
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
|
|
index be6c702..575085a 100644
|
|
--- a/hw/nvme/ctrl.c
|
|
+++ b/hw/nvme/ctrl.c
|
|
@@ -194,6 +194,7 @@
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
+#include "hw/misc/spoof.h"
|
|
#include "qemu/cutils.h"
|
|
#include "qemu/error-report.h"
|
|
#include "qemu/log.h"
|
|
@@ -9096,9 +9097,9 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
|
|
|
|
id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID));
|
|
id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));
|
|
- strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' ');
|
|
- strpadcpy((char *)id->fr, sizeof(id->fr), QEMU_VERSION, ' ');
|
|
- strpadcpy((char *)id->sn, sizeof(id->sn), n->params.serial, ' ');
|
|
+ strpadcpy((char *)id->mn, sizeof(id->mn), spoof_nvme_model("QEMU NVMe Ctrl"), ' ');
|
|
+ strpadcpy((char *)id->fr, sizeof(id->fr), spoof_nvme_fw(QEMU_VERSION), ' ');
|
|
+ strpadcpy((char *)id->sn, sizeof(id->sn), spoof_nvme_serial(n->params.serial), ' ');
|
|
|
|
id->cntlid = cpu_to_le16(n->cntlid);
|
|
|