)]}'
{
  "commit": "c08b8832fb7715036b5dfbf7630e8798711e4f53",
  "tree": "8235e7c199f4cd6050098d0484ef11d8ca26aca8",
  "parents": [
    "4781852c038d10bbc69f7115aae12933ec263ac8"
  ],
  "author": {
    "name": "Eric Biggers",
    "email": "ebiggers@google.com",
    "time": "Fri Dec 10 15:50:54 2021 -0800"
  },
  "committer": {
    "name": "Greg Kroah-Hartman",
    "email": "gregkh@google.com",
    "time": "Sun Dec 12 16:42:07 2021 +0100"
  },
  "message": "UPSTREAM: aio: fix use-after-free due to missing POLLFREE handling\n\ncommit 50252e4b5e989ce64555c7aef7516bdefc2fea72 upstream.\n\nsignalfd_poll() and binder_poll() are special in that they use a\nwaitqueue whose lifetime is the current task, rather than the struct\nfile as is normally the case.  This is okay for blocking polls, since a\nblocking poll occurs within one task; however, non-blocking polls\nrequire another solution.  This solution is for the queue to be cleared\nbefore it is freed, by sending a POLLFREE notification to all waiters.\n\nUnfortunately, only eventpoll handles POLLFREE.  A second type of\nnon-blocking poll, aio poll, was added in kernel v4.18, and it doesn\u0027t\nhandle POLLFREE.  This allows a use-after-free to occur if a signalfd or\nbinder fd is polled with aio poll, and the waitqueue gets freed.\n\nFix this by making aio poll handle POLLFREE.\n\nA patch by Ramji Jiyani \u003cramjiyani@google.com\u003e\n(https://lore.kernel.org/r/20211027011834.2497484-1-ramjiyani@google.com)\ntried to do this by making aio_poll_wake() always complete the request\ninline if POLLFREE is seen.  However, that solution had two bugs.\nFirst, it introduced a deadlock, as it unconditionally locked the aio\ncontext while holding the waitqueue lock, which inverts the normal\nlocking order.  Second, it didn\u0027t consider that POLLFREE notifications\nare missed while the request has been temporarily de-queued.\n\nThe second problem was solved by my previous patch.  This patch then\nproperly fixes the use-after-free by handling POLLFREE in a\ndeadlock-free way.  It does this by taking advantage of the fact that\nfreeing of the waitqueue is RCU-delayed, similar to what eventpoll does.\n\nFixes: 2c14fa838cbe (\"aio: implement IOCB_CMD_POLL\")\nCc: \u003cstable@vger.kernel.org\u003e # v4.18+\nLink: https://lore.kernel.org/r/20211209010455.42744-6-ebiggers@kernel.org\nSigned-off-by: Eric Biggers \u003cebiggers@google.com\u003e\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@linuxfoundation.org\u003e\nBug: 185125206\nSigned-off-by: Greg Kroah-Hartman \u003cgregkh@google.com\u003e\nChange-Id: I87b4b20981f4283b15d51c48c8e422fcf0612ba8\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2820e779fe1f129599dd2dfbd82edb2ee75585c5",
      "old_mode": 33188,
      "old_path": "fs/aio.c",
      "new_id": "fb92c32a6f1e9df3c3479064f613d033000025fc",
      "new_mode": 33188,
      "new_path": "fs/aio.c"
    },
    {
      "type": "modify",
      "old_id": "41b509f410bf9b7f50f2c2e31542f170ee28f38a",
      "old_mode": 33188,
      "old_path": "include/uapi/asm-generic/poll.h",
      "new_id": "f9c520ce4bf4e4cd3128e298d0d06a415514046e",
      "new_mode": 33188,
      "new_path": "include/uapi/asm-generic/poll.h"
    }
  ]
}
