From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796544433; b=ku6Qcw572wTi3sTEOWRL6CNFvdCy+cJIa3srg8Tm5Jxcnfd6zcCyvtScuydJs5Q4IptQ uQkA/V7na9hWiEO4DdBhlimJKvyFMiOkhoY11754VrZqMOkeLEJV7l1D9oVXPN1THLOnE xnsuh8ipHkaOOGtVKOzOr0il1bdme9BLK9KGXB4AMlalCShhZk+0fBlbThjylE0DAuK7i OYNYYHBBiQSbRjn2tFaFhKAKlzOhabpCH0Ixpdx7yCGq4XfpSsxjLvVChEvyIXC6nSbZC WwxbVbVi8br5f5aDpcZeN7gz7L/XxcibM4cz31S6bhmZgAzxHdiEnFdeuoUNhh3NA/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796544433; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:MIME-Version:Content-Transfer-Encoding:X-Scanned-By; bh=o813CkuJk1t/KNoMtXr3U2I+57jG3k1e3x+BuZBVitE=; b=PPxRqbmJ5mVEvar4WGa1Kvu5dnnNura7I9EfbS94/NB3L/ov2NtV1Llis8zOulxuBqek n4UhvB4gVYYuu2AVPqH71pI9exjted2frvgvy0IPyxRcVkTTmw3TrjKoDAUiXEwIjbK00 rEOTYYZdgbgWeAOi3TU/2e7NqZ9yOjb1dHflxMsd2dQIxgSCEfhdNaR6ZZQZpPb21wUSE nK2jfWe9+nUzQODS4PIJc7A6ELEotxmeZNX/Y3I9p+tjapSKZbHZJahWzygofSFEqb7pv Ru+UhSwIv+rumNorDTUortOsumts7Yf7hRKKjHOs5mxZDD61/WaQK/EcIrubydfRBLQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cACQM6Q0; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30B92606A321 for ; Sun, 6 Dec 2026 08:07:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 30B92606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cACQM6Q0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796544432; 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; bh=o813CkuJk1t/KNoMtXr3U2I+57jG3k1e3x+BuZBVitE=; b=cACQM6Q0S+OKidt3q40aS9LBUbPkpugRH5f29LzjoQKMvRVZhMII0ueJuVkoR2SQy/WgFx kDjrU5kfJCmaZjX2Z1xTCUtrtBFCmshY0dYc2R/BZ9qEmmEvzYDKI7iH8AEP9lcveystLq YAxhcUkGv6WP5J7yEkLL3L6erzuLEJw= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS with 8BITMIME (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-ekp53eOGM2exBmJMo9EUzQ-1; Sun, 6 Dec 2026 08:07:07 +0000 X-MC-Unique: ekp53eOGM2exBmJMo9EUzQ-1 X-Mimecast-MFC-AGG-ID: ekp53eOGM2exBmJMo9EUzQ_1796544426 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 31765180034E; Sun, 6 Dec 2026 08:07:06 +0000 (UTC) Received: from snishika-thinkpadp16vgen1.tokyo.csb (headnet03.pony-001.prod.rdu2.dc.redhat.com [10.4.224.30]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 42D0A18023D9; Sun, 6 Dec 2026 08:07:03 +0000 (UTC) From: Seiji Nishikawa To: Jan Kara Cc: Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Seiji Nishikawa Subject: [PATCH v2 0/3] fsnotify: fix races on mark mask, flags and ignore mask Date: Sun, 6 Dec 2026 17:06:47 +0900 Message-ID: <20261206080650.1945355-1-snishika@redhat.com> 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-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 This is v2 of "inotify: do not expose a zero mask while replacing a watch" [1]. In the review of v1, Jan pointed out that more places need the same treatment, on the read side and on the write side, and that send_to_group() clears the ignore mask without a lock and races with the other updates of the ignore mask. This series covers these points. Patch 1 is the v1 patch. Patch 2 clears the ignore mask under mark->lock. Patch 3 adds READ_ONCE() to the remaining reads of mark->mask, mark->flags and mark->ignore_mask that are done without mark->lock, and WRITE_ONCE() to the remaining writes of these fields. [1] https://lore.kernel.org/all/20261019230320.1855016-1-snishika@redhat.com/ Seiji Nishikawa (3): inotify: do not expose a zero mask while replacing a watch fsnotify: clear the ignore mask under mark->lock fsnotify: annotate lockless accesses to mark masks and flags fs/notify/dnotify/dnotify.c | 2 +- fs/notify/fanotify/fanotify.c | 12 +++++++---- fs/notify/fanotify/fanotify.h | 7 +++--- fs/notify/fanotify/fanotify_user.c | 32 +++++++++++++++++----------- fs/notify/fdinfo.c | 10 +++++---- fs/notify/fsnotify.c | 24 ++++++++++++++++----- fs/notify/inotify/inotify.h | 7 +++--- fs/notify/inotify/inotify_fsnotify.c | 2 +- fs/notify/inotify/inotify_user.c | 17 +++++++++++---- fs/notify/mark.c | 32 ++++++++++++++++------------ include/linux/fsnotify_backend.h | 17 ++++++++------- 11 files changed, 103 insertions(+), 59 deletions(-) base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 -- 2.43.0