Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 87FC9C433EF for ; Mon, 30 May 2022 15:07:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FC0784367; Mon, 30 May 2022 17:07:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="A3n12RzE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A43A84367; Mon, 30 May 2022 17:07:06 +0200 (CEST) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 52B8D843CA for ; Mon, 30 May 2022 17:06:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x831.google.com with SMTP id c8so801827qtj.1 for ; Mon, 30 May 2022 08:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TPNIaBHBZtTASoBIoN26ClCv3iwyuwSRjM9EdBXIhB8=; b=A3n12RzEInR/vUqv0BrUuUZMZ8CQJdExYskBSixVO0kfLsJKsP9ZKqG90iZSAdcaUw aZ/MxUJf8XOF7Gbe8aSESoNLxhlb0ieI0aIc76qCnRnRPMN3tstZnxk5ouvZmFOc6r2s NG4VQ3XPqSkJYriwwxLYbTLhtbbRj3PsH0yTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TPNIaBHBZtTASoBIoN26ClCv3iwyuwSRjM9EdBXIhB8=; b=w/ARsktzky44CYDLonCIW20dKYRge6FxCTML3v2aiVOVrGlnGrBc9R8v0rW2IGaDuL 86wL3Fo/5p8xC3VeSsqkwuJwXbZ+9mDPgbN1jcStotWbXPsm5pqN8aBmJjV0oGYTE43b 6fbFDkozVFRv6zC5Q/n/5bYuVAOaN5Oc3WQ/gM+sg0t4wO8O3mmc57N+kzFej7PZf2aW n/CC97OQ6K2vjZIVHeAo63UXBe3WAkqVxh6p+Cc0X1QrWyjxHE1/Wx2g5rN4E5k1JQby n/M2UcXUYZDOt7vV2xjkp0pbU8mLuZmvW7OwYgYpfgl5ATc90nbV2EkYpQ71SKvbrC8G p8Lw== X-Gm-Message-State: AOAM530q3sS3V7cdDml57rg2K7HrC8DcJkCdOxUgay5EbGyH6dvoxCUN q2/elAhXnL4ConMpu3i+V5MSag6RI+7v7w== X-Google-Smtp-Source: ABdhPJzURn7w0U+e0H5RnwvPvYElbvD331qXVTe8IstsI7TMtsk/TOWzsy/SjQoJ2SJGUdEE0PXPGA== X-Received: by 2002:ac8:5e50:0:b0:304:b54b:67b0 with SMTP id i16-20020ac85e50000000b00304b54b67b0mr1949739qtx.366.1653923218121; Mon, 30 May 2022 08:06:58 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-25fd-0000-0000-0000-1003.res6.spectrum.com. [2603:6081:7b00:25fd::1003]) by smtp.gmail.com with ESMTPSA id t81-20020a37aa54000000b0069fc13ce1e5sm7820645qke.22.2022.05.30.08.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 08:06:57 -0700 (PDT) Date: Mon, 30 May 2022 11:06:55 -0400 From: Tom Rini To: Stefan Roese Cc: Pali =?iso-8859-1?Q?Roh=E1r?= , u-boot@lists.denx.de Subject: Re: [PATCH] ubifs: Fix lockup/crash when reading files Message-ID: <20220530150655.GQ25375@bill-the-cat> References: <20220517204528.7277-1-pali@kernel.org> <1289c1f2-e316-11a8-a0fc-ffd4557e4d66@denx.de> <20220519080431.pd2zyuqpckcmg3jz@pali> <20220523092521.loubhzzftnx6w7jl@pali> <6d35daf6-71f7-c0fd-0309-74920566b19b@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TYjWXklH5JTzT8n9" Content-Disposition: inline In-Reply-To: <6d35daf6-71f7-c0fd-0309-74920566b19b@denx.de> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean --TYjWXklH5JTzT8n9 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 30, 2022 at 08:11:26AM +0200, Stefan Roese wrote: > Added Tom to Cc... >=20 > On 23.05.22 11:25, Pali Roh=E1r wrote: > > On Thursday 19 May 2022 10:04:31 Pali Roh=E1r wrote: > > > On Thursday 19 May 2022 07:01:19 Stefan Roese wrote: > > > > On 17.05.22 22:45, Pali Roh=E1r wrote: > > > > > Commit b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond = the > > > > > requested size") added optimization to do not read more bytes tha= n it is > > > > > really needed. But this commit introduced incorrect handling of t= he hole at > > > > > the end of file. This logic cause U-Boot to crash or lockup when = trying to > > > > > read from the ubifs filesystem. > > > > >=20 > > > > > When read_block() call returns -ENOENT error (not an error, but t= he hole) > > > > > then dn-> structure is not filled and contain garbage. So using o= f dn->size > > > > > for memcpy() argument cause that U-Boot tries to copy unspecified= amount of > > > > > bytes from possible unmapped memory. Which randomly cause lockup = of P2020 > > > > > CPU. > > > > >=20 > > > > > Fix this issue by copying UBIFS_BLOCK_SIZE bytes from read buffer= when > > > > > dn->size is not available. UBIFS_BLOCK_SIZE is the size of the bu= ffer > > > > > itself and read_block() fills buffer by zeros when it returns -EN= OENT. > > > > >=20 > > > > > This patch fixes ubifsload on P2020. > > > > >=20 > > > > > Fixes: b1a14f8a1c2e ("UBIFS: Change ubifsload to not read beyond = the requested size") > > > > > Signed-off-by: Pali Roh=E1r > > > >=20 > > > > Reviewed-by: Stefan Roese > >=20 > > Anyway, who is maintainer of fs / ubifs code and can take this bugfix p= atch? >=20 > Tom, could you please pick this patch up? I've seen that you've already > assigned it to yourself in patchwork: >=20 > http://patchwork.ozlabs.org/project/uboot/patch/20220517204528.7277-1-pal= i@kernel.org/ I've put it in my queue, thanks. --=20 Tom --TYjWXklH5JTzT8n9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmKU3Y8ACgkQFHw5/5Y0 tywVrgwAinusow1s7S6PnnaUYKaZCYlpjPHKfvZy1zuGD38C77zHOd9/xuVJ/Ypw 9fK3C15EN3G9odasQA+LKbZq2wuWPytafMMkjTpMflQ9fbWQlTpNL0c40QEa+asH HKlkhaG3Z5FB7/I3ngAmc3esK5Lw5k0jD65PrJDB0I9QRSA8L9EjKTdS5+jdFyBK 6c7WdkCT/yb8TVAnHPLnL8G3blJ+NCk5oxqHpE0l/6JI68B6IqU0Gc4x8mnbDUr0 VswLOamYYpOhdRbjueO5qlBZE0mOA7ffQiIADvtNj8ob6u6tYs6Entk2yF8ySzPr jOCaTXcC178msKP7JS0Q6/CLTjs4nqTEo6/KKNavh/7UfmfeFSj6Qmbv4B7C5pUT Q3tMRjeKAzcxFBC6ppmqxOz4R/NgoDxNnYX8Nde6dDiSL8uIxVyLkFNd4pN0+Uil dIwrnwcLENLUzFeJrtfy7i98G11P3NjRBXNfOKyFlSFLi/RiWLeRs4doeQ7jAMfd A/unX8UV =SASY -----END PGP SIGNATURE----- --TYjWXklH5JTzT8n9--