From nobody Thu Sep 02 07:34:39 2021 X-Original-To: freebsd-fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4CF4617B5C12 for ; Thu, 2 Sep 2021 07:34:42 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from unimail.uni-dortmund.de (mx1.hrz.uni-dortmund.de [129.217.128.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "unimail.tu-dortmund.de", Issuer "DFN-Verein Global Issuing CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H0XkV0S3nz3gyW for ; Thu, 2 Sep 2021 07:34:41 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from [192.168.111.103] (p4fd975b9.dip0.t-ipconnect.de [79.217.117.185]) (authenticated bits=0) by unimail.uni-dortmund.de (8.17.1/8.17.1) with ESMTPSA id 1827YeEO028280 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT); Thu, 2 Sep 2021 09:34:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1630568080; bh=UKOxn8kvWkw8UCmkfUd0LY8HnwJ9k40suZ1ff/OCftE=; h=To:Cc:References:From:Subject:Date:In-Reply-To; b=jLIYb0IPliqtsrlrYf12sKiPHkD9ueJnqymyPTTi+1LKlSJib9u+hlBaveVtZy803 QVTdXYvyLKE7y/QYILMPP4b7y1OYI6iIMMLjSBw5+dQWUDxpuAYZLO/Dk0Rk90wF2M dM4ZJvTQUCBZbSy/9to6gyuJEbFEnsFC+gAYhtP8= To: Konstantin Belousov Cc: freebsd-fs , Horst Schirmeier References: <55f3661e-2173-793e-4834-bbcd79d3d99e@tu-dortmund.de> <380bdcc8-bede-2a64-8e5e-031552231d82@tu-dortmund.de> <46649402-d28a-6f81-f0a8-39180b681f4c@tu-dortmund.de> From: Alexander Lochmann Subject: Re: Various unprotected accesses to buf and vnode Message-ID: <6640b87e-cc47-589b-40a6-7f181d3f077f@tu-dortmund.de> Date: Thu, 2 Sep 2021 09:34:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE-1901 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4H0XkV0S3nz3gyW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On 02.09.21 06:16, Konstantin Belousov wrote: > Ah, it is bp->b_blkno access after the b*write() functions were called > to write out and release the buffer, right. I put the patch to fix this > into https://reviews.freebsd.org/D31780 > > Please remind me what attributions to use for 'Reported by:' tagline. Last time it was '[...] issue was reported by Alexander Lochmann , who found the problem by performing lock analysis using LockDoc, see https://doi.org/10.1145/3302424.3303948.' > >>> Read e.g. sys/ufs/ufs/inode.h gerald comment above struct inode definition. >>> It provides more detailed exposure. >> Aaah. Thx. This is about the struct inode. So I assume it also applies >> for a vnode belonging to an inode. Am I right?> Vnode lock is a lock >> obtained with vn_lock(). It is up to filesystem > When needed, yes, it is a reasonable locking strategy. But I am not > sure that we actually use for any of the struct vnode fields proper, > Something closer to it is for v_writecount, but formally it is under the > vnode interlock. Although I do not think we ever modify it without holding > vnode lock, in some mode. Can this locking strategy be applied to a vnode for any other filesystem, ntfs for example? If so: Shouldn't it be written down in vnode.h? -- Technische Universität Dortmund Alexander Lochmann PGP key: 0xBC3EF6FD Otto-Hahn-Str. 16 phone: +49.231.7556141 D-44227 Dortmund fax: +49.231.7556116 http://ess.cs.tu-dortmund.de/Staff/al