)]}'
{
  "commit": "335be5bc44aa6800a9e3ba5859ea3833cfe5a7bc",
  "tree": "7b073ea950d31608f96026d73bf430b8849a8163",
  "parents": [
    "e05ebbd651ee9e5d0578b272b2eaf62557d407c9"
  ],
  "author": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Tue Nov 19 13:02:07 2024 +0000"
  },
  "committer": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Tue Nov 19 14:14:13 2024 +0000"
  },
  "message": "hw/intc/loongarch_extioi: Use set_bit32() and clear_bit32() for s-\u003eisr\n\nIn extioi_setirq() we try to operate on a bit array stored as an\narray of uint32_t using the set_bit() and clear_bit() functions\nby casting the pointer to \u0027unsigned long *\u0027.\nThis has two problems:\n * the alignment of \u0027uint32_t\u0027 is less than that of \u0027unsigned long\u0027\n   so we pass an insufficiently aligned pointer, which is\n   undefined behaviour\n * on big-endian hosts the 64-bit \u0027unsigned long\u0027 will have\n   its two halves the wrong way around, and we will produce\n   incorrect results\n\nThe undefined behaviour is shown by the clang undefined-behaviour\nsanitizer when running the loongarch64-virt functional test:\n\n/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/include/qemu/bitops.h:41:5: runtime error: store to misaligned address 0x555559745d9c for type \u0027unsigned long\u0027, which requires 8 byte alignment\n0x555559745d9c: note: pointer points here\n  ff ff ff ff 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00\n              ^\n    #0 0x555556fb81c4 in set_bit /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/include/qemu/bitops.h:41:9\n    #1 0x555556fb81c4 in extioi_setirq /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/clang/../../hw/intc/loongarch_extioi.c:65:9\n    #2 0x555556fb6e90 in pch_pic_irq_handler /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/clang/../../hw/intc/loongarch_pch_pic.c:75:5\n    #3 0x555556710265 in serial_ioport_write /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/clang/../../hw/char/serial.c\n\nFix these problems by using set_bit32() and clear_bit32(),\nwhich work with bit arrays stored as an array of uint32_t.\n\nCc: qemu-stable@nongnu.org\nFixes: cbff2db1e92f8759 (\"hw/intc: Add LoongArch extioi interrupt controller(EIOINTC)\")\nSigned-off-by: Peter Maydell \u003cpeter.maydell@linaro.org\u003e\nReviewed-by: Philippe Mathieu-Daudé \u003cphilmd@linaro.org\u003e\nReviewed-by: Bibo Mao \u003cmaobibo@loongson.cn\u003e\nMessage-id: 20241108135514.4006953-4-peter.maydell@linaro.org\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "02dc4e6db3be52d9d5207c351e320b2f0c45d5fe",
      "old_mode": 33188,
      "old_path": "hw/intc/loongarch_extioi.c",
      "new_id": "97d1af5ccc276112616bb2174b3e9a1648b0a13b",
      "new_mode": 33188,
      "new_path": "hw/intc/loongarch_extioi.c"
    }
  ]
}
