From nobody Tue Jul 29 13:22:56 2025 X-Original-To: dev-commits-src-all@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 4brwyQ5yBBz630HX; Tue, 29 Jul 2025 13:23:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4brwyQ39XTz3wCG; Tue, 29 Jul 2025 13:23:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 56TDMvuK068341; Tue, 29 Jul 2025 16:23:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 56TDMvuK068341 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 56TDMuj3068340; Tue, 29 Jul 2025 16:22:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 29 Jul 2025 16:22:56 +0300 From: Konstantin Belousov To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 610319c766e9 - main - ufs_vnops.c: newparent is not bool Message-ID: References: <202507282057.56SKvL6x019403@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home X-Rspamd-Queue-Id: 4brwyQ39XTz3wCG X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Tue, Jul 29, 2025 at 09:16:23AM -0400, Mark Johnston wrote: > On Tue, Jul 29, 2025 at 04:01:46PM +0300, Konstantin Belousov wrote: > > On Tue, Jul 29, 2025 at 08:26:52AM -0400, Mark Johnston wrote: > > > On Mon, Jul 28, 2025 at 08:57:21PM +0000, Konstantin Belousov wrote: > > > > The branch main has been updated by kib: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=610319c766e941de96e52f2d28fea9f8cfc51aeb > > > > > > > > commit 610319c766e941de96e52f2d28fea9f8cfc51aeb > > > > Author: Konstantin Belousov > > > > AuthorDate: 2025-07-27 13:50:57 +0000 > > > > Commit: Konstantin Belousov > > > > CommitDate: 2025-07-28 20:57:14 +0000 > > > > > > > > ufs_vnops.c: newparent is not bool > > > > > > > > Use proper comparision operators when we need to see if newparent was > > > > set to not-zero value. > > > > > > > > Reviewed by: mckusick, olce > > > > Sponsored by: The FreeBSD Foundation > > > > MFC after: 1 week > > > > Differential revision: https://reviews.freebsd.org/D51573 > > > > --- > > > > sys/ufs/ufs/ufs_vnops.c | 15 +++++++-------- > > > > 1 file changed, 7 insertions(+), 8 deletions(-) > > > > > > > > diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c > > > > index 406b8f943077..2757fb066981 100644 > > > > --- a/sys/ufs/ufs/ufs_vnops.c > > > > +++ b/sys/ufs/ufs/ufs_vnops.c > > > > @@ -1476,7 +1476,7 @@ relock: > > > > * the user must have write permission in the source so > > > > * as to be able to change "..". > > > > */ > > > > - if (doingdirectory && newparent) { > > > > + if (doingdirectory && newparent != 0) { > > > > error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, curthread); > > > > if (error) > > > > goto unlockout; > > > > @@ -1539,7 +1539,7 @@ relock: > > > > if (tip == NULL) { > > > > if (ITODEV(tdp) != ITODEV(fip)) > > > > panic("ufs_rename: EXDEV"); > > > > - if (doingdirectory && newparent) { > > > > + if (doingdirectory && newparent != 0) { > > > > /* > > > > * Account for ".." in new directory. > > > > * When source and destination have the same > > > > @@ -1632,7 +1632,7 @@ relock: > > > > goto bad; > > > > } > > > > if (doingdirectory) { > > > > - if (!newparent) { > > > > + if (newparent == 0) { > > > > tdp->i_effnlink--; > > > > if (DOINGSOFTDEP(tdvp)) > > > > softdep_change_linkcnt(tdp); > > > > @@ -1642,11 +1642,10 @@ relock: > > > > softdep_change_linkcnt(tip); > > > > } > > > > error = ufs_dirrewrite(tdp, tip, fip->i_number, > > > > - IFTODT(fip->i_mode), > > > > - (doingdirectory && newparent) ? newparent : doingdirectory); > > > > + IFTODT(fip->i_mode), doingdirectory); > > > > > > Is this part of the change correct? > > > > > > syzbot is reporting some panics after this change and commit > > > c069ca085bd185eda4a90dc4bc2b76cceb74579d: > > > https://syzkaller.appspot.com/bug?extid=18722c8e4008048efb51 > > > https://syzkaller.appspot.com/bug?extid=6a4ea1e13f4e07369785 > > > https://syzkaller.appspot.com/bug?extid=5cb82352555d5d505640 > > > https://syzkaller.appspot.com/bug?extid=602fb6ee1a39abfd3b5c > > > https://syzkaller.appspot.com/bug?extid=fb35cce6a6f5075a6692 > > > https://syzkaller.appspot.com/bug?extid=6fb8cb919cc686d1a1d0 > > > https://syzkaller.appspot.com/bug?extid=98c39c45a437812f7683 > > > https://syzkaller.appspot.com/bug?extid=02cb048d48b51bcd9c41 > > > > I committed the revert, with the Fixes tag, for now. But consider: > > > > Two cases: > > 1. doingdirectory == true: > > the expression can be rewritten as newparent ? newparent : true. > > Then this is the same as true. > > > > 2. doingdirectory == false: > > then the expression is false. > > I think the problem is that the isrmdir parameter to ufs_dirrewrite() is > not a bool as the name implies. See softdep_setup_directory_change(), > which checks isrmdir > 1. Right, then revert does not fix anything.