Message ID | 786185.1708694102@warthog.procyon.org.uk |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-78362-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp575359dyb; Fri, 23 Feb 2024 05:15:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW5qSoTt/xqa/1j+687EC/dYPWxOb5l0p804fXRHNIuRh5/IPulHSFibEvKOu6YkCQA1hvbQsA3H9rqTVn9UNKkw02QbA== X-Google-Smtp-Source: AGHT+IEbrzEF7Juo0pi/f/lDsz2cV19WuxmdDKSo8Je2F1a5k4l9xAyBSgEXWlRpARgOKeHrNzt+ X-Received: by 2002:aa7:d60f:0:b0:565:4ac9:d69c with SMTP id c15-20020aa7d60f000000b005654ac9d69cmr1084881edr.11.1708694127426; Fri, 23 Feb 2024 05:15:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708694127; cv=pass; d=google.com; s=arc-20160816; b=EInmkAOIToBhNMYA9O/lvuKmM37reyJ7o6OwSVEDDFQ2lyO+wUm5W8hjE8OaTXm8Ei BwWusRqymsRqg6dCAwZF6ZkOcxZ9+BJAoXIKr+yL1a9il6gP5N8wEJ8/BXwMyy7UWvcF F1YjY7acOs2z6IUHHj1qEFMTsv3y/NzHV1k5SSJodLqzlrSkfOdBU4Xjn1Goc2FUpZM0 x+UVTsv8MFuIpzB/KDFLNMjnfSCSFIUkM1sYRiyXCil1X7NJ9uId0g1gPi6SyEFAGDA+ 9HQdbv1DGlo3ZT2VOIy38FXKEk+2YDx3pQJrUSHZdZv2d9qUls6AXX9dyK+UvLIdHKR4 JvkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-transfer-encoding:content-id:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :from:organization:dkim-signature; bh=TtbWAR6OLr2FDqFsVB9geJjS7w0NfEeR4GtkwedoxAM=; fh=zDNySrbs7smCKqBJTdlHhT9muNM72e5bm4RHZTc2x8Y=; b=rlvZ7nilT9WQeqxaHC0oAKZ7XlHPBw6+N2wIVpRV0ks5SjmygMRTOf176hep5V4CDR CdnZNxtP8FEhe8GMHPPDsK+QGL5sWpxf31iMi+oHkkzNaPXhZUwi/2QeMdh33kV9KgNz 5Mv9ivzQqbV5RHgY1csRT9v6RDogCuOdGRUGGF1SQm2nwZyAS9N2ArXvvUOTMd86dvC9 +2XaT+fjVz2qVU6UlmF/SE9a7VdCNGgUVq5PS3BuoAzO1zcgV38x61CXln7XnCISQQfO TzroIS8qnqJZ1bWZbsb/hEdzo4STaFni5+vHPd2znKMEUG1U/T5qiFDwik2e5louSmby iqhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UDySLg3f; 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-78362-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78362-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u25-20020a50d519000000b00564646c2f5bsi5059416edi.552.2024.02.23.05.15.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 05:15:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78362-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UDySLg3f; 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-78362-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78362-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 11D2A1F242AE for <ouuuleilei@gmail.com>; Fri, 23 Feb 2024 13:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BACAA7EF00; Fri, 23 Feb 2024 13:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UDySLg3f" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 9AD0B7AE45 for <linux-kernel@vger.kernel.org>; Fri, 23 Feb 2024 13:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708694110; cv=none; b=fvgEVSooIE0MGNiJr8FrFEcB82jmIk174UiPqS7YwqpA4XCKx7Ts3q2VEJjpJ+MLv8FqVr2tCgM/Ka/uHO1RTNONOEaBOrLzcCYW54ZjXGXoIwwuv1WfqeoABvDjFpAONKUEJEpHqRXU5qS4yGel/P/7XHPbBaBXDEDc78+awdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708694110; c=relaxed/simple; bh=NqcAryQexHKldcmtQ7oljqwVi0qu+Trmo1bd478NK5s=; h=From:To:cc:Subject:MIME-Version:Content-Type:Date:Message-ID; b=NUAC5vnUPvO+CqxIm93b7jnUB3nmd53/3TXybAVV1AkjaZGLl4hLa0eA8My1MslUF79BVxUEhDhP1Y/vPlqb66//7wD7PKWTmywnOV5NWgToTd6buc2CovCmElCo4yRXKu4InohlfCNfPA/XXfdF2ydehGsRd3/6SqBclqOswyI= 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=UDySLg3f; arc=none smtp.client-ip=170.10.129.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=1708694107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TtbWAR6OLr2FDqFsVB9geJjS7w0NfEeR4GtkwedoxAM=; b=UDySLg3fCX3knjogAKB7m/QWc0YUgIo6OIWTRqqi8Rpym18t4UEQJ6TuHp+G5fmRbtbfQw eE2pWKQTpHhC4RShUpKPvvlXUvBcHBIJS2Ic/a0Xl0bMVCQkcueMKxuFW0MynhGJy1hmT1 SmUb53eoHCV2D0OuG72cvn0bGz3oXNE= 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-653-6ZLkPUbtN3685804BkJiLg-1; Fri, 23 Feb 2024 08:15:04 -0500 X-MC-Unique: 6ZLkPUbtN3685804BkJiLg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 A62D783B825; Fri, 23 Feb 2024 13:15:03 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA8081C06713; Fri, 23 Feb 2024 13:15:02 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells <dhowells@redhat.com> To: Marc Dionne <marc.dionne@auristor.com> cc: dhowells@redhat.com, Markus Suvanto <markus.suvanto@gmail.com>, Christian Brauner <brauner@kernel.org>, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] afs: Fix endless loop in directory parsing 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-Type: text/plain; charset="us-ascii" Content-ID: <786184.1708694102.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Feb 2024 13:15:02 +0000 Message-ID: <786185.1708694102@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791695653242657189 X-GMAIL-MSGID: 1791695653242657189 |
Series |
afs: Fix endless loop in directory parsing
|
|
Commit Message
David Howells
Feb. 23, 2024, 1:15 p.m. UTC
If a directory has a block with only ".__afsXXXX" files in it (from
uncompleted silly-rename), these .__afsXXXX files are skipped but without
advancing the file position in the dir_context. This leads to
afs_dir_iterate() repeating the block again and again.
Fix this by making the code that skips the .__afsXXXX file also manually
advance the file position.
The symptoms are a soft lookup:
watchdog: BUG: soft lockup - CPU#3 stuck for 52s! [check:5737]
...
RIP: 0010:afs_dir_iterate_block+0x39/0x1fd
...
? watchdog_timer_fn+0x1a6/0x213
...
? asm_sysvec_apic_timer_interrupt+0x16/0x20
? afs_dir_iterate_block+0x39/0x1fd
afs_dir_iterate+0x10a/0x148
afs_readdir+0x30/0x4a
iterate_dir+0x93/0xd3
__do_sys_getdents64+0x6b/0xd4
This is almost certainly the actual fix for:
https://bugzilla.kernel.org/show_bug.cgi?id=218496
Fixes: 57e9d49c5452 ("afs: Hide silly-rename files from userspace")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Markus Suvanto <markus.suvanto@gmail.com>
cc: linux-afs@lists.infradead.org
---
fs/afs/dir.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On Fri, 23 Feb 2024 13:15:02 +0000, David Howells wrote: > > If a directory has a block with only ".__afsXXXX" files in it (from > uncompleted silly-rename), these .__afsXXXX files are skipped but without > advancing the file position in the dir_context. This leads to > afs_dir_iterate() repeating the block again and again. > > Fix this by making the code that skips the .__afsXXXX file also manually > advance the file position. > > [...] Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes [1/1] afs: Fix endless loop in directory parsing https://git.kernel.org/vfs/vfs/c/c7742709248d
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index b5b8de521f99..8a67fc427e74 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -479,8 +479,10 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode, dire->u.name[0] == '.' && ctx->actor != afs_lookup_filldir && ctx->actor != afs_lookup_one_filldir && - memcmp(dire->u.name, ".__afs", 6) == 0) + memcmp(dire->u.name, ".__afs", 6) == 0) { + ctx->pos = blkoff + next * sizeof(union afs_xdr_dirent); continue; + } /* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen,