From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web10.4522.1675108455224063639 for ; Mon, 30 Jan 2023 11:54:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=YLnpijX9; spf=pass (domain: posteo.de, ip: 185.67.36.66, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 4042A2403BE for ; Mon, 30 Jan 2023 20:54:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1675108453; bh=soVZRB3NX45mQ79+rf1tuTSXuLZEG8BNP1XKjW9cQuE=; h=From:Subject:Date:Cc:To:From; b=YLnpijX9wRkFLi691kMq1dQDrHK7bNcOTxpWohi44z1I6vG5cYzXyJP/ugiXs8Kxw znFx7ILccidrdoHOfTBrsWDItBUKKqea1JdOEupXsESCOjVs7YD65vTwIHnsHNJc5d taPWI9juyb648oSiV3q5k+KE0LGBsN98Faqal85Sq6UdsGcv6rUeIg/zEc4roBAdzK 4PYInRP0TK6SCVoC6RFU6dlTVGAKXW2xICGazR29G1syLiT/wC/5lZZCnYLCz2r1Sc R+uFrpRCxBtfCz0gYAqQC6/x4k6nKzEPFHsNcOdKg6EGFYy9Gpqe8UZtTUrl9Aw1YL Q3wSxb8s20g0A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P5Jm41FNqz9rxG; Mon, 30 Jan 2023 20:54:12 +0100 (CET) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Message-Id: <1A2D4B07-7AD6-47B9-86FE-6B1C2C6BF4C6@posteo.de> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: Re: [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/" Date: Mon, 30 Jan 2023 19:54:01 +0000 In-Reply-To: <20230130175850.27638-1-pedro.falcato@gmail.com> Cc: edk2-devel-groups-io , Savva Mitrofanov To: Pedro Falcato References: <20230130175850.27638-1-pedro.falcato@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_1826EA96-54EF-47F6-AEFB-CBB9D3C2A1D7" --Apple-Mail=_1826EA96-54EF-47F6-AEFB-CBB9D3C2A1D7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Reviewed-by: Marvin H=C3=A4user > > On 30. Jan 2023, at 18:58, Pedro Falcato = wrote: >=20 > We have been hitting many issues with ".." ASSERTing on / in internal > code, so make sure that we direct /.. to /. This is safe. >=20 > Signed-off-by: Pedro Falcato > Cc: Marvin H=C3=A4user > Reported-by: Savva Mitrofanov > --- > Features/Ext4Pkg/Ext4Dxe/Directory.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c = b/Features/Ext4Pkg/Ext4Dxe/Directory.c > index 456916453952..73d21d9f9542 100644 > --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c > +++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c > @@ -255,7 +255,11 @@ Ext4OpenDirent ( > // Using the parent's parent's dentry > File->Dentry =3D Directory->Dentry->Parent; >=20 > - ASSERT (File->Dentry !=3D NULL); > + if (!File->Dentry) { > + // Someone tried .. on root, so direct them to / > + // This is an illegal EFI Open() but is possible to hit from a = variety of internal code > + File->Dentry =3D Directory->Dentry; > + } >=20 > Ext4RefDentry (File->Dentry); > } else { > --=20 > 2.39.0 >=20 --Apple-Mail=_1826EA96-54EF-47F6-AEFB-CBB9D3C2A1D7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Reviewed-by: Marvin H=C3=A4user <mhaeuser@posteo.de>
On 30. Jan 2023, at 18:58, Pedro = Falcato <pedro.falcato@gmail.com> wrote:

We have been hitting many = issues with ".." ASSERTing on / in internal
code, so make sure that = we direct /.. to /. This is safe.

Signed-off-by: Pedro Falcato = <pedro.falcato@gmail.com>
Cc: Marvin H=C3=A4user = <mhaeuser@posteo.de>
Reported-by: Savva Mitrofanov = <savvamtr@gmail.com>
---
= Features/Ext4Pkg/Ext4Dxe/Directory.c | 6 +++++-
1 file changed, 5 = insertions(+), 1 deletion(-)

diff --git = a/Features/Ext4Pkg/Ext4Dxe/Directory.c = b/Features/Ext4Pkg/Ext4Dxe/Directory.c
index = 456916453952..73d21d9f9542 100644
--- = a/Features/Ext4Pkg/Ext4Dxe/Directory.c
+++ = b/Features/Ext4Pkg/Ext4Dxe/Directory.c
@@ -255,7 +255,11 @@ = Ext4OpenDirent (
    // Using the parent's = parent's dentry
    File->Dentry =3D = Directory->Dentry->Parent;

-    ASSERT = (File->Dentry !=3D NULL);
+    if = (!File->Dentry) {
+      // Someone tried = .. on root, so direct them to /
+      // = This is an illegal EFI Open() but is possible to hit from a variety of = internal code
+      File->Dentry =3D = Directory->Dentry;
+    }

=     Ext4RefDentry (File->Dentry);
=   } else {
-- =
2.39.0


= --Apple-Mail=_1826EA96-54EF-47F6-AEFB-CBB9D3C2A1D7--