From nobody Fri Dec 13 14:08:35 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y8rm36BRhz5gd2y; Fri, 13 Dec 2024 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y8rm33RS2z4fvk; Fri, 13 Dec 2024 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734098915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9uUhMj5KdDfWqqyoOiSiG58x1Y7CMwblOSHCIY9xVpI=; b=JsbogUbp9pny09pebBuD/RlXADUKoRFNCY04uOjG6CokbF0/qFT/VUq4NRlvgU1Qbo0gxW B96FPxLYTiMT9Oh8z/gIj8lS1afmghZYAEaerJZzzOKjma9ytXDC+Ntx6E+L4FjcitZl9k vXNBA4Jy0W87QvKLr4X3qRcfIZ45QwLkbTSnwJ1d0dfWWbe5zczzGBgiKJgO1ijzK5oOFL j9v80X9T+YiNGtSpJHotIcAl+sow8oNzT7Qb2VosqPGl8J52kApsoXjuT0vsKigme098Z1 /IQ+kIptgVcP7bBJzc2m8MOSKYkL3H9Mv30mTEh4/IizbEm1b1iNDJw14pfxbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734098915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9uUhMj5KdDfWqqyoOiSiG58x1Y7CMwblOSHCIY9xVpI=; b=dbifBi5n615zS2vUVV8coQLlx5Twi96nShcdrwwOHrjlhXZvUk/QUg1b+L4UrKlPbOXX2w 2P9JSWDCwiuHsU3BbwOPTF3ykAeoHb7nmYWK+U6Pj0jStlbsKStXlYX+En2P8mQQoxkRBp jqiiFIyh46FebN2zVL6Snl5Im/GST6ngOQ836qCbUgO3RkpD4YPtMkVZXUi9xBiDGPYkZo RHyl/n37iYs/ciORapk4Uuut+lzOZkB7vQDpbjrweBWCbxm+FSOexnKeOvw33ftEgjgbqv RUbNCr1jiLF9cLUkszFsCG3gIHzcXFXuruPZNHlCbexfekTDF7UT3vQ39Sg3LQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734098915; a=rsa-sha256; cv=none; b=Jb9TKqq41rxLMZfLjFUPbm9AJ220jXDLBQB8q3AuJFZrwuiQuCdEcmSVU4+GGzin2V4+ww dXOaK/XG9Q9wHmefQvMNqyCE+RJFxPkpwSIf++pdwTHQNpDF2+2s5WW6EK0wC6v69YUXTA TIjWZeYBxm6oM7rIWSSgpiixVGZDR99KyKudc82m0U4HccsIpWm6g8WiW0WBwgytSU/CvD Pfe6LU7gGRZCuMqVxgB3rAlHIVF9CMV+NlXeJ21joEye9e41ApYATbsr3iwE6UexntgDas q7jC+6X/4stgF4MNXkf+YDHYQvzZKGOBR7S1kWeQEU4SOddsEmK5seubvObtsQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y8rm3336mzh1r; Fri, 13 Dec 2024 14:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BDE8Zhg024177; Fri, 13 Dec 2024 14:08:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BDE8ZRF024174; Fri, 13 Dec 2024 14:08:35 GMT (envelope-from git) Date: Fri, 13 Dec 2024 14:08:35 GMT Message-Id: <202412131408.4BDE8ZRF024174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 989998529387 - main - fusefs: FUSE_NOTIFY_INVAL_* must busy the mountpoint List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 989998529387b4d98dfaa6c499ad88b006f78de8 Auto-Submitted: auto-generated The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=989998529387b4d98dfaa6c499ad88b006f78de8 commit 989998529387b4d98dfaa6c499ad88b006f78de8 Author: Alan Somers AuthorDate: 2024-12-13 14:00:20 +0000 Commit: Alan Somers CommitDate: 2024-12-13 14:08:30 +0000 fusefs: FUSE_NOTIFY_INVAL_* must busy the mountpoint Unusually, the FUSE_NOTIFY_INVAL_INODE and FUSE_NOTIFY_INVAL_ENTRY messages are fully asynchronous. The server sends them to the kernel unsolicited. That means that unlike every other fuse message coming from the server, these two arrive to a potentially unbusied mountpoint. So they must explicitly busy it. Otherwise a page fault could result if the mountpoint were being unmounted. Reported by: JSML4ThWwBID69YC@protonmail.com MFC after: 2 weeks --- sys/fs/fuse/fuse_device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c index 087316e86e90..0a5da63c1f54 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -439,7 +439,6 @@ fuse_device_write(struct cdev *dev, struct uio *uio, int ioflag) err = devfs_get_cdevpriv((void **)&data); if (err != 0) return (err); - mp = data->mp; if (uio->uio_resid < sizeof(struct fuse_out_header)) { SDT_PROBE2(fusefs, , device, trace, 1, @@ -542,6 +541,13 @@ fuse_device_write(struct cdev *dev, struct uio *uio, int ioflag) } else if (ohead.unique == 0){ /* unique == 0 means asynchronous notification */ SDT_PROBE1(fusefs, , device, fuse_device_write_notify, &ohead); + mp = data->mp; + vfs_ref(mp); + err = vfs_busy(mp, 0); + vfs_rel(mp); + if (err) + return (err); + switch (ohead.error) { case FUSE_NOTIFY_INVAL_ENTRY: err = fuse_internal_invalidate_entry(mp, uio); @@ -566,6 +572,7 @@ fuse_device_write(struct cdev *dev, struct uio *uio, int ioflag) /* Not implemented */ err = ENOSYS; } + vfs_unbusy(mp); } else { /* no callback at all! */ SDT_PROBE1(fusefs, , device, fuse_device_write_missing_ticket,