From owner-dev-commits-src-main@freebsd.org Fri May 28 21:35:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70AE36327E2; Fri, 28 May 2021 21:35:28 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (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 "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FsHzM2pq1z4mdW; Fri, 28 May 2021 21:35:26 +0000 (UTC) (envelope-from rob.fx907@gmail.com) Received: by mail-ot1-x32f.google.com with SMTP id v19-20020a0568301413b0290304f00e3d88so4819933otp.4; Fri, 28 May 2021 14:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9I5nuHr58RZL99yOwhMBQgvMwPXwLpnyCxNcare0fuY=; b=sTRCXgb2Bjp6CLub5E4kjDPv45THv/DsvtsK2kY/7bu8SbsDMlLxxKIgd4gg0zGTPp uA2P4vxfKDAK9GMLI3C8yu8a/AA+YE2JbQOg8BB+EY/Dm7E5aIV5vvQsNJagZRr2aZB4 g4/r3Huj0Pp4nP4ljkgjx0bUm7h+jSR/kk6dt+yF+b/AeV0cPjU1iAZPR7w6VIjhKmdV kMXPRVTYf4BN5A0SfakcJM3e709x5CuTxtDzMibufrMbYszb6ttdDOV/D4Ic6ap+yzsw TQCDs2PWr52qdD+Hs3ue8n/gTwsE0nZM5K6B9WPTbCJ4HSF/1+j9J/CssjTNymlbpGqp DLMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9I5nuHr58RZL99yOwhMBQgvMwPXwLpnyCxNcare0fuY=; b=ZJ9iSU6K7hIK5TZnldjlmzboH7mUoQjrkAe8oH/S+d6vmbz/7hUau7+ImV3aICX75r ecbJwqyBNIv5jmmLYZbK74Ht2cPdTkTXKJQfS6IiTZjAVthSz71q7XHol5EPPnYRp9Wi GZlaofrOd1uKNLAD3vUqw5b+wbnb0AZfVnPBCY5F+O3wWSmRZPKFmovM274H7GJPFQK8 XRMRfpNxuTzvlxIA+Ay4LS3LegRmEjpaSjAIXTiRhQPbrCPAE1EQD0WOsOheTq+T/EPY bpZG+WA8gUF2+uRIUXhnpi5pAYp4UsJzNr38VLiMh2x/ntYfd3zpycoa49832Yg7Ixtz 5mQw== X-Gm-Message-State: AOAM531mxXitgZrSFA9Zb067Tp8GBIYkjNezzr3/Soc+bcyKspCNh1Qx F5xnf96FLN1dcMtk90ONXwjaYgYvG/chA5GuGAq4r1Pn7mOuB+YO X-Google-Smtp-Source: ABdhPJzfHMRi7Y5LbUD8oyQdyWmSW8yMm9UlTe47S5YjZLiPW98EwkXCs10f9TzB/A7KWghNY7Wm6/ocdH590HtMTjA= X-Received: by 2002:a05:6830:1556:: with SMTP id l22mr8680042otp.34.1622237725208; Fri, 28 May 2021 14:35:25 -0700 (PDT) MIME-Version: 1.0 References: <202105212038.14LKcb3U062829@gitrepo.freebsd.org> <4faa0667-ca1b-923b-fbae-c97b0b863589@FreeBSD.org> In-Reply-To: From: Rob Wing Date: Fri, 28 May 2021 13:35:55 -0800 Message-ID: Subject: Re: git: f190f9193bc1 - main - Fix fsck_ufs segfaults with gjournal (SU+J) To: John Baldwin Cc: Kirk McKusick , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4FsHzM2pq1z4mdW X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=sTRCXgb2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of robfx907@gmail.com designates 2607:f8b0:4864:20::32f as permitted sender) smtp.mailfrom=robfx907@gmail.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::32f:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_SPAM_SHORT(0.54)[0.544]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::32f:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::32f:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2021 21:35:28 -0000 I put a revision up https://reviews.freebsd.org/D30537 if anyone wants to have a look. As John already pointed out, readsb() is what sets fs_bsize. I considered placing the setup() routine after sblock_init()..but decided to add an additional bufinit() call just before gjournal_check as it is the least intrusive fix I can come up with at the moment, while still fixing the original bug and (hopefully) not introducing others. -Rob On Fri, May 28, 2021 at 1:21 AM Rob Wing wrote: > Hmm, I provided a fix for ( > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D245907) and it appear= s > to have created a spiderweb of breakage - as noted by jhb and chs (in com= mit > 84768d114951e88288024f09d4beae0956c3cf21). > > I=E2=80=99ll have some time to dig into this in the next day or two. > > In the meantime, the best idea I have for an immediate fix is to revert > the aforementioned commit and commit f190f9193bc10a8193c87e0a02fa91400e4e= b159, > then apply/test the patch found at: > https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D225092&action=3Ddif= f > > If there=E2=80=99s any input or suggestions, let me know. > > Thanks, > Rob > > > On Thursday, May 27, 2021, John Baldwin wrote: > >> On 5/21/21 1:38 PM, Kirk McKusick wrote: >> >>> The branch main has been updated by mckusick: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=3Df190f9193bc10a8193c87e0a02fa9= 1400e4eb159 >>> >>> commit f190f9193bc10a8193c87e0a02fa91400e4eb159 >>> Author: Kirk McKusick >>> AuthorDate: 2021-05-21 20:41:40 +0000 >>> Commit: Kirk McKusick >>> CommitDate: 2021-05-21 20:42:37 +0000 >>> >>> Fix fsck_ufs segfaults with gjournal (SU+J) >>> The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.= c) >>> while attempting to traverse the buffer cache to flush dirty >>> buffers. >>> The tail queue used for the buffer cache was not initialized befor= e >>> dropping into gjournal_check(). Move the buffer initialization >>> earlier >>> so that it has been done before calling gjournal_check(). >>> >> >> This appears to have broken fsck in at least some use cases. On my rpi >> I get this error trying to boot: >> >> Setting hostid: 0x4ce29432. >> Starting file system checks: >> fsck_ufs: Initial malloc(-1515870811) failed >> fsck_ufs: Initial malloc(-1515870811) failed >> Automatic file system check failed; help! >> ERROR: ABORTING BOOT (sending SIGTERM to parent)! >> >> The amount being passed to malloc() is malloc junk: >> >> (gdb) p/x -1515870811 >> $1 =3D 0xa5a5a5a5 >> >> The i386 CI jobs in jenkins have been failing with the same error recent= ly >> as well. >> >> I guess this means sblock isn't fully initialized by sblock_init()? At >> least >> not enough to set fs_bsize? Hmm, perhaps readsb() is what sets fs_bsize= ? >> >> -- >> John Baldwin >> >