From mboxrd@z Thu Jan 1 00:00:00 1970 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.astral-os.org; s=s2026; t=1791223320; bh=slcitVctkhqUy7EsGoYIok0VTqtyw3JFu3KrEX8Dl58=; h=From:To:Subject:Date:List-Id:List-Help:List-Owner:List-Post: List-Subscribe:List-Unsubscribe:From; b=CCitoyJ0diDDNbsOpKfXY9aoaXf9WHdDAEZVCvZ0KGuKi3oXhmBNB4Crs+Cy3aE9C +Xzcw2jo3YavsIoSOP0FdXaqRCqSWkq7utY4i9V0tmQNMLepbOSLACYmZp7lmb5xYC 9WXmJJzf/dsDZba74wJAqpLOAJpBwuZFapsrsitZAiztuBbubj/GVmHADGVQq7UCTk Z6gTDjWJxvmx1QJIdPFwq0PH5xSjqXxGUVJiGWy04yCyCZm5rijhHjO4labnAXmbiI R7IaiPIO3cDywRBf41XyIZPJrgYJANAYg6HhbUmZk1EmPxfT4MOtYSjx3dRbvJyzMi oX6ELW7td3N1g== Received: from vps-ace4d786.vps.ovh.us (localhost [127.0.0.1]) by mail.astral-os.org (Postfix) with ESMTP id A22B43ECE8; Mon, 05 Oct 2026 18:02:00 +0000 (UTC) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=lists.astral-os.org; s=arc2026; t=1791223320; b=GBPumU2nYzltkv6YX3XRhR0RFXbdo2jNa2Uv3MwzdaeJ/TuSi1bcyZq/Vb+ijUyeklPA7 vx+XezESX5X019sPjD7kBUcnGfMlIq97iQDvq/GQ2kSAV25rTx+Y4hF7WmM2Axgq8Cheua5 hWxYtoRFMp94Ab+lSgF7kNU5ro3swnlrjLHeeNLEQn2cE7DKoax0yjyIw/qsPs9GjMKn03C PzTeEyoKtPCuHcwzvkB1Smhbc+ufZrBGfBgvsxDb5sIOUchQkObTSRFtbD+KgwD5br2wUum pfxwu0o6y/9o2pqj2eVHXXYIKpJEGmTWJDG1TISJz2Cx5TGT7WpVV7VFKyzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.astral-os.org; s=arc2026; t=1791223320; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=mxcgeVdzacy2YeLLqhareSzy1EjrKty9B4z3Qpe8LEY=; b=Qi36tJFsjlI3roxMcy3M6d44SOlNN3qYGZC/Zje/6o9fFIkBCkFHbYYwQYFRi0rcWLGTB /WRpdMKe/koFf3Al6DMyJynPTnAbN9/wXDc5h967hGfnxpIUzbiq0b1YBq6+3ASTueRyE50 9DbbzkKhHF5H74mn9DLj/eRy7NfmCyxM3OgcPBCK9eDWbzM1tnbUvXgl6aJ5WoHO8CH2ZqY AfduA/17LGnTt/6xGwan0H2GuFbDcLZyMYkbIyK1d6PXMBHPCF+hV/JtYm9Ob6QjuL7pGid nB8NRHAhHs/vOlQFUOvmrESiQWT3KMeSNSJsfMfAGsBilJmBJEorL1X7RRkQ== ARC-Authentication-Results: i=1; lists.astral-os.org; dkim=pass header.d=astral-os.org; arc=none; dmarc=none Authentication-Results: lists.astral-os.org; dkim=pass header.d=astral-os.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=astral-os.org; s=mail2026; t=1791223318; bh=slcitVctkhqUy7EsGoYIok0VTqtyw3JFu3KrEX8Dl58=; h=From:To:Subject:Date:From; b=S5DDBPsSDzvqMP6MzDEdi1XTMBZOsyFraLLTa0FRtidC7q/bUTFtYXMeTw7E4LxkT 6sizFqNndROfJw558s7YVB0OkRwdlMtuW1TVdAlmJhUCFNtSIXg9RxRQAkWkTHkPPY OAYXaA0f3CKUxImTRrsAdnxAnIMwyqBfsUGJ/PNnm1LvDacYQVaUJRW1rh6kr0vy3R mkbOMwblGgcbUB8tJbcG1cOFuSvynBfWEUFQtxfJcQfrrocgqlXSb+PAZqkQiCJw1B VpnPLPZYn8XgzHAIcRYtXoZRtN1Og0q325VgUYPbl8Ib5S4Jqo+upEf+ICroPGvb1r Fw2lZMF8L8FAA== Received: from LAPTOP-R01LEAQM.localdomain (unknown [200.146.247.68]) by mail.astral-os.org (Postfix) with ESMTPSA id 8FC023ECE8 for ; Mon, 05 Oct 2026 18:01:57 +0000 (UTC) From: Matheus To: astral-devel@lists.astral-os.org Subject: [PATCH 0/5] devfs: add anonymous register/remove Date: Mon, 5 Oct 2026 15:01:47 -0300 Message-ID: <20261005180152.53359-1-matheus@astral-os.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 44CX7BUXYT26UKKKJUTZAYJBSX3Z3QJM X-Message-ID-Hash: 44CX7BUXYT26UKKKJUTZAYJBSX3Z3QJM X-MailFrom: matheus@astral-os.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Matheus The current pty code uses a very hacky way of handling devfs registration: named register -> get device by name -> remove device This is generally an unclean solution and temporarily leaves a device name in the tree which any process could open() and interfere. Add anonymous operations which work on nodes that are unnamed and directly return a pointer to the vnode. This still leaves a window which could be used to access the vnode but it is much smaller and requires a device node to already be in the filesystem (which needs root anyways). Then, move the pty implementation to use these new functions. Also fix a few related issues along the way: - These new devfs vnodes are tecnically orphaned, so they don't have a valid vfs. Doing statvfs on them could crash the system. - Fix a UAF on VOP_RELEASE, where the NULL could be set after the vfs_inactive happens but the lifetime of the object where NULL happened might be attached to the vnode lifetime. - Fix another UAF on tty code: calling devfs_remove() in tty_unregister() might cause the tty to be free'd. This results in a possible UAF. (this is also a test of the mailing list for multi-patch series and the new @astral-os.org email) Matheus (5): statvfs: handle vnodes without a vfs vfs: fix UAF on VOP_RELEASE tty: fix lifetime issue in tty_unregister() devfs: add anonymous variants to register/remove pty: use new anonymous devfs operations kernel-src/fs/devfs.c | 47 ++++++++++++++++++++++++++++++- kernel-src/include/kernel/devfs.h | 7 ++++- kernel-src/include/kernel/vfs.h | 9 +++--- kernel-src/io/pty.c | 13 +++------ kernel-src/io/tty.c | 3 ++ kernel-src/sys/syscalls/statvfs.c | 10 +++++++ 6 files changed, 74 insertions(+), 15 deletions(-) -- 2.43.0