2
0
Fork 0

libc: patch to remove odd O_NOFOLLOW behavior

This commit is contained in:
Emery Hemingway 2020-12-03 12:23:19 +01:00
parent 4b2a0a730b
commit 9c91935300
1 changed files with 70 additions and 7 deletions

View File

@ -1,7 +1,7 @@
From 017abdc7a59acf7e76109b7fd285f9856b4a9eee Mon Sep 17 00:00:00 2001 From 017abdc7a59acf7e76109b7fd285f9856b4a9eee Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 6 May 2020 04:38:35 +0530 Date: Wed, 6 May 2020 04:38:35 +0530
Subject: [PATCH 1/7] libc: add siginterrupt dummy Subject: [PATCH 1/8] libc: add siginterrupt dummy
--- ---
repos/libports/src/lib/libc/signal.cc | 3 +++ repos/libports/src/lib/libc/signal.cc | 3 +++
@ -28,7 +28,7 @@ index a08854a8c0..2d2def34d3 100644
From e73c873a6e329eef4dede312e0bd0e597c93adde Mon Sep 17 00:00:00 2001 From e73c873a6e329eef4dede312e0bd0e597c93adde Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 6 May 2020 04:59:56 +0530 Date: Wed, 6 May 2020 04:59:56 +0530
Subject: [PATCH 2/7] libc: add upstream mbsinit Subject: [PATCH 2/8] libc: add upstream mbsinit
--- ---
repos/libports/lib/mk/libc-locale.mk | 2 +- repos/libports/lib/mk/libc-locale.mk | 2 +-
@ -54,7 +54,7 @@ index 8e75e59589..2bb98b1456 100644
From 98d8ef8e3fa37076fab524b6830229f347c89feb Mon Sep 17 00:00:00 2001 From 98d8ef8e3fa37076fab524b6830229f347c89feb Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 27 May 2020 16:35:16 +0530 Date: Wed, 27 May 2020 16:35:16 +0530
Subject: [PATCH 3/7] libc: add mlock and munlock dummies Subject: [PATCH 3/8] libc: add mlock and munlock dummies
--- ---
repos/libports/src/lib/libc/dummies.cc | 10 ++++++++++ repos/libports/src/lib/libc/dummies.cc | 10 ++++++++++
@ -87,7 +87,7 @@ index b01d95f717..f676b4979c 100644
From a17d8387a9bbc7d340ed42cfcdc0adedce16f4dd Mon Sep 17 00:00:00 2001 From a17d8387a9bbc7d340ed42cfcdc0adedce16f4dd Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Fri, 29 May 2020 09:26:50 +0530 Date: Fri, 29 May 2020 09:26:50 +0530
Subject: [PATCH 4/7] libc: return 0 from getpgrp and getppid dummies Subject: [PATCH 4/8] libc: return 0 from getpgrp and getppid dummies
--- ---
repos/libports/src/lib/libc/dummies.cc | 4 ++-- repos/libports/src/lib/libc/dummies.cc | 4 ++--
@ -115,7 +115,7 @@ index f676b4979c..9c568dcc77 100644
From 9f3375cdca705e3271f209de76beb19354a150e8 Mon Sep 17 00:00:00 2001 From 9f3375cdca705e3271f209de76beb19354a150e8 Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Thu, 26 Nov 2020 12:47:30 +0100 Date: Thu, 26 Nov 2020 12:47:30 +0100
Subject: [PATCH 5/7] libc: always set argv and envp to valid arrays Subject: [PATCH 5/8] libc: always set argv and envp to valid arrays
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
@ -180,7 +180,7 @@ index 76645d82cb..ca9a8fd38a 100644
From dd89c66247bf751c87b09fffc7af15c04a59fd91 Mon Sep 17 00:00:00 2001 From dd89c66247bf751c87b09fffc7af15c04a59fd91 Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 2 Dec 2020 16:31:59 +0100 Date: Wed, 2 Dec 2020 16:31:59 +0100
Subject: [PATCH 6/7] libc: implement if_nametoindex Subject: [PATCH 6/8] libc: implement if_nametoindex
--- ---
.../libports/src/lib/libc/socket_fs_plugin.cc | 50 ++++++++++++++++++- .../libports/src/lib/libc/socket_fs_plugin.cc | 50 ++++++++++++++++++-
@ -261,7 +261,7 @@ index d5db46ff83..fabaf68b5c 100644
From 1f249e18ea3972911c1405deb40afd85b8d64dea Mon Sep 17 00:00:00 2001 From 1f249e18ea3972911c1405deb40afd85b8d64dea Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net> From: Emery Hemingway <ehmry@posteo.net>
Date: Thu, 4 Jun 2020 01:03:37 +0530 Date: Thu, 4 Jun 2020 01:03:37 +0530
Subject: [PATCH 7/7] libc: add readpassphrase Subject: [PATCH 7/8] libc: add readpassphrase
This symbol is already in the stub library. This symbol is already in the stub library.
--- ---
@ -283,3 +283,66 @@ index ab0ce929aa..1c7f84e800 100644
-- --
2.29.2 2.29.2
From 708d1c11c1954636df4eef2efde8f1a5cc4afa7e Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 2 Dec 2020 22:27:00 +0100
Subject: [PATCH 8/8] libc: replace strange errno values for O_NOFOLLOW
Do not replace ENOENT and EEXIST with ELOOP when open is called with
O_NOFOLLOW.
---
repos/libports/src/lib/libc/vfs_plugin.cc | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/repos/libports/src/lib/libc/vfs_plugin.cc b/repos/libports/src/lib/libc/vfs_plugin.cc
index 0947e44740..3b34c134f8 100644
--- a/repos/libports/src/lib/libc/vfs_plugin.cc
+++ b/repos/libports/src/lib/libc/vfs_plugin.cc
@@ -319,10 +319,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open_from_kernel(const char *path, int
case Result::OPEN_ERR_UNACCESSIBLE:
{
if (!(flags & O_CREAT)) {
- if (flags & O_NOFOLLOW) {
- errno = ELOOP;
- return 0;
- }
errno = ENOENT;
return 0;
}
@@ -336,10 +332,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open_from_kernel(const char *path, int
case Result::OPEN_ERR_EXISTS:
/* file has been created by someone else in the meantime */
- if (flags & O_NOFOLLOW) {
- errno = ELOOP;
- return 0;
- }
errno = EEXIST;
return 0;
@@ -451,10 +443,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags)
case Result::OPEN_ERR_UNACCESSIBLE:
{
if (!(flags & O_CREAT)) {
- if (flags & O_NOFOLLOW) {
- result_errno = ELOOP;
- return Fn::COMPLETE;
- }
result_errno = ENOENT;
return Fn::COMPLETE;
}
@@ -468,10 +456,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags)
case Result::OPEN_ERR_EXISTS:
/* file has been created by someone else in the meantime */
- if (flags & O_NOFOLLOW) {
- result_errno = ELOOP;
- return Fn::COMPLETE;
- }
result_errno = EEXIST;
return Fn::COMPLETE;
--
2.29.2