From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796053927; b=Y0oO1FjKQWI1H6045TKeDCtPkVSnyYD9YV8hRHjLMJCN61E4qNAII1stgkawsPYD5d/z buLU9FUMgWZLRhfgLECkA7W0kWYP1rcLuAv4w7C9RkUIG0wNiY5pROLkuYYiECIbeif6Z wmweSod22D019zRWEhc5LUY0Zi7qEPCvpj8qIqc5G+HADejNyPym37iT1BQV74OXVkSZk X67yZoZLq8SIH4FXV2sLUbzsoJWkcmEPxE1yKp0h+XejLQkIeKEKR0OzNVpw132QkAaup R2JKgjTrktM/HtmP/FrxaPcPUloX8r16bM7VZjVb0M0m34UaYqCnwag8xyLqALUpTNA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796053927; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=Slm1N16Ie74I8jGhyo17zm3Q/n4sqAsWLSdJrKg81DA=; b=13JgrIytQb1tDl3heVBRfU0UM+Mi1dC+ghpccvC++H8kmKSYd1jqe+8fRH43MgtrscVA fIYR6jvlSzDBy/Gqk2YW5pZYjiiWN6fs2BW4XeRouZ4M6tW6yOcr8vF0tR0BpvFBWLAXn jN0R/4Of5VdP66IEA1Lk5ODCHtPtL/6q/drdkM7YeH1Ptk7yAR9PircjBl2kwDyycHaaX ANuRdDyM9r4ReZofw6wmeYJCQvUn5Jg27bjUT8/g+mejtMB6YSsdfrVoET8GD+/oA52/3 jQrampt0oma93KvGifQKHFdH8uIlRUm8X5IEFs44yZUicGLxN97/EvP2QgRU3O8UadA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CtLEDN57; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 954DE606A32C; Mon, 30 Nov 2026 15:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CtLEDN57 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3904F1F00929; Mon, 30 Nov 2026 15:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796053927; bh=Slm1N16Ie74I8jGhyo17zm3Q/n4sqAsWLSdJrKg81DA=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=CtLEDN575YO1Ehf0PZNHQa8YxxSLSTCrHJ8gXdFYYQ2ajursLxc5MNh8Fgy/746pA lb8FPLtsVnRlll/FL8f7bH9HsoR0iHTROFwRf0V6T2Vml0IcMF9sFBkEUVIbdBqx9j Wg8ht+YX3T2BkvzLE2kgdyQ374HMLA9FtFFF3qmiAr5vKeYpNjwgRudBblRKXMQgZn b+fkFhVRqSAvkXrmaPxazujztM5idIRckL6dxfc1X6vij2nwsg2tyEjagYTVvVrkWa YZ5ICI+qAWC8YEw9XeRsPXtRjkaH80HXBapbUV2XCEm5e370j0sarqb3wAbzNsTaAn +AkGXe251vcSw== From: Christian Brauner Date: Mon, 30 Nov 2026 16:51:38 +0100 Subject: [PATCH 2/4] xattr: let listxattrat() and removexattrat() handle AT_FDCWD X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-work-xattr-at_fdcwd-misc-v1-2-ab8a1727f992@kernel.org> References: <20261130-work-xattr-at_fdcwd-misc-v1-0-ab8a1727f992@kernel.org> In-Reply-To: <20261130-work-xattr-at_fdcwd-misc-v1-0-ab8a1727f992@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Andreas Gruenbacher , Jan Kara , Alexander Viro , =?utf-8?q?Christian_G=C3=B6ttsche?= , linux-kernel@vger.kernel.org, "Christian Brauner (Amutable)" X-Mailer: b4 0.17-dev-04696 X-Developer-Signature: v=1; a=openpgp-sha256; l=1312; i=brauner@kernel.org; h=from:subject:message-id; bh=+3aEbmDIZWRZDWMIzJXYmlG+TRNxpIkM4FGRekyQuWc=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWTzzp759bhQnXnz2iN/FRbJt00s3KTakRAl92pCO4fsA 9evgbfZOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACaS3sTwzyb11SVuPo283y5h IQ2n/nj33+VM9mAW75ppvifJZrvwT0aGiVXnH62QaKnrjf5bPt3l8Z1mo1UTNl8PlV7UPNFmzVc NPgA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 Commit f520bed25d17 ("fs/xattr: Fix handling of AT_FDCWD in setxattrat(2) and getxattrat(2)") made setxattrat() and getxattrat() operate on the current working directory when called with AT_FDCWD, an empty path and AT_EMPTY_PATH, the same way fstatat() does. listxattrat() and removexattrat() didn't get the same fix and still fail with EBADF. Do what setxattrat() and getxattrat() do. Fixes: 6140be90ec70 ("fs/xattr: add *at family syscalls") Signed-off-by: Christian Brauner (Amutable) --- fs/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index 8e7cceeb0d23c..0c59dfcbe6958 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -1026,7 +1026,7 @@ static ssize_t path_listxattrat(int dfd, const char __user *pathname, return -EINVAL; CLASS(filename_maybe_null, filename)(pathname, at_flags); - if (!filename) { + if (!filename && dfd >= 0) { CLASS(fd, f)(dfd); if (fd_empty(f)) return -EBADF; @@ -1127,7 +1127,7 @@ static int path_removexattrat(int dfd, const char __user *pathname, return error; CLASS(filename_maybe_null, filename)(pathname, at_flags); - if (!filename) { + if (!filename && dfd >= 0) { CLASS(fd, f)(dfd); if (fd_empty(f)) return -EBADF; -- 2.53.0