Message ID | 20240122223230.4000595-8-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:805:b0:101:a8e8:374 with SMTP id e5csp41307dyi; Mon, 22 Jan 2024 14:38:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEV/oN7o73PliMT2XdXh3iqhpTjCU7QtTKrcbcaSqwjfUGR8byQkKy2LEskfij83qLitqyu X-Received: by 2002:a05:6358:f1c3:b0:176:4d42:6b71 with SMTP id kr3-20020a056358f1c300b001764d426b71mr1483034rwb.13.1705963102977; Mon, 22 Jan 2024 14:38:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705963102; cv=pass; d=google.com; s=arc-20160816; b=Tuj3b35fzBbm1Vww1RjNdQP8PUaZchs41L+z8Yj6ELgwlgrGQhBPdB2yEEyeF3MrIJ wtYOIFjpj/9mNN+KmYhJP03q5LpiWITGSEPuzPTVMacXWRh9zA1MYjhcbSz5F7+JYdmP AsVUVhUpAlv1IJM/Psh2DvkSfpenAAqLTJjbIxHglaUWXQgAc/RePLi/1+2wbA+VcIBc k2zVikkc7GlrRbf9I6r34J59mdNbpOHcAfrR3iBHSOwObmEZrqmOmh+g4IQjnqXelhp9 0P2vE/D7UOei+GKsmIIi4xpPAC1kYhJbRw1860XQ321Fg64Vnp0V+psW83Q0eAlBjIzj IFBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AQmuqxaeIGZelSODTss8gWd4P9SrQf4vDlsO0SnTpdE=; fh=jD/G7UrdWzQUaVcsyZL0Br5qChVzoyKXvXZLpQibT6A=; b=JB7KVgIAlUfDAEL7Ext2r779EXldOYWY5aOY1s31CooJpUwAP+hdUgD/4GcnjsKx8D nNoiPNqc3IBbS8eRKbatcTOeevnezzeFKcjbpi1fYVJalf74Gz2ZM9j6CkBiEc1kALQu s7RsnFToh3OFvg0M8gT5Bi3rYCFc7IFiQPAFOJvHcjLmmoO5CmKpZtU32U02vkXIKxS+ 7IQ4IAO3+OPd8OHSasQgj9+cEIUwL2PVvQ0snUwlr0oyChrqqoqcVjW1+dmeoEIglbB/ Nisjwnkp6hdoUKaVaWKsi3RbLCRIFFheYmst/Qx9qSxBqtMQGG/khr1i6hjgH34ycQJb EHog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HFtr8aQN; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u8-20020a631408000000b005ce04177acbsi8575051pgl.399.2024.01.22.14.38.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 14:38:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HFtr8aQN; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34247-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DF301B24D53 for <ouuuleilei@gmail.com>; Mon, 22 Jan 2024 22:36:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB1B74C612; Mon, 22 Jan 2024 22:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HFtr8aQN" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8F9524BA88 for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 22:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705962783; cv=none; b=ukXEQwqYlF88AOi9t9YvMUf5fv2DPvjwyxtiW3IySsY7wLU7m6M9TC58+qfCK964rAo05hs8qXYXfMqruvneRw84k+3XoDgtCgc7rKnf9yW9hYFW/Ud08rN+PZBgKmnlkd+jUi75onjiIB9WI0CTme4fvTAmno9Ek3jA82fmVa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705962783; c=relaxed/simple; bh=6H3U2xFlfhw33p6fngsaEo/JwWggI7/BGAeipSgCLFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=deZKjaETmRWGFmPu9VzX2+fqFgQ+AudTlxQIE+3PoHv8K1VMxc19DquW5B6IbMjJf3kqIQSbKVfrZOuDMkuBObfZsSu4fh6juqSy/nNfWovZI36SqJB37MTgTTL3UYeQk4Z8HrcNkf0IAZlH0nlDB0qqVNRfxC6F/IXUHTm8O2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=HFtr8aQN; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705962779; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AQmuqxaeIGZelSODTss8gWd4P9SrQf4vDlsO0SnTpdE=; b=HFtr8aQNrEW4Uv4Kckk8BJeFDYH84J8zfuAo0/XBqOfOe7zsG801VnYjA92AZj8lekOblc 3vrqRm8NAtJU+WJAHmqz5sHo94rPb4JkFgIDj8MZeyuBYow2GXsn+uHOr+OZ0WAueBfO5p NZ+MglXINlp6yvjtsjrK72uETJ7B+dA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-446-I213UdhrNQ-UHiAkjXvHRQ-1; Mon, 22 Jan 2024 17:32:54 -0500 X-MC-Unique: I213UdhrNQ-UHiAkjXvHRQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4F7980007C; Mon, 22 Jan 2024 22:32:53 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id D97A93C2E; Mon, 22 Jan 2024 22:32:51 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Christian Brauner <christian@brauner.io> Cc: David Howells <dhowells@redhat.com>, Jeff Layton <jlayton@kernel.org>, Matthew Wilcox <willy@infradead.org>, netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Marc Dionne <marc.dionne@auristor.com> Subject: [PATCH v2 07/10] afs: Hide silly-rename files from userspace Date: Mon, 22 Jan 2024 22:32:20 +0000 Message-ID: <20240122223230.4000595-8-dhowells@redhat.com> In-Reply-To: <20240122223230.4000595-1-dhowells@redhat.com> References: <20240122223230.4000595-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788831966610872129 X-GMAIL-MSGID: 1788831966610872129 |
Series |
netfs, afs, cifs, cachefiles, erofs: Miscellaneous fixes
|
|
Commit Message
David Howells
Jan. 22, 2024, 10:32 p.m. UTC
There appears to be a race between silly-rename files being created/removed
and various userspace tools iterating over the contents of a directory,
leading to such errors as:
find: './kernel/.tmp_cpio_dir/include/dt-bindings/reset/.__afs2080': No such file or directory
tar: ./include/linux/greybus/.__afs3C95: File removed before we read it
when building a kernel.
Fix afs_readdir() so that it doesn't return .__afsXXXX silly-rename files
to userspace. This doesn't stop them being looked up directly by name as
we need to be able to look them up from within the kernel as part of the
silly-rename algorithm.
Fixes: 79ddbfa500b3 ("afs: Implement sillyrename for unlink and rename")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
---
fs/afs/dir.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 3f73d61f7c8a..eface67ccc06 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -474,6 +474,14 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode, continue; } + /* Don't expose silly rename entries to userspace. */ + if (nlen > 6 && + dire->u.name[0] == '.' && + ctx->actor != afs_lookup_filldir && + ctx->actor != afs_lookup_one_filldir && + memcmp(dire->u.name, ".__afs", 6) == 0) + continue; + /* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode),