)]}'
{
  "commit": "6d0020873deb2f2c4e0965dc2ebf227bc1db3140",
  "tree": "65a67b1ce578389b8f1c1a0e280cb1a35afca484",
  "parents": [
    "fd7f7424f5f68ad5cb16a5319f60ba15a7d23107"
  ],
  "author": {
    "name": "Luis Machado",
    "email": "luis.machado@arm.com",
    "time": "Sun Sep 11 20:47:18 2022 +0100"
  },
  "committer": {
    "name": "Luis Machado",
    "email": "luis.machado@arm.com",
    "time": "Tue Feb 21 09:09:24 2023 +0000"
  },
  "message": "[aarch64] Enable pointer authentication support for aarch64 bare metal/kernel mode addresses\n\nAt the moment GDB only handles pointer authentication (pauth) for userspace\naddresses and if we\u0027re debugging a Linux-hosted program.\n\nThe Linux Kernel can be configured to use pauth instructions for some\nadditional security hardening, but GDB doesn\u0027t handle this well.\n\nTo overcome this limitation, GDB needs a couple things:\n\n1 - The target needs to advertise pauth support.\n2 - The hook to remove non-address bits from a pointer needs to be registered\n    in aarch64-tdep.c as opposed to aarch64-linux-tdep.c.\n\nThere is a patch for QEMU that addresses the first point, and it makes\nQEMU\u0027s gdbstub expose a couple more pauth mask registers, so overall we will\nhave up to 4 pauth masks (2 masks or 4 masks):\n\npauth_dmask\npauth_cmask\npauth_dmask_high\npauth_cmask_high\n\npauth_dmask and pauth_cmask are the masks used to remove pauth signatures\nfrom userspace addresses. pauth_dmask_high and pauth_cmask_high masks are used\nto remove pauth signatures from kernel addresses.\n\nThe second point is easily addressed by moving code around.\n\nWhen debugging a Linux Kernel built with pauth with an unpatched GDB, we get\nthe following backtrace:\n\n #0  __fput (file\u003d0xffff0000c17a6400) at /repos/linux/fs/file_table.c:296\n #1  0xffff8000082bd1f0 in ____fput (work\u003d\u003coptimized out\u003e) at /repos/linux/fs/file_table.c:348\n #2  0x30008000080ade30 [PAC] in ?? ()\n #3  0x30d48000080ade30 in ?? ()\n Backtrace stopped: previous frame identical to this frame (corrupt stack?)\n\nWith a patched GDB, we get something a lot more meaningful:\n\n #0  __fput (file\u003d0xffff0000c1bcfa00) at /repos/linux/fs/file_table.c:296\n #1  0xffff8000082bd1f0 in ____fput (work\u003d\u003coptimized out\u003e) at /repos/linux/fs/file_table.c:348\n #2  0xffff8000080ade30 [PAC] in task_work_run () at /repos/linux/kernel/task_work.c:179\n #3  0xffff80000801db90 [PAC] in resume_user_mode_work (regs\u003d0xffff80000a96beb0) at /repos/linux/include/linux/resume_user_mode.h:49\n #4  do_notify_resume (regs\u003dregs@entry\u003d0xffff80000a96beb0, thread_flags\u003d4) at /repos/linux/arch/arm64/kernel/signal.c:1127\n #5  0xffff800008fb9974 [PAC] in prepare_exit_to_user_mode (regs\u003d0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:137\n #6  exit_to_user_mode (regs\u003d0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:142\n #7  el0_svc (regs\u003d0xffff80000a96beb0) at /repos/linux/arch/arm64/kernel/entry-common.c:638\n #8  0xffff800008fb9d34 [PAC] in el0t_64_sync_handler (regs\u003d\u003coptimized out\u003e) at /repos/linux/arch/arm64/kernel/entry-common.c:655\n #9  0xffff800008011548 [PAC] in el0t_64_sync () at /repos/linux/arch/arm64/kernel/entry.S:586\n Backtrace stopped: Cannot access memory at address 0xffff80000a96c0c8\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9d6ed358597ca00a6a2d44db94d0cc2e1b1701b5",
      "old_mode": 33188,
      "old_path": "gdb/aarch64-linux-tdep.c",
      "new_id": "0000b498f8959b44ed20404c834a4ad77fcea8d4",
      "new_mode": 33188,
      "new_path": "gdb/aarch64-linux-tdep.c"
    },
    {
      "type": "modify",
      "old_id": "0bf6085c43ae21d60354b3c4e9d7587c75bdfaea",
      "old_mode": 33188,
      "old_path": "gdb/aarch64-tdep.c",
      "new_id": "5b1b9921f87e588f8251a77d858f8f312be1e5ac",
      "new_mode": 33188,
      "new_path": "gdb/aarch64-tdep.c"
    },
    {
      "type": "modify",
      "old_id": "97b8d0c379311299b5f3fcab93b16bd72f46928d",
      "old_mode": 33188,
      "old_path": "gdb/aarch64-tdep.h",
      "new_id": "ae38327ffab27918ed2a18ac7aa240b650314be9",
      "new_mode": 33188,
      "new_path": "gdb/aarch64-tdep.h"
    },
    {
      "type": "modify",
      "old_id": "de4461e8be17cce299f9698e9fea1018b383b47a",
      "old_mode": 33188,
      "old_path": "gdb/arch/aarch64.h",
      "new_id": "4b3f1b8eff8cb836f3b9a057486f77a09dc94c9e",
      "new_mode": 33188,
      "new_path": "gdb/arch/aarch64.h"
    }
  ]
}
