)]}'
{
  "commit": "f848316c62dfd751dde60ced86d6159233dd6ee3",
  "tree": "8df7d963f14d65e48a98e036c96ba17b70a154f3",
  "parents": [
    "0f8ff22a9f148bfea0fffea7b776b80030bf0791"
  ],
  "author": {
    "name": "Jacob Keller",
    "email": "jacob.e.keller@intel.com",
    "time": "Thu Sep 05 11:42:12 2024 -0700"
  },
  "committer": {
    "name": "Richard Cochran",
    "email": "richardcochran@gmail.com",
    "time": "Thu Sep 05 21:09:42 2024 -0700"
  },
  "message": "ts2phc: check for errors on polling the sink devices\n\nThe ts2phc_pps_sink_poll() function polls on the sink clock devices to\ncapture PPS events. It attempts to poll until every sink has at least one\nevent.\n\nThe function does not check POLLERR. If one of the sink clocks has an error\nwhile polling, it will be ignored, and the ts2phc_pps_sink_poll() function\nmay iterate in an infinite loop. The poll function will be called\nrepeatably, reporting POLL_ERR on the descriptor for the bad clock.\n\nThe loop will never terminate, because the sink with a bad clock will never\nget a sink event, and the all_sinks_have_events will never be true.\n\nThis is relatively easy to trigger by simply removing the associated PTP\nclock of a running instance of ts2phc. For example, if you remove the\ndriver of the associated networking device.\n\nYou can see the poll() behavior via strace:\n\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n  poll([{fd\u003d4, events\u003dPOLLIN|POLLPRI}], 1, 2000) \u003d 1 ([{fd\u003d4, revents\u003dPOLLERR}])\n\nThe ts2phc_pps_sink_poll() function repeatably calls poll() and never\nexits.\n\nWorse, the interrupts SIGINT, SIGQUIT, SIGTERM, and SIGHUP all fail to stop\nthe program. These interrupts are all handled via\nhandle_int_quit_term(), which sets the global \u0027running\u0027 variable to 0. This\nis checked via is_running(), but only in the main() function in ts2phc.c\nBecause the ts2phc_pps_sink_poll() function does not exit, the is_running()\ncheck is never triggered.\n\nThus, if a user removes the PTP clock, they will be unable to kill the\nts2phc program via usual means and must resort to a SIGKILL.\n\nIf one of the configured clocks is no longer accessible, ts2phc should stop\nattempting to synchronize it. In most other cases where a clock operation\nfails unexpectedly, ts2phc reports an error message and exits.\n\nAdd a check for the POLLERR return event when iterating over the sink\nclocks. When an error is detected, log an error message and exit. Note that\nunlike sockets, there is no equivalent to sk_get_error() to determine the\nspecific cause of the polling error.\n\nReported-by: Alexander Nowlin \u003cAlexander.Nowlin@intel.com\u003e\nSigned-off-by: Jacob Keller \u003cjacob.e.keller@intel.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f285c2b24eee1e5a2cb1627937d8d70ad34317b8",
      "old_mode": 33188,
      "old_path": "ts2phc_pps_sink.c",
      "new_id": "0ba454de706bec28234b5808699764dec17d5c7a",
      "new_mode": 33188,
      "new_path": "ts2phc_pps_sink.c"
    }
  ]
}
