From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a6-smtp.messagingengine.com (fout-a6-smtp.messagingengine.com [103.168.172.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 950B42AD32 for ; Thu, 7 Aug 2025 21:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754600481; cv=none; b=P+9K1+ZjEk3Bk3SBh/PfaA9cirmKyJR9F0rVorVY889ghYduYzzaTnA593UPmIsl8qBQs2+Nsp+3UmGLe4zir1rA6+0cbwRg41DsiRB4tieGXTbOSxDlrhOd63nPbly/UoIQy/ZUsnp21xBSKoHV436NFX0o+Xzy+vijTVU9zTM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754600481; c=relaxed/simple; bh=rz04v2wTBINoGu0Ur5WxqrMSyTGYU80gMg9CiAfouFI=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=mTo+GB2sJoWr/83k/9I/eZGSQEsDx0sDOe78rXGglkKdrvajNbaxosKsCJMtyTMcBqCcm2jzJQZJNCqwsTu4MW2HSD5+Lj/kCSkCKxnKL/QDvYG3PdW5bUtTCg1YmQ1IbNFOTJL0p3xCevhlzXCCbGyckOV7m+owtIoaZ8JOfo4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshtriplett.org; spf=pass smtp.mailfrom=joshtriplett.org; dkim=pass (2048-bit key) header.d=joshtriplett.org header.i=@joshtriplett.org header.b=lI+F6Ef9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TsI9nULV; arc=none smtp.client-ip=103.168.172.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshtriplett.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=joshtriplett.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=joshtriplett.org header.i=@joshtriplett.org header.b="lI+F6Ef9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TsI9nULV" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id A8E0AEC01CD for ; Thu, 7 Aug 2025 17:01:17 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 07 Aug 2025 17:01:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= joshtriplett.org; h=cc:content-type:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:subject :subject:to:to; s=fm3; t=1754600477; x=1754686877; bh=LErLBlhCuX j1NH6NqMdHEiJ4dOhbfYQfSkcVHCiovdc=; b=lI+F6Ef9AFBUrzV+Ow/v99I7RN ZMeY8N/NvCcjpys2GYljhO/OnMgmFApGZgwKGv3btUX52FTTDTYVE1VnklDZKvPt YG4qFQnzgbPa9Oj0QkSp179UE0c1Q+Uv6IxbyHMaI1iDIFQqVlI9njkvGxuoEzf5 3XkFyzGGKHaEa1DvP01Oz7HniOWQ1ZeT0qjbdSTNkadUEpocOtKlWxthfdyeIkqg twoxImaXP6TvSphjL4rBqDfXZ+WoQWrky0OmXJE+FoB6mtv4GZQ7hp2HGyRluT7G WfN0AWc93PPwDSbZAN9yUwtQUODJPEK3cvrJgShSEm6r3A6lCgNP+gG/UBnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1754600477; x= 1754686877; bh=LErLBlhCuXj1NH6NqMdHEiJ4dOhbfYQfSkcVHCiovdc=; b=T sI9nULV7aeM9QAnUsn1jIxnglyEY4XLHuaMf0zprg1DAagPt40/OTreYR8Vr0Esq vKyK+n59G1bXqX0Dj4R1WSkRX6bR1XMk7CPJkEhcVj89iXNaT+x8P9lk3Ld2u3Xl BSYD0XtqpzxOrLglviE85OS3dNttcTufCpDm9ewpnwUbG95xQBEAnBiSU5FWSSKi j8A2gW+gcbQCxZOTa1pvATLHCI3RFZiftob8ZgkshsYNhijY224yNtgE5DAxqXfR lX42NBQrpbPy3DqfnoEReH8+TFSosEo2/0TWN9vC4uBLCHimLa0ZjeBs/XAyQ/+1 LT0MfM1AKK4O7tqd8D2Qw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduvdduleeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugesthdtredttddtvd enucfhrhhomheplfhoshhhucfvrhhiphhlvghtthcuoehjohhshhesjhhoshhhthhrihhp lhgvthhtrdhorhhgqeenucggtffrrghtthgvrhhnpeelleeggedtjeejfeeuvddufeeggf ektdefkeehveeuvedvvdfhgeffgfdvgfffkeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorh hgpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehl ihhnuhigqdhfshguvghvvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i83e94755:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 7 Aug 2025 17:01:16 -0400 (EDT) Date: Thu, 7 Aug 2025 14:01:15 -0700 From: Josh Triplett To: linux-fsdevel@vger.kernel.org Subject: futimens use of utimensat does not support O_PATH fds Message-ID: Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I just discovered that opening a file with O_PATH gives an fd that works with utimensat(fd, "", times, O_EMPTY_PATH) but does *not* work with what futimens calls, which is: utimensat(fd, NULL, times, 0) The former will go through do_utimes_fd, while the latter goes through do_utimes_path. I would have expected these two cases to end up in the same codepath once they'd discovered they were operating on a file descriptor, and I would have expected both to support O_PATH file descriptors if either does. This is true for both symlinks (with O_NOFOLLOW | O_PATH) and regular files (with just O_PATH). This is on 6.12, in case it matters. Quick and dirty test program (in Rust, using rustix to make syscalls): ``` use rustix::fs::{AtFlags, OFlags, Timespec, Timestamps, UTIME_OMIT}; fn main() -> std::io::Result<()> { let f = rustix::fs::open("oldfile", OFlags::PATH | OFlags::CLOEXEC, 0o666.into())?; let times = Timestamps { last_access: Timespec { tv_sec: 0, tv_nsec: UTIME_OMIT }, last_modification: Timespec { tv_sec: 0, tv_nsec: 0 }, }; let ret = rustix::fs::utimensat(&f, "", ×, AtFlags::EMPTY_PATH); println!("utimensat: {ret:?}"); let ret = rustix::fs::futimens(&f, ×); println!("futimens: {ret:?}"); Ok(()) } ``` Is this something that would be reasonable to fix? Would a patch be welcome that makes both cases work identically and support O_PATH file descriptors?