Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1970819rwl; Thu, 5 Jan 2023 23:28:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXvwKgCKcLcB/wzlHNdFNU5VGoS7ho/ISVdnPCugS8nmq1pGbz7Vm3XW/a03hF4JsG3jkeSX X-Received: by 2002:a05:6a21:398b:b0:a7:9f6:b7b3 with SMTP id ad11-20020a056a21398b00b000a709f6b7b3mr60885745pzc.4.1672990111550; Thu, 05 Jan 2023 23:28:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672990111; cv=none; d=google.com; s=arc-20160816; b=VxUbkInrE3QJZE6BMOAAKfHFne0VKoLLzeOSpRAvsZqtADQ39Y9afSCylWaeWXjsaH 5yjKo+Ufv8AF8SNsFI1PYuiVypAq5aTnf2/9NSeoM54cOgBLyxxyYnm+xnEvSaTwhtUb 3HmEzlD9VkEXO2BzitiVcZ35tuXz7iCQ1NgK0hw7x3EJYJcEVvImVIZ72zWl5GM5TeyG 71nVLnz8J03pr2v/2CsHK2rnXYD4O4cRAE7hcKYhMtHcDtFsxyloSzsBxeu3SWa8Itfu ovjvzJZLIb09TZ4q31lmeYinomhiGT0WkrQHxhiUk2nUVYZo+u5rk8WBs3ij3kD8+qca rEKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=ysvQ5mWCfecP1pnK0ECpg7dYPVloD8TUDMgLXFROJSc=; b=NaEuVLWObVOl4BR473Vm6FyKLbXiTh3f5Zp4BeqYEhds7TziTsQCSWN8cb2hz03Sr0 f5W/xK45q9jw5lcG+LbrCwPjoNk0NBe17BkdWoDv1IMyS3XQNdKwJ7DMqCQWV9olhwy3 JY019GLp1IDRFS/qjPm+KTO2fZskRbiryRknMOfHaAOLlZz2UbSvl7h+5RgjWmlB4kxs 7orvdvkzQZpWdSFqASGhkRxJjfDb86bwdnDsllXMnL/Gjo+0Q6SBSo7C+9GyJz9Yit5x JDjx4Qjs+sGryjMdPN4q+HuzosyUoJsLPVnbhiARiMQP8l8VtO6qHQPbfUfxaqqRWL7O iMMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gL/Ugv/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a630205000000b0049ac8638781si653273pgc.643.2023.01.05.23.28.23; Thu, 05 Jan 2023 23:28:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="gL/Ugv/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbjAFHJu (ORCPT + 54 others); Fri, 6 Jan 2023 02:09:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231789AbjAFHJp (ORCPT ); Fri, 6 Jan 2023 02:09:45 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE34771FE7; Thu, 5 Jan 2023 23:09:23 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id fz16-20020a17090b025000b002269d6c2d83so5278767pjb.0; Thu, 05 Jan 2023 23:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:references:to:subject:from:to:cc:subject:date :message-id:reply-to; bh=ysvQ5mWCfecP1pnK0ECpg7dYPVloD8TUDMgLXFROJSc=; b=gL/Ugv/ETJll252x/aCu/2kunvNUeFZnkAgSCSQVAMQEQVxrunO9V415PmNHhQtQaZ mNUU3l9fAFTjwKCUCIJK/AVf33RiX3pkyXEYhQrXarKFskuG6fULdC5Sz0icHCd+j2E6 ePemStCfS0nzBC7UCOBnXWOnIPSkyuW7Om0GRoUfHXcHFk4DDu9DSD1A6x5cA1k471o6 tXwwTA8tWUjCWYHUFX5egyBL53/ElGXhpm5dg5z9fJrWxKrLOcduK+vJqikZwUnRR4M9 2paxNNieP8A5W1PeqRyQ8l4KmXQKE6DqizUPjjhFR4YV8qTrtke5ug3BfY1zQgDljAd/ ocCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:references:to:subject:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ysvQ5mWCfecP1pnK0ECpg7dYPVloD8TUDMgLXFROJSc=; b=2YZnf1jd2uK9Laj/WLXRVEZgAUDgYWKkZjrwWyoyA04gF2495JLRNSVlUqFvfdOqD3 o2kbpNe3zAPPwUzqparMySUwukkbnc87BETKkzZ05frhRZBjd3koa2vqS3jLG4hQ10OI OU+uyjGrn9U9uzIIxuud08o5J35PEMGvEhoka0CMKHTYt2+6taAWFpxprAJiFRVqM6oJ gpj6fI+z1/8vAZD0H2zYlcFA++fzGMcmfTtJqJ1R+qAQDC6q0En/dlwbrpbIUMPSMWOq 0e3EQKXI2xQreZ88K46H1MQfKfa3B+8TTzF6xLAfZtL8PphDQV9z1ZZ+nBk26yUiTak+ p5Jg== X-Gm-Message-State: AFqh2kqUrPDVM6ziFPOStpcbhBBp5JcaoNaMBMUBTglNGs1mh+Oq56Ae A1Q4Upm8cIXAhjR2tOX1rnk= X-Received: by 2002:a17:902:e5c5:b0:189:c57c:9a19 with SMTP id u5-20020a170902e5c500b00189c57c9a19mr73726106plf.58.1672988963276; Thu, 05 Jan 2023 23:09:23 -0800 (PST) Received: from [10.1.1.24] (122-62-142-61-fibre.sparkbb.co.nz. [122.62.142.61]) by smtp.gmail.com with ESMTPSA id c1-20020a170903234100b0017f48a9e2d6sm113944plh.292.2023.01.05.23.09.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2023 23:09:22 -0800 (PST) Subject: Re: [syzbot] [hfs?] WARNING in hfs_write_inode To: Linus Torvalds References: <000000000000dbce4e05f170f289@google.com> <5f45bb9a-5e00-48dd-82b0-46b19b1b98a3@app.fastmail.com> <1bd49fc0-d64f-4eb8-841a-4b09e178b5fd@gmail.com> <1a3d07bf-16f5-71a8-6500-7d37802dbadd@gmail.com> Cc: Arnd Bergmann , syzbot , Andrew Morton , christian.brauner@ubuntu.com, Damien Le Moal , jlayton@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Matthew Wilcox , ZhangPeng , Viacheslav Dubeyko , linux-m68k@lists.linux-m68k.org, flar@allandria.com From: Michael Schmitz Message-ID: Date: Fri, 6 Jan 2023 20:09:11 +1300 User-Agent: Mozilla/5.0 (X11; Linux ppc; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <1a3d07bf-16f5-71a8-6500-7d37802dbadd@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Am 06.01.2023 um 12:46 schrieb Michael Schmitz: > Hi Linus, > > Am 06.01.2023 um 10:53 schrieb Linus Torvalds: >> On Thu, Jan 5, 2023 at 1:35 PM Michael Schmitz >> wrote: >>> >>> Looking at Linus' patch, I wonder whether the missing fd.entrylength >>> size test in the HFS_IS_RSRC(inode) case was due to the fact that a >>> file's resource fork may be empty? >> >> But if that is the case, then the subsequent hfs_bnode_read would >> return garbage, no? And then writing it back after the update would be >> even worse. >> >> So adding that >> >> + if (fd.entrylength < sizeof(struct hfs_cat_file)) >> + goto out; >> >> would seem to be the right thing anyway. No? > > Yes, it would seem to be the right thing (in order to avoid further > corrupting HFS data structures). Returning -EIO might cause a regression > though. A brief test on a HFS filesystem image (copy of my yaboot bootstrap partition) did not show any regression, so your patch appears to be just fine as-is. Cheers, Michael