Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp836538rbd; Fri, 23 Feb 2024 05:15:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUh5Wns2V9s9kU+T6CeWCyoAh4Sdnsx1obdFlyWNCrIDonSVqRp2RVVROATA3QEBXuvja5un2QtNouo9E9Mh1nVmUz0fayzaBtVgVd2KA== X-Google-Smtp-Source: AGHT+IEHKoTYvciTr6eKa1nicJgrT8U/6ezrw7aBgCu9ykyPZ0DwAZMpSMKm6+NyQOq9LILkfGlH X-Received: by 2002:a17:906:7f91:b0:a3e:6a25:2603 with SMTP id f17-20020a1709067f9100b00a3e6a252603mr1220539ejr.33.1708694117883; Fri, 23 Feb 2024 05:15:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708694117; cv=pass; d=google.com; s=arc-20160816; b=l98MZujj2fgPiklIi/mTXPiPBAEAgKI8kCnqsIuuVLPVEUkdVDVzRz+yak3GGpPPgS 5KS6Ak1Xt2RS9mdbqM93fiO1FYvF3PUQXE7pyPByUkTBJ7+g9BTGKD7MyNE5lSEa5CfX uvxGOxaPK3LgLZg/x5wk4SFSfSSaK8OxksjC6JUeIKapLYeNuEX5peLzfDj+oK5EPV+T 0FGM3EQk4IHKBTRm0HnQmLpCFrx/6Y/F8e8kVa+78jGbkVu2Aqqk+j6nrwd8GpATR+G9 3uFSrgwTp6jBPiPNev4akF6FgNXBkJhaRjZ8J3BmyCNlMZBWMa07L7tZblSyA+TqSrRt 4LFQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78362-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id js1-20020a17090797c100b00a3f59204145si2135916ejc.1005.2024.02.23.05.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 05:15:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78362-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78362-linux.lists.archive=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 88FE01F2444D for ; Fri, 23 Feb 2024 13:15:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03DEA7E787; Fri, 23 Feb 2024 13:15:11 +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 ; 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 To: Marc Dionne cc: dhowells@redhat.com, Markus Suvanto , Christian Brauner , 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: List-Subscribe: List-Unsubscribe: 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 = 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=3D218496 Fixes: 57e9d49c5452 ("afs: Hide silly-rename files from userspace") Signed-off-by: David Howells cc: Marc Dionne cc: Markus Suvanto cc: linux-afs@lists.infradead.org --- fs/afs/dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 *dv= node, dire->u.name[0] =3D=3D '.' && ctx->actor !=3D afs_lookup_filldir && ctx->actor !=3D afs_lookup_one_filldir && - memcmp(dire->u.name, ".__afs", 6) =3D=3D 0) + memcmp(dire->u.name, ".__afs", 6) =3D=3D 0) { + ctx->pos =3D blkoff + next * sizeof(union afs_xdr_dirent); continue; + } = /* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen,