From nobody Tue Jul 29 13:55:46 2025 X-Original-To: dev-commits-src-main@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 4brxh92d2cz631fd; Tue, 29 Jul 2025 13:55:53 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brxh90Z3gz3GMV; Tue, 29 Jul 2025 13:55:53 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-7e1f3b95449so102748685a.1; Tue, 29 Jul 2025 06:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753797350; x=1754402150; darn=freebsd.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=B80Nm0gCl8CqKQfle0hnzhqxHp4ZfUhz3lIya7VQ2Eg=; b=RVLbYlIVTaMWgeew9jHMcLh62NRlRq8J1R3ZhsMOcgoJsSaH16hmCEQ1yAp1NGE3iT BgwbwFdKDHlTtfZnqYpGTrHl8+Bfecy9GgwdZGG2IGvBSlL6h422roTCkEsxp9M74m0y 7Q1pfSeu19XkC8RpQWZASAa1cQxqQ5eRuc6RZ9FRfm2MMJOUUw4wE5g+ll/go8fK5N8V rK1i/MZ4Ig9xw5VRccygIhAOdEk9jZXoYVutE/Xp56lGhVMuhjnga2daZgwUK2E2V27h 7AIGJFgXto3Py6Ki9MVKco/hyJa+nhApr8kYlTVGrioEXhOCz1B5325T7q1Yjw7mOHA2 HyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753797350; x=1754402150; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B80Nm0gCl8CqKQfle0hnzhqxHp4ZfUhz3lIya7VQ2Eg=; b=EHao1lcUUnsakefEfIFq1yQabfIdIJ2VZfwgsIIZNiMtJH2Z60I2lB42rbKpo1CB/m Dic2u8LbTXEDMsDpscY9XbUdbLHqJCAgNKYTsWdZAzmig3XvbCiULDPByXUuJuDoqNgg iU0H5p/roIjpGFlxnXfIJvLixgo/ZRUfv/H54nwA/cnDjyij4wcZ3UtJ1bCyzjZ02eFD E7YzQYqIYLzshLgdqQK/B1CQB7Reps7KnvtFPU5sbB1gmMFoYISrrxWgUtpGE+4Y4LJH 99oAM0RSqhQS7rqAdFJOoOCjKja0RnVGWVs/fEooF54CCyYrECn/snKW9nkyd82vWwFp oYVw== X-Forwarded-Encrypted: i=1; AJvYcCUC4D1Wnb2jecuvtxuKzNX+RNSJIWshScaUmZuIwFu0AAkUGmbwwFQbQ+3JJ4L1/pmaz9lJbv6DBTxpFlxd5/KYvmNkhcI=@freebsd.org, AJvYcCVtpJRcuDsNSU9+J9GRmRGcObWCo4p09n13wgqfZwbz8HfKTpvowXtYRHZWN8bA+zOB7h6BnO4lkvB8KBG1gXE=@freebsd.org, AJvYcCWWHYSa/5oDn9glXrlt6rAxGaDW2RxVEBM4sGH0G8yj9tGgHHGfE+wcf2TWyYUUPkHTGD2r10M5jjMtJjNrJm7kK9Tp@freebsd.org X-Gm-Message-State: AOJu0YzxjwovY0Thj7hTIit/flA9/bSfLW4T/Ll20g7qwPpSaQ6GC+eu 1bcBnxrS+eUSR8hDltamDiVI+aGPXgyCHF70umQIQhnMTRTDNa7D1hfD X-Gm-Gg: ASbGncv7Bpde/LI96bzTX2igD8rw3QmMy6LmcVaxh8ukQ1xroxoL+uY+bit71ABBU5S RqlRyvip20QcyQEG4fY70wduh8Gzuedanrxwv5UO0XqdxwmqpAnqMTeAPe1uwclERSHH3voS5cU 0mRpxqoOGotiLG68uPoIdjJ+tRgDBTM3/7f9id2K2J9ZoGn8sg4AOAnnJS6UyZoGb6/Hm318Csd XDKijP99Zt6tPR1ueCNqxYxm/uVIjCbKwaMpYSgp0npbGpx1Cs6SOOnIWmS7miH3+NqBuwYniR/ pwT7Ea/CKFQUHASp+ro4CR4JBwJzvWrSUNLgBTPNj6wecjxsmZBMZdtS3xc8DNdE5mwD3RsXf0z 956pyzQrJAAJvGdmXIYZ3CtYhevg5J9hB4i0A X-Google-Smtp-Source: AGHT+IEbxMX0znUhRkKY3m8rShudW9cMoVzNxqf0As47o+u8i7uA32QXpZ2NeFiYkN0t+yl8KJjKzQ== X-Received: by 2002:a05:620a:268f:b0:7dc:86f1:ee1a with SMTP id af79cd13be357-7e65f281c5emr489547885a.11.1753797350298; Tue, 29 Jul 2025 06:55:50 -0700 (PDT) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7e64328255bsm423271385a.17.2025.07.29.06.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jul 2025 06:55:49 -0700 (PDT) Date: Tue, 29 Jul 2025 09:55:46 -0400 From: Mark Johnston To: Konstantin Belousov Cc: mckusick@freebsd.org, 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 the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4brxh90Z3gz3GMV 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:15169, ipnet:2607:f8b0::/32, country:US] On Tue, Jul 29, 2025 at 04:45:30PM +0300, Konstantin Belousov wrote: > 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. While phab is down, this should fix it, and another error with > the signess of the inum passed in isrmdir (the > 1 check would fail in > fact). > > While the phab is broken, I am posting the fix there. This looks right to me. I quickly tested it with the reproducers from syzbot and didn't see any problems. I'd also rename non-bool isrmdir to something like "newparent", just to make it a bit clearer that it's not a boolean value.