)]}'
{
  "commit": "3d4352200e3e98a6d8855e6f3a39b6d33d84e36b",
  "tree": "b125a52bc79b11576a7a16a5232536e804504f91",
  "parents": [
    "e8f8842d90abe5eafa8c32f08fbc3a747a45747c"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Tue Sep 24 23:38:49 2019 +0200"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Tue Sep 24 23:38:49 2019 +0200"
  },
  "message": "[gdb/tdep] Handle mxcsr kernel bug on Intel Skylake CPUs\n\nOn my openSUSE Leap 15.1 x86_64 Skylake system with the default (4.12) kernel,\nI run into:\n...\nFAIL: gdb.base/gcore.exp: corefile restored all registers\n...\n\nThe problem is that there\u0027s a difference in the mxcsr register value before\nand after the gcore command:\n...\n- mxcsr          0x0                 [ ]\n+ mxcsr          0x400440            [ DAZ OM ]\n...\n\nThis can be traced back to amd64_linux_nat_target::fetch_registers, where\nxstateregs is partially initialized by the ptrace call:\n...\n          char xstateregs[X86_XSTATE_MAX_SIZE];\n          struct iovec iov;\n\n          amd64_collect_xsave (regcache, -1, xstateregs, 0);\n          iov.iov_base \u003d xstateregs;\n          iov.iov_len \u003d sizeof (xstateregs);\n          if (ptrace (PTRACE_GETREGSET, tid,\n                      (unsigned int) NT_X86_XSTATE, (long) \u0026iov) \u003c 0)\n            perror_with_name (_(\"Couldn\u0027t get extended state status\"));\n\n          amd64_supply_xsave (regcache, -1, xstateregs);\n...\nafter which amd64_supply_xsave is called.\n\nThe amd64_supply_xsave call is supposed to only use initialized parts of\nxstateregs, but due to a kernel bug on intel skylake (fixed from 4.14 onwards\nby commit 0852b374173b \"x86/fpu: Add FPU state copying quirk to handle XRSTOR\nfailure on Intel Skylake CPUs\") it can happen that the mxcsr part of\nxstateregs is not initialized, while amd64_supply_xsave expects it to be\ninitialized, which explains the FAIL mentioned above.\n\nFix the undetermined behaviour by initializing xstateregs before calling\nptrace, which makes sure we get a 0x0 for mxcsr when this kernel bug occurs,\nand which also happens to fix the FAIL.\n\nFurthermore, add an xfail for this FAIL which triggers the same kernel bug:\n...\nFAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: \\\n  check new value of MXCSR is still in place\n...\n\nBoth FAILs pass when using a 5.3 kernel instead on the system mentioned above.\n\nTested on x86_64-linux.\n\ngdb/ChangeLog:\n\n2019-09-24  Tom de Vries  \u003ctdevries@suse.de\u003e\n\n\tPR gdb/23815\n\t* amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers):\n\tInitialize xstateregs before ptrace PTRACE_GETREGSET call.\n\ngdb/testsuite/ChangeLog:\n\n2019-09-24  Tom de Vries  \u003ctdevries@suse.de\u003e\n\n\tPR gdb/24598\n\t* gdb.arch/amd64-init-x87-values.exp: Add xfail.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "77aab7649247b646e8a714b10e096e99865776be",
      "old_mode": 33188,
      "old_path": "gdb/ChangeLog",
      "new_id": "ee53e9c00a56ca30ad539cf518661760bf26d746",
      "new_mode": 33188,
      "new_path": "gdb/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "4f1c98a0d1e17125b02d64453230eb6e06989aa5",
      "old_mode": 33188,
      "old_path": "gdb/amd64-linux-nat.c",
      "new_id": "d0328b677d598456909c817c6e9969dc9961645f",
      "new_mode": 33188,
      "new_path": "gdb/amd64-linux-nat.c"
    },
    {
      "type": "modify",
      "old_id": "37e323f747c69804939755d5c171283847953afc",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/ChangeLog",
      "new_id": "706c5da420afa8ac5acb94d262f299798431334e",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "cdf92dcd37761c7d6f5ee7306d8419f8893f5105",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.arch/amd64-init-x87-values.exp",
      "new_id": "5fd18dbb7942e8fb6d936294be7b1cd9e355f8f8",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.arch/amd64-init-x87-values.exp"
    }
  ]
}
