public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/"
@ 2023-01-30 17:58 Pedro Falcato
  2023-01-30 19:54 ` Marvin Häuser
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Falcato @ 2023-01-30 17:58 UTC (permalink / raw)
  To: devel; +Cc: Pedro Falcato, Marvin Häuser, Savva Mitrofanov

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äuser <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 = Directory->Dentry->Parent;
 
-    ASSERT (File->Dentry != 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 = Directory->Dentry;
+    }
 
     Ext4RefDentry (File->Dentry);
   } else {
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/"
  2023-01-30 17:58 [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/" Pedro Falcato
@ 2023-01-30 19:54 ` Marvin Häuser
  2023-01-30 20:17   ` Pedro Falcato
  0 siblings, 1 reply; 3+ messages in thread
From: Marvin Häuser @ 2023-01-30 19:54 UTC (permalink / raw)
  To: Pedro Falcato; +Cc: edk2-devel-groups-io, Savva Mitrofanov

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Reviewed-by: Marvin Häuser <mhaeuser@posteo.de <mailto: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äuser <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 = Directory->Dentry->Parent;
> 
> -    ASSERT (File->Dentry != 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 = Directory->Dentry;
> +    }
> 
>     Ext4RefDentry (File->Dentry);
>   } else {
> -- 
> 2.39.0
> 


[-- Attachment #2: Type: text/html, Size: 1873 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/"
  2023-01-30 19:54 ` Marvin Häuser
@ 2023-01-30 20:17   ` Pedro Falcato
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Falcato @ 2023-01-30 20:17 UTC (permalink / raw)
  To: Marvin Häuser; +Cc: edk2-devel-groups-io, Savva Mitrofanov

On Mon, Jan 30, 2023 at 7:54 PM Marvin Häuser <mhaeuser@posteo.de> wrote:
>
> Reviewed-by: Marvin Häuser <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äuser <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 = Directory->Dentry->Parent;
>
> -    ASSERT (File->Dentry != 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 = Directory->Dentry;
> +    }
>
>     Ext4RefDentry (File->Dentry);
>   } else {
> --
> 2.39.0
>
>

Pushed as 878c4b13f

Thank you

-- 
Pedro

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-30 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-30 17:58 [PATCH 1/1] Ext4Pkg: Redirect internal Open("..", /) to the proper "/" Pedro Falcato
2023-01-30 19:54 ` Marvin Häuser
2023-01-30 20:17   ` Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox