From af796dd627963e2dafddbd6d28eda642890216cf Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 15 Apr 2021 16:49:34 +0200 Subject: [PATCH] Update genodeSources to sculpt-21.03 Consolidate libc patch into sources patch. --- packages/genodelabs/default.nix | 4 +- packages/genodelabs/depot-targets.nix | 6 +- packages/genodelabs/patches/libc.patch | 463 --------------------- packages/genodelabs/patches/sources.patch | 467 +++++++++++++++++----- 4 files changed, 380 insertions(+), 560 deletions(-) delete mode 100644 packages/genodelabs/patches/libc.patch diff --git a/packages/genodelabs/default.nix b/packages/genodelabs/default.nix index 178cbcb..62297fd 100644 --- a/packages/genodelabs/default.nix +++ b/packages/genodelabs/default.nix @@ -19,8 +19,8 @@ let pkgs.fetchFromGitHub { owner = "genodelabs"; repo = "genode"; - rev = "3fac8b106d83721914797c202793ec1d8ea02d2f"; - hash = "sha256-XgN1fBUsmX8oKk4ZBvROwEWlpILRlJz+UuK4kMDSI1Y="; + rev = "sculpt-21.03"; + hash = "sha256-rbrzhSUXRaL1RhQ2GDBrRTIOt6o0TYhi5GOXjKa71Nc="; }; genodeSources = diff --git a/packages/genodelabs/depot-targets.nix b/packages/genodelabs/depot-targets.nix index c6212b8..2596d33 100644 --- a/packages/genodelabs/depot-targets.nix +++ b/packages/genodelabs/depot-targets.nix @@ -111,7 +111,6 @@ in { libc = { depotInputs = with self; [ vfs ]; portInputs = with ports; [ libc ]; - patches = [ ./patches/libc.patch ]; }; libcrypto = { depotInputs = with self; [ libc ]; @@ -170,10 +169,7 @@ in { pcre16 = { }; pdf_view = { }; platform_drv.patches = [ ./patches/platform_drv.patch ]; - posix = { - depotInputs = with self; [ libc ]; - patches = [ ./patches/libc.patch ]; - }; + posix.depotInputs = with self; [ libc ]; ps2_drv = { }; qt5_base = { }; qt5_calculatorform = { }; diff --git a/packages/genodelabs/patches/libc.patch b/packages/genodelabs/patches/libc.patch deleted file mode 100644 index 193409f..0000000 --- a/packages/genodelabs/patches/libc.patch +++ /dev/null @@ -1,463 +0,0 @@ -From 017abdc7a59acf7e76109b7fd285f9856b4a9eee Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Wed, 6 May 2020 04:38:35 +0530 -Subject: [PATCH 1/9] libc: add siginterrupt dummy - ---- - repos/libports/src/lib/libc/signal.cc | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/repos/libports/src/lib/libc/signal.cc b/repos/libports/src/lib/libc/signal.cc -index a08854a8c0..2d2def34d3 100644 ---- a/repos/libports/src/lib/libc/signal.cc -+++ b/repos/libports/src/lib/libc/signal.cc -@@ -131,6 +131,9 @@ extern "C" int sigaction(int signum, const struct sigaction *act, struct sigacti - } - - -+extern "C" int siginterrupt(int sig, int flag) { return 0; }; -+ -+ - extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); - extern "C" int __sys_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); - extern "C" int __libc_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); --- -2.30.0 - - -From e73c873a6e329eef4dede312e0bd0e597c93adde Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Wed, 6 May 2020 04:59:56 +0530 -Subject: [PATCH 2/9] libc: add upstream mbsinit - ---- - repos/libports/lib/mk/libc-locale.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/repos/libports/lib/mk/libc-locale.mk b/repos/libports/lib/mk/libc-locale.mk -index 8e75e59589..2bb98b1456 100644 ---- a/repos/libports/lib/mk/libc-locale.mk -+++ b/repos/libports/lib/mk/libc-locale.mk -@@ -6,7 +6,7 @@ CC_OPT += -D_Thread_local="" - FILTER_OUT = \ - c16rtomb.c c32rtomb_iconv.c mbrtoc16_iconv.c mbrtoc32_iconv.c \ - setlocale.c xlocale.c setrunelocale.c \ -- ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mbsinit.c mskanji.c utf8.c \ -+ ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mskanji.c utf8.c \ - - SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(LIBC_LOCALE_DIR)/*.c))) - --- -2.30.0 - - -From 98d8ef8e3fa37076fab524b6830229f347c89feb Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Wed, 27 May 2020 16:35:16 +0530 -Subject: [PATCH 3/9] libc: add mlock and munlock dummies - ---- - repos/libports/src/lib/libc/dummies.cc | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc -index b01d95f717..f676b4979c 100644 ---- a/repos/libports/src/lib/libc/dummies.cc -+++ b/repos/libports/src/lib/libc/dummies.cc -@@ -218,5 +218,15 @@ int __attribute__((weak)) madvise(void *addr, size_t length, int advice) - - const struct res_sym __p_type_syms[] = { }; - -+#define DUMMY_EPERM(ret_type, ret_val, name, args) __attribute__((weak)) \ -+ret_type name args \ -+{ \ -+ errno = EPERM; \ -+ return ret_val; \ -+} -+ -+DUMMY_EPERM(int, -1, mlock, (const void *, size_t)); -+DUMMY_EPERM(int, -1, munlock, (const void *, size_t)); -+ - } /* extern "C" */ - --- -2.30.0 - - -From a17d8387a9bbc7d340ed42cfcdc0adedce16f4dd Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Fri, 29 May 2020 09:26:50 +0530 -Subject: [PATCH 4/9] libc: return 0 from getpgrp and getppid dummies - ---- - repos/libports/src/lib/libc/dummies.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc -index f676b4979c..9c568dcc77 100644 ---- a/repos/libports/src/lib/libc/dummies.cc -+++ b/repos/libports/src/lib/libc/dummies.cc -@@ -109,8 +109,8 @@ DUMMY(char *, 0, _getlogin, (void)) - DUMMY(int , -1, getnameinfo, (const sockaddr *, socklen_t, char *, size_t, char *, size_t, int)) - DUMMY(struct servent *, 0, getservbyname, (const char *, const char *)) - DUMMY(int , -1, getsid, (pid_t)) --DUMMY_SILENT(pid_t , -1, getppid, (void)) --DUMMY(pid_t , -1, getpgrp, (void)) -+DUMMY_SILENT(pid_t , 0, getpgrp, (void)) -+DUMMY_SILENT(pid_t , 0, getppid, (void)) - DUMMY(int , -1, getpriority, (int, int)) - DUMMY(int , -1, getrusage, (int, rusage *)) - DUMMY_SILENT(uid_t , 0, getuid, (void)) --- -2.30.0 - - -From 9f3375cdca705e3271f209de76beb19354a150e8 Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Thu, 26 Nov 2020 12:47:30 +0100 -Subject: [PATCH 5/9] libc: always set argv and envp to valid arrays -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The arrays passed to main(…) must always be valid null-terminated arrays. - -Fix #3955 ---- - repos/libports/include/libc/args.h | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -diff --git a/repos/libports/include/libc/args.h b/repos/libports/include/libc/args.h -index 76645d82cb..ca9a8fd38a 100644 ---- a/repos/libports/include/libc/args.h -+++ b/repos/libports/include/libc/args.h -@@ -25,6 +25,7 @@ static void populate_args_and_env(Libc::Env &env, int &argc, char **&argv, char - { - using Genode::Xml_node; - using Genode::Xml_attribute; -+ using Genode::max; - - env.config([&] (Xml_node const &node) { - -@@ -40,12 +41,20 @@ static void populate_args_and_env(Libc::Env &env, int &argc, char **&argv, char - ++envc; - }); - -- if (argc == 0 && envc == 0) -+ if (argc == 0 && envc == 0) { -+ /* -+ * If argc is zero then argv is still a NULL-terminated array. -+ */ -+ static char const *args[] = { nullptr, nullptr }; -+ argc = 0; -+ argv = (char**)&args; -+ envp = &argv[1]; - return; /* from lambda */ -+ } - -- /* arguments and environment are a contiguous array (but don't count on it) */ -- argv = (char**)malloc((argc + envc + 1) * sizeof(char*)); -- envp = &argv[argc]; -+ /* arguments and environment are arranged System V style (but don't count on it) */ -+ argv = (char**)malloc((argc + envc + 2) * sizeof(char*)); -+ envp = &argv[argc+1]; - - /* read the arguments */ - int arg_i = 0; -@@ -123,6 +132,8 @@ static void populate_args_and_env(Libc::Env &env, int &argc, char **&argv, char - catch (Xml_node::Nonexistent_attribute) { } - }); - -+ /* argv and envp are both NULL terminated */ -+ argv[arg_i] = NULL; - envp[env_i] = NULL; - }); - } --- -2.30.0 - - -From dd89c66247bf751c87b09fffc7af15c04a59fd91 Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Wed, 2 Dec 2020 16:31:59 +0100 -Subject: [PATCH 6/9] libc: implement if_nametoindex - ---- - .../libports/src/lib/libc/socket_fs_plugin.cc | 50 ++++++++++++++++++- - 1 file changed, 49 insertions(+), 1 deletion(-) - -diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc -index d5db46ff83..fabaf68b5c 100644 ---- a/repos/libports/src/lib/libc/socket_fs_plugin.cc -+++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc -@@ -33,6 +33,8 @@ - #include - #include - #include -+#include -+#include - #include - - /* libc-internal includes */ -@@ -1128,7 +1130,53 @@ extern "C" int getifaddrs(struct ifaddrs **ifap) - } - - --extern "C" void freeifaddrs(struct ifaddrs *) { } -+extern "C" void freeifaddrs(struct ifaddrs *) -+{ -+} -+ -+ -+static char const * static_if_name = "eth0"; -+ -+ -+extern "C" unsigned int -+if_nametoindex(const char *ifname) -+{ -+ return ::strcmp(ifname, static_if_name) ? 0 : 1; -+} -+ -+ -+extern "C" char * -+if_indextoname(unsigned int ifindex, char *ifname) -+{ -+ if (ifindex == 1) { -+ strncpy(ifname, static_if_name, IFNAMSIZ); -+ return ifname; -+ } -+ return NULL; -+} -+ -+ -+extern "C" struct if_nameindex * -+if_nameindex(void) -+{ -+ static struct if_nameindex if_ni_array[2] = { -+ { -+ .if_index = 1, -+ .if_name = (char *)static_if_name -+ }, -+ { -+ .if_index = 0, -+ .if_name = NULL -+ } -+ }; -+ -+ return if_ni_array; -+} -+ -+ -+extern "C" void if_freenameindex(struct if_nameindex *ptr) -+{ -+} - - - /**************************** --- -2.30.0 - - -From 1f249e18ea3972911c1405deb40afd85b8d64dea Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Thu, 4 Jun 2020 01:03:37 +0530 -Subject: [PATCH 7/9] libc: add readpassphrase - -This symbol is already in the stub library. ---- - repos/libports/lib/mk/libc-gen.inc | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/repos/libports/lib/mk/libc-gen.inc b/repos/libports/lib/mk/libc-gen.inc -index ab0ce929aa..1c7f84e800 100644 ---- a/repos/libports/lib/mk/libc-gen.inc -+++ b/repos/libports/lib/mk/libc-gen.inc -@@ -40,7 +40,6 @@ FILTER_OUT_C += \ - getentropy.c \ - getutxent.c \ - pututxline.c \ -- readpassphrase.c \ - scandir_b.c \ - sem_new.c \ - signal.c \ --- -2.30.0 - - -From 708d1c11c1954636df4eef2efde8f1a5cc4afa7e Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Wed, 2 Dec 2020 22:27:00 +0100 -Subject: [PATCH 8/9] 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.30.0 - - -From 33aac81eee66ae5f218e00b7d596018a2931a784 Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Sat, 6 Feb 2021 13:45:23 +0100 -Subject: [PATCH 9/9] libc: add some missing internal symbols - ---- - repos/libports/lib/mk/libc-gen.inc | 1 - - repos/libports/lib/mk/libiconv.mk | 3 ++- - repos/libports/src/lib/libc/dummies.cc | 36 ++++++++++++++++++++++++-- - repos/libports/src/lib/libc/fork.cc | 3 ++- - 4 files changed, 38 insertions(+), 5 deletions(-) - -diff --git a/repos/libports/lib/mk/libc-gen.inc b/repos/libports/lib/mk/libc-gen.inc -index 1c7f84e800..ab5ac34f2f 100644 ---- a/repos/libports/lib/mk/libc-gen.inc -+++ b/repos/libports/lib/mk/libc-gen.inc -@@ -22,7 +22,6 @@ FILTER_OUT_C += lockf.c - - # interposing stubs - FILTER_OUT_C += \ -- elf_utils.c \ - sleep.c \ - _spinlock_stub.c \ - usleep.c \ -diff --git a/repos/libports/lib/mk/libiconv.mk b/repos/libports/lib/mk/libiconv.mk -index a4154ba6db..ce04c695ce 100644 ---- a/repos/libports/lib/mk/libiconv.mk -+++ b/repos/libports/lib/mk/libiconv.mk -@@ -12,7 +12,8 @@ CC_DEF += -DLIBDIR=\"\" - - SRC_C := iconv.c \ - relocatable.c \ -- localcharset.c -+ localcharset.c \ -+ citrus_iconv.c - - SHARED_LIB = yes - -diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc -index 9c568dcc77..cfa78effac 100644 ---- a/repos/libports/src/lib/libc/dummies.cc -+++ b/repos/libports/src/lib/libc/dummies.cc -@@ -37,6 +37,8 @@ extern "C" { - #include - #include - #include -+#include -+#include - - - #define DUMMY(ret_type, ret_val, name, args) __attribute__((weak)) \ -@@ -216,7 +218,9 @@ int __attribute__((weak)) madvise(void *addr, size_t length, int advice) - return -1; - } - --const struct res_sym __p_type_syms[] = { }; -+const struct res_sym __p_class_syms[] = { }; -+const struct res_sym __p_rcode_syms[] = { }; -+const struct res_sym __p_type_syms[] = { }; - - #define DUMMY_EPERM(ret_type, ret_val, name, args) __attribute__((weak)) \ - ret_type name args \ -@@ -228,5 +232,33 @@ ret_type name args \ - DUMMY_EPERM(int, -1, mlock, (const void *, size_t)); - DUMMY_EPERM(int, -1, munlock, (const void *, size_t)); - --} /* extern "C" */ -+DUMMY(int, -1, sysarch, (int, void *)) -+ -+DUMMY(int, -1, freebsd11_fstat, (struct thread *, struct freebsd11_stat_args *)) -+DUMMY(int, -1, freebsd11_lstat, (struct thread *, struct freebsd11_lstat_args *)) -+DUMMY(int, -1, freebsd11_readdir, (DIR *, struct freebsd11_dirent *, struct freebsd11_dirent **)) -+DUMMY(int, -1, freebsd11_stat, (struct thread *, struct freebsd11_stat_args *)) -+DUMMY(int, -1, freebsd11_statfs, (const char *, struct freebsd11_statfs *)) -+ -+DUMMY(int, -1, strunvis, (char *dst, const char *src)) -+DUMMY(int, -1, strvisx, (char *, const char *, size_t, int)) -+DUMMY(int, -1, unvis, (char *, int, int *, int)) -+ -+DUMMY(const char *, "", loc_ntoa, (const u_char *, char *)) -+DUMMY(const char *, "", p_class, (int)) -+DUMMY(const char *, "", p_rcode, (int)) -+DUMMY(const char *, "", p_section, (int, int)) -+DUMMY(const char *, "", p_type, (int)) -+DUMMY(char *, NULL, p_secstodate, (u_long)) -+DUMMY(int, -1, dn_count_labels, (const char *)) -+DUMMY(int, -1, loc_aton, (const char *, u_char *)) -+DUMMY(int, -1, sym_ston, (const struct res_sym *, const char *, int *)) -+DUMMY(void, , res_pquery, (const res_state, const u_char *, int, FILE *)) - -+DUMMY(int, -1, clock_getcpuclockid2, (id_t, int, clockid_t *)) -+ -+DUMMY(int, -1, _citrus_iconv_open, (struct _citrus_iconv **, const char *, const char *)) -+ -+DUMMY(int, -1, strtodg, (const char*, char**, FPI*, int*, ULong*)) -+ -+} /* extern "C" */ -diff --git a/repos/libports/src/lib/libc/fork.cc b/repos/libports/src/lib/libc/fork.cc -index 4f3a9cdd07..3464a338a8 100644 ---- a/repos/libports/src/lib/libc/fork.cc -+++ b/repos/libports/src/lib/libc/fork.cc -@@ -732,7 +732,8 @@ extern "C" pid_t __sys_wait4(pid_t pid, int *status, int options, rusage *rusage - return result; - } - --extern "C" pid_t wait4(pid_t, int *, int, rusage *) __attribute__((weak, alias("__sys_wait4"))); -+extern "C" pid_t wait4(pid_t, int *, int, rusage *) __attribute__((weak, alias("__sys_wait4"))); -+extern "C" pid_t _wait4(pid_t, int *, int, rusage *) __attribute__((weak, alias("__sys_wait4"))); - - - void Libc::init_fork(Env &env, Config_accessor const &config_accessor, --- -2.30.0 - diff --git a/packages/genodelabs/patches/sources.patch b/packages/genodelabs/patches/sources.patch index 866e06f..d75b16d 100644 --- a/packages/genodelabs/patches/sources.patch +++ b/packages/genodelabs/patches/sources.patch @@ -1,7 +1,7 @@ -From bf2613eb22091125c0aff894e580063dac5e2bff Mon Sep 17 00:00:00 2001 +From b712e49a3cfe42bb4dcfdda317fd2b2be041f471 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 6 Apr 2020 16:32:13 +0530 -Subject: [PATCH 01/17] ld: support for loading read-only segments +Subject: [PATCH 01/24] ld: support for loading read-only segments --- repos/base/src/lib/ldso/include/file.h | 24 ++++++++++++++++++-- @@ -89,10 +89,10 @@ index 78d2c7033d..f17d6dfec0 100644 2.31.0 -From 525ab24c481acdf9bb784cac36e663a20084b55b Mon Sep 17 00:00:00 2001 +From de1380201ac0cd8731ceadbed99480f4b1b98ea8 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 25 Apr 2020 17:10:03 +0530 -Subject: [PATCH 02/17] init/sandbox: support +Subject: [PATCH 02/24] init/sandbox: support Apply routing rules to a child from a node at the top-level of a sandbox config, unless the corresponding start node has as @@ -110,11 +110,11 @@ rules. 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc -index e321df61fd..d25e3d9683 100644 +index 41eb719fc6..dba813fdca 100644 --- a/repos/os/src/lib/sandbox/child.cc +++ b/repos/os/src/lib/sandbox/child.cc @@ -487,17 +487,25 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - Session::Label(), Session::Diag{false} }; + return Route { _session_requester.service(), Session::Label(), diag }; try { + /* Lookup route in … */ @@ -157,7 +157,7 @@ index e321df61fd..d25e3d9683 100644 _ram_limit_accessor(ram_limit_accessor), _cap_limit_accessor(cap_limit_accessor), diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h -index 2c213e662c..81836a2045 100644 +index f338597f9c..01f464ffbe 100644 --- a/repos/os/src/lib/sandbox/child.h +++ b/repos/os/src/lib/sandbox/child.h @@ -52,6 +52,14 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup @@ -183,7 +183,7 @@ index 2c213e662c..81836a2045 100644 Default_caps_accessor &_default_caps_accessor; Ram_limit_accessor &_ram_limit_accessor; Cap_limit_accessor &_cap_limit_accessor; -@@ -473,6 +482,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup +@@ -474,6 +483,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup Report_update_trigger &report_update_trigger, Xml_node start_node, Default_route_accessor &default_route_accessor, @@ -192,7 +192,7 @@ index 2c213e662c..81836a2045 100644 Name_registry &name_registry, Ram_quota ram_limit, diff --git a/repos/os/src/lib/sandbox/library.cc b/repos/os/src/lib/sandbox/library.cc -index 28b60c491f..30d0f2dfc1 100644 +index 2c5ba133b9..6ddc46e886 100644 --- a/repos/os/src/lib/sandbox/library.cc +++ b/repos/os/src/lib/sandbox/library.cc @@ -23,6 +23,7 @@ @@ -274,10 +274,10 @@ index 7afcaebf00..36aab737f2 100644 2.31.0 -From 16106e96b1cf7639b050097b131b3be3cdbcf739 Mon Sep 17 00:00:00 2001 +From a9bb435ac806ef49ce71e6295e7a41d31103139c Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 29 May 2020 18:42:57 +0530 -Subject: [PATCH 03/17] Use 128-byte strings for session labels +Subject: [PATCH 03/24] Use 128-byte strings for session labels Sixty-four bytes is insufficient for Nix store paths. --- @@ -290,7 +290,7 @@ Sixty-four bytes is insufficient for Nix store paths. 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/repos/base/include/base/child.h b/repos/base/include/base/child.h -index 8c7b33a9d9..3bd6483547 100644 +index cfcf8e7844..2babff2a5a 100644 --- a/repos/base/include/base/child.h +++ b/repos/base/include/base/child.h @@ -44,9 +44,9 @@ namespace Genode { @@ -306,7 +306,7 @@ index 8c7b33a9d9..3bd6483547 100644 virtual ~Child_policy() { } -@@ -407,7 +407,7 @@ class Genode::Child : protected Rpc_object, +@@ -408,7 +408,7 @@ class Genode::Child : protected Rpc_object, Id_space::Id const _client_id; @@ -355,10 +355,10 @@ index 233da10b47..afaee3f8d7 100644 #endif /* _LIBC__INTERNAL__TYPES_H_ */ diff --git a/repos/libports/src/lib/libc/kernel.cc b/repos/libports/src/lib/libc/kernel.cc -index ac208b223e..3b81be01a9 100644 +index 50fa93bac1..a0b3452919 100644 --- a/repos/libports/src/lib/libc/kernel.cc +++ b/repos/libports/src/lib/libc/kernel.cc -@@ -364,7 +364,7 @@ void Libc::Kernel::_clone_state_from_parent() +@@ -370,7 +370,7 @@ void Libc::Kernel::_clone_state_from_parent() /* clone RW segment of a shared library or the binary */ if (node.type() == "rw") { @@ -368,7 +368,7 @@ index ac208b223e..3b81be01a9 100644 /* diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h -index 81836a2045..f7b41ddd5b 100644 +index 01f464ffbe..6a141d549b 100644 --- a/repos/os/src/lib/sandbox/child.h +++ b/repos/os/src/lib/sandbox/child.h @@ -128,7 +128,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup @@ -383,10 +383,10 @@ index 81836a2045..f7b41ddd5b 100644 2.31.0 -From 3f38eacb25348a811f37ce267323253b1941cad2 Mon Sep 17 00:00:00 2001 +From a7a3147c2397b5bd91652bbb39551984e6ecd1c1 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 4 Nov 2020 11:03:49 +0100 -Subject: [PATCH 04/17] init/sandbox: do not parse if +Subject: [PATCH 04/24] init/sandbox: do not parse if is present --- @@ -394,7 +394,7 @@ Subject: [PATCH 04/17] init/sandbox: do not parse if 1 file changed, 85 insertions(+), 39 deletions(-) diff --git a/repos/os/src/lib/sandbox/library.cc b/repos/os/src/lib/sandbox/library.cc -index 30d0f2dfc1..caa9840ea6 100644 +index 6ddc46e886..ec4ac87ed5 100644 --- a/repos/os/src/lib/sandbox/library.cc +++ b/repos/os/src/lib/sandbox/library.cc @@ -184,47 +184,93 @@ struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, @@ -534,10 +534,10 @@ index 30d0f2dfc1..caa9840ea6 100644 2.31.0 -From ef28369a1e6ba0f8910da3a6cb757f9e5ec334ad Mon Sep 17 00:00:00 2001 +From ff1a8382bb3c8c69e70fd5d7d9ab5e30055f7194 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 4 Nov 2020 20:02:03 +0100 -Subject: [PATCH 05/17] init/sandbox: simplify routing +Subject: [PATCH 05/24] init/sandbox: simplify routing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -557,7 +557,7 @@ Routes are now selected by longest match rather than first match. 4 files changed, 76 insertions(+), 127 deletions(-) diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc -index d25e3d9683..46aa22411c 100644 +index dba813fdca..1173c0687c 100644 --- a/repos/os/src/lib/sandbox/child.cc +++ b/repos/os/src/lib/sandbox/child.cc @@ -11,6 +11,7 @@ @@ -569,8 +569,8 @@ index d25e3d9683..46aa22411c 100644 /* local includes */ @@ -486,105 +487,65 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - return Route { _session_requester.service(), - Session::Label(), Session::Diag{false} }; + && label.last_element() == Session_requester::rom_name()) + return Route { _session_requester.service(), Session::Label(), diag }; - try { - /* Lookup route in … */ @@ -611,7 +611,7 @@ index d25e3d9683..46aa22411c 100644 - target.attribute_value("label", Label(label.string())); - - Session::Diag const -- target_diag { target.attribute_value("diag", false) }; +- target_diag { target.attribute_value("diag", diag.enabled) }; - - auto no_filter = [] (Service &) -> bool { return false; }; - @@ -735,7 +735,7 @@ index d25e3d9683..46aa22411c 100644 _default_caps_accessor(default_caps_accessor), _ram_limit_accessor(ram_limit_accessor), diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h -index f7b41ddd5b..fd254d7f49 100644 +index 6a141d549b..c9eeb830b5 100644 --- a/repos/os/src/lib/sandbox/child.h +++ b/repos/os/src/lib/sandbox/child.h @@ -49,7 +49,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup @@ -754,7 +754,7 @@ index f7b41ddd5b..fd254d7f49 100644 Routes_accessor &_routes_accessor; Default_caps_accessor &_default_caps_accessor; Ram_limit_accessor &_ram_limit_accessor; -@@ -480,7 +478,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup +@@ -481,7 +479,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup Id id, Report_update_trigger &report_update_trigger, Xml_node start_node, @@ -763,7 +763,7 @@ index f7b41ddd5b..fd254d7f49 100644 Default_caps_accessor &default_caps_accessor, Name_registry &name_registry, diff --git a/repos/os/src/lib/sandbox/library.cc b/repos/os/src/lib/sandbox/library.cc -index caa9840ea6..7b4e72c60e 100644 +index ec4ac87ed5..f12bf98f9d 100644 --- a/repos/os/src/lib/sandbox/library.cc +++ b/repos/os/src/lib/sandbox/library.cc @@ -22,7 +22,6 @@ @@ -900,10 +900,10 @@ index 36aab737f2..639a4be4dd 100644 2.31.0 -From 79ae552230809f62e1717a08f5ce9a63c044abf9 Mon Sep 17 00:00:00 2001 +From 24d8689cdef4fb3941b73d6393a07ecad06a4910 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 7 Nov 2020 08:37:29 +0100 -Subject: [PATCH 06/17] core: log ROM requests with affirmative "diag" flag +Subject: [PATCH 06/24] core: log ROM requests with affirmative "diag" flag --- repos/base/src/core/include/rom_session_component.h | 12 ++++++++++-- @@ -940,10 +940,10 @@ index c584701f5f..2c93302e14 100644 2.31.0 -From 0e1ea49ea6ce4f85e2e30a01aa5ace7928b20267 Mon Sep 17 00:00:00 2001 +From 466523a177a58436021e422459afed41efba6aef Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 7 Nov 2020 11:23:03 +0100 -Subject: [PATCH 07/17] base: fail on label truncation +Subject: [PATCH 07/24] base: fail on label truncation --- repos/base/include/base/session_label.h | 27 ++++++++++++++++++++++--- @@ -1041,10 +1041,10 @@ index 610fbb16b3..48777e0c2a 100644 2.31.0 -From 2c193324a6702e123c8cafabda45c30c7ca09257 Mon Sep 17 00:00:00 2001 +From e0210fb4f5c3462be76f0e335b6ba5488d046956 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 7 Nov 2020 13:49:41 +0100 -Subject: [PATCH 08/17] init: log error when configuration cannot be parsed +Subject: [PATCH 08/24] init: log error when configuration cannot be parsed --- repos/os/src/init/main.cc | 4 ++++ @@ -1069,10 +1069,10 @@ index 7b69c95721..f1c1a1435a 100644 2.31.0 -From 5d07e900e3c7f0fe507844bccc5f168bad046a3c Mon Sep 17 00:00:00 2001 +From 6392bae79ef78a2229ecfc2bb4599e6d34640b9a Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Sat, 28 Nov 2020 14:00:49 +0100 -Subject: [PATCH 09/17] Do not default Child::binary_name() to Child::name() +Subject: [PATCH 09/24] Do not default Child::binary_name() to Child::name() --- repos/base/include/base/child.h | 2 +- @@ -1081,7 +1081,7 @@ Subject: [PATCH 09/17] Do not default Child::binary_name() to Child::name() 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/base/include/base/child.h b/repos/base/include/base/child.h -index 3bd6483547..a00e59e3a4 100644 +index 2babff2a5a..4350283e64 100644 --- a/repos/base/include/base/child.h +++ b/repos/base/include/base/child.h @@ -58,7 +58,7 @@ struct Genode::Child_policy @@ -1094,7 +1094,7 @@ index 3bd6483547..a00e59e3a4 100644 /** * ROM module name of the dynamic linker diff --git a/repos/base/src/core/main.cc b/repos/base/src/core/main.cc -index d480585221..7acacf0ffd 100644 +index 234bc455f6..cad2e6c081 100644 --- a/repos/base/src/core/main.cc +++ b/repos/base/src/core/main.cc @@ -145,6 +145,8 @@ class Core_child : public Child_policy @@ -1104,13 +1104,13 @@ index d480585221..7acacf0ffd 100644 + Binary_name binary_name() const override { return "init"; } + Route resolve_session_request(Service::Name const &name, - Session_label const &label) override - { + Session_label const &label, + Session::Diag const diag) override diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h -index fd254d7f49..036e7f8fc2 100644 +index c9eeb830b5..7e7101ce3b 100644 --- a/repos/os/src/lib/sandbox/child.h +++ b/repos/os/src/lib/sandbox/child.h -@@ -594,6 +594,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup +@@ -595,6 +595,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup ****************************/ Child_policy::Name name() const override { return _unique_name; } @@ -1122,10 +1122,10 @@ index fd254d7f49..036e7f8fc2 100644 2.31.0 -From 0ac7fd14676b451e11b74c9e66f7de265b3ee4e6 Mon Sep 17 00:00:00 2001 +From 42f7cde2e8735fb799c3411ae1d85ea7c99b5e2d Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 3 Dec 2020 12:19:10 +0100 -Subject: [PATCH 10/17] vfs: create missing root directories for writeable +Subject: [PATCH 10/24] vfs: create missing root directories for writeable sessions This is the expected behavior. @@ -1202,38 +1202,10 @@ index b780b1fdd7..358afd28a9 100644 2.31.0 -From 6842e2d0c2c784d224a9d7bc100e491545b8e5e6 Mon Sep 17 00:00:00 2001 -From: Emery Hemingway -Date: Thu, 28 Jan 2021 13:39:29 +0100 -Subject: [PATCH 11/17] genode_dyn.ld: do not emit PHDR segment - -Recent version of binutils check that PHDR segments are covered -by a LOAD segment. In this case the unloaded PHDR segment can be -ommited. ---- - repos/base/src/ld/genode_dyn.ld | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/repos/base/src/ld/genode_dyn.ld b/repos/base/src/ld/genode_dyn.ld -index 5fa6ddc29e..57ec92f0f6 100644 ---- a/repos/base/src/ld/genode_dyn.ld -+++ b/repos/base/src/ld/genode_dyn.ld -@@ -18,7 +18,6 @@ - - PHDRS - { -- phdr PT_PHDR PHDRS; - interp PT_INTERP; - ro PT_LOAD; - rw PT_LOAD; --- -2.31.0 - - -From ff8ffb77ccf4238001abd7253c45dece86fe8983 Mon Sep 17 00:00:00 2001 +From a3c0eec54398f49130dfc76d69ee0841472b9691 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 3 Feb 2021 15:20:39 +0100 -Subject: [PATCH 12/17] vfs: support for loading plugins by label +Subject: [PATCH 11/24] vfs: support for loading plugins by label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1301,10 +1273,10 @@ index 5cdf20e8e3..1cf5d587ea 100644 2.31.0 -From 490fb611ceaad9ae67af35c22ac40dd65ddd7a42 Mon Sep 17 00:00:00 2001 +From 4d3829383fd6af3839a10434dfdf70e364a5343c Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 3 Feb 2021 17:33:24 +0100 -Subject: [PATCH 13/17] vfs: increase the capacity of tar ROM labels to 128 +Subject: [PATCH 12/24] vfs: increase the capacity of tar ROM labels to 128 --- repos/os/src/lib/vfs/tar_file_system.h | 2 +- @@ -1327,10 +1299,10 @@ index d9941deb5f..fcb06a1459 100644 2.31.0 -From a9900477faf8d9d41dbe3fa59a0b40ce5cab037f Mon Sep 17 00:00:00 2001 +From 69c16e1321776cb799828f8f11b52473c8c3d12f Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 10 Feb 2021 13:32:42 +0100 -Subject: [PATCH 14/17] Detect destroyed argument buffers at Env::session +Subject: [PATCH 13/24] Detect destroyed argument buffers at Env::session Session request arguments are silently zeroed when their length exceedes some buffer size. @@ -1339,12 +1311,12 @@ exceedes some buffer size. 1 file changed, 4 insertions(+) diff --git a/repos/base/src/lib/base/component.cc b/repos/base/src/lib/base/component.cc -index 568be31efb..913687ea7f 100644 +index 8973e3b6b5..9441bb923c 100644 --- a/repos/base/src/lib/base/component.cc +++ b/repos/base/src/lib/base/component.cc -@@ -122,6 +122,10 @@ namespace { - Affinity const &affinity) override - { +@@ -127,6 +127,10 @@ namespace { + } + Mutex::Guard guard(_mutex); + if (!args.valid_string()) { + error("invalid args for ", name.string(), " service request"); @@ -1357,10 +1329,10 @@ index 568be31efb..913687ea7f 100644 2.31.0 -From d2da7f94d328336ab6ac618ff5779ae8093c5e9d Mon Sep 17 00:00:00 2001 +From 0ced46bc913d04910ae73f5cf18c40c2cf9ec7b0 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Thu, 11 Feb 2021 14:10:50 +0100 -Subject: [PATCH 15/17] Increase session arguments buffer size to 240 bytes +Subject: [PATCH 14/24] Increase session arguments buffer size to 240 bytes --- repos/base/include/parent/parent.h | 2 +- @@ -1395,10 +1367,10 @@ index c7e3a0c908..4fda9e341f 100644 virtual ~Root() { } diff --git a/repos/base/lib/symbols/ld b/repos/base/lib/symbols/ld -index 3cfbdd7466..d7603e8ca4 100644 +index 2374417f9b..70e15acd99 100644 --- a/repos/base/lib/symbols/ld +++ b/repos/base/lib/symbols/ld -@@ -398,6 +398,8 @@ _ZThn236_N5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_ +@@ -399,6 +399,8 @@ _ZThn236_N5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_ _ZThn236_N5Timer10Connection9curr_timeEv T _ZThn288_N5Timer10Connection11set_timeoutEN6Genode12MicrosecondsERNS1_15Timeout_handlerE T _ZThn288_N5Timer10Connection9curr_timeEv T @@ -1411,10 +1383,10 @@ index 3cfbdd7466..d7603e8ca4 100644 2.31.0 -From 9b1a5e00ba1fc7fccfec5ba6671c6e80e428f129 Mon Sep 17 00:00:00 2001 +From 5438e5588c588ce85cc21b764d99e68212552933 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 19 Feb 2021 16:09:23 +0100 -Subject: [PATCH 16/17] ldso: increase size of library names +Subject: [PATCH 15/24] ldso: increase size of library names --- repos/base/src/lib/ldso/include/config.h | 2 +- @@ -1437,10 +1409,10 @@ index 5708df0930..db9014a95b 100644 2.31.0 -From 01efe5a758792c513fa69b3f6acdca081cb153f3 Mon Sep 17 00:00:00 2001 +From 7e7ded6a57bffa425fff002ecfb6e9c38c5dc055 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 14 Apr 2021 10:43:21 +0200 -Subject: [PATCH 17/17] sandbox: round up priority levels to a power of two +Subject: [PATCH 16/24] sandbox: round up priority levels to a power of two The requirement that priority levels be a power of two is an implementation artifact, honor the value set in configuration @@ -1480,3 +1452,318 @@ index 639a4be4dd..5c09c5e596 100644 -- 2.31.0 + +From 958aeba4402b275b78e0e6f218e7bcaa08c5fea8 Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Wed, 6 May 2020 04:38:35 +0530 +Subject: [PATCH 17/24] libc: add siginterrupt dummy + +--- + repos/libports/src/lib/libc/signal.cc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/repos/libports/src/lib/libc/signal.cc b/repos/libports/src/lib/libc/signal.cc +index a08854a8c0..2d2def34d3 100644 +--- a/repos/libports/src/lib/libc/signal.cc ++++ b/repos/libports/src/lib/libc/signal.cc +@@ -131,6 +131,9 @@ extern "C" int sigaction(int signum, const struct sigaction *act, struct sigacti + } + + ++extern "C" int siginterrupt(int sig, int flag) { return 0; }; ++ ++ + extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); + extern "C" int __sys_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); + extern "C" int __libc_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction"))); +-- +2.31.0 + + +From 4a0b3161633f0369386bb0fdca10603c593670ad Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Wed, 6 May 2020 04:59:56 +0530 +Subject: [PATCH 18/24] libc: add upstream mbsinit + +--- + repos/libports/lib/mk/libc-locale.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/repos/libports/lib/mk/libc-locale.mk b/repos/libports/lib/mk/libc-locale.mk +index 8e75e59589..2bb98b1456 100644 +--- a/repos/libports/lib/mk/libc-locale.mk ++++ b/repos/libports/lib/mk/libc-locale.mk +@@ -6,7 +6,7 @@ CC_OPT += -D_Thread_local="" + FILTER_OUT = \ + c16rtomb.c c32rtomb_iconv.c mbrtoc16_iconv.c mbrtoc32_iconv.c \ + setlocale.c xlocale.c setrunelocale.c \ +- ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mbsinit.c mskanji.c utf8.c \ ++ ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mskanji.c utf8.c \ + + SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(LIBC_LOCALE_DIR)/*.c))) + +-- +2.31.0 + + +From 4d2e4e6fefe31ab7100fb56019b5b261288dc079 Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Wed, 27 May 2020 16:35:16 +0530 +Subject: [PATCH 19/24] libc: add mlock and munlock dummies + +--- + repos/libports/src/lib/libc/dummies.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc +index b01d95f717..f676b4979c 100644 +--- a/repos/libports/src/lib/libc/dummies.cc ++++ b/repos/libports/src/lib/libc/dummies.cc +@@ -218,5 +218,15 @@ int __attribute__((weak)) madvise(void *addr, size_t length, int advice) + + const struct res_sym __p_type_syms[] = { }; + ++#define DUMMY_EPERM(ret_type, ret_val, name, args) __attribute__((weak)) \ ++ret_type name args \ ++{ \ ++ errno = EPERM; \ ++ return ret_val; \ ++} ++ ++DUMMY_EPERM(int, -1, mlock, (const void *, size_t)); ++DUMMY_EPERM(int, -1, munlock, (const void *, size_t)); ++ + } /* extern "C" */ + +-- +2.31.0 + + +From efdf6d0b7e7dedf7295c524dae06c8354d8f49d2 Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Fri, 29 May 2020 09:26:50 +0530 +Subject: [PATCH 20/24] libc: return 0 from getpgrp and getppid dummies + +--- + repos/libports/src/lib/libc/dummies.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc +index f676b4979c..9c568dcc77 100644 +--- a/repos/libports/src/lib/libc/dummies.cc ++++ b/repos/libports/src/lib/libc/dummies.cc +@@ -109,8 +109,8 @@ DUMMY(char *, 0, _getlogin, (void)) + DUMMY(int , -1, getnameinfo, (const sockaddr *, socklen_t, char *, size_t, char *, size_t, int)) + DUMMY(struct servent *, 0, getservbyname, (const char *, const char *)) + DUMMY(int , -1, getsid, (pid_t)) +-DUMMY_SILENT(pid_t , -1, getppid, (void)) +-DUMMY(pid_t , -1, getpgrp, (void)) ++DUMMY_SILENT(pid_t , 0, getpgrp, (void)) ++DUMMY_SILENT(pid_t , 0, getppid, (void)) + DUMMY(int , -1, getpriority, (int, int)) + DUMMY(int , -1, getrusage, (int, rusage *)) + DUMMY_SILENT(uid_t , 0, getuid, (void)) +-- +2.31.0 + + +From 023f65d529f8218e7069d11c795a96362703819d Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Thu, 26 Nov 2020 12:47:30 +0100 +Subject: [PATCH 21/24] libc: always set argv and envp to valid arrays +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The arrays passed to main(…) must always be valid null-terminated arrays. + +Fix #3955 +--- + repos/libports/include/libc/args.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/repos/libports/include/libc/args.h b/repos/libports/include/libc/args.h +index d76ea51155..ca9a8fd38a 100644 +--- a/repos/libports/include/libc/args.h ++++ b/repos/libports/include/libc/args.h +@@ -25,6 +25,7 @@ static void populate_args_and_env(Libc::Env &env, int &argc, char **&argv, char + { + using Genode::Xml_node; + using Genode::Xml_attribute; ++ using Genode::max; + + env.config([&] (Xml_node const &node) { + +-- +2.31.0 + + +From cbfdd0967c467a15a5999516ae927f0873a839ec Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Wed, 2 Dec 2020 16:31:59 +0100 +Subject: [PATCH 22/24] libc: implement if_nametoindex + +--- + .../libports/src/lib/libc/socket_fs_plugin.cc | 50 ++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc +index d5db46ff83..fabaf68b5c 100644 +--- a/repos/libports/src/lib/libc/socket_fs_plugin.cc ++++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc +@@ -33,6 +33,8 @@ + #include + #include + #include ++#include ++#include + #include + + /* libc-internal includes */ +@@ -1128,7 +1130,53 @@ extern "C" int getifaddrs(struct ifaddrs **ifap) + } + + +-extern "C" void freeifaddrs(struct ifaddrs *) { } ++extern "C" void freeifaddrs(struct ifaddrs *) ++{ ++} ++ ++ ++static char const * static_if_name = "eth0"; ++ ++ ++extern "C" unsigned int ++if_nametoindex(const char *ifname) ++{ ++ return ::strcmp(ifname, static_if_name) ? 0 : 1; ++} ++ ++ ++extern "C" char * ++if_indextoname(unsigned int ifindex, char *ifname) ++{ ++ if (ifindex == 1) { ++ strncpy(ifname, static_if_name, IFNAMSIZ); ++ return ifname; ++ } ++ return NULL; ++} ++ ++ ++extern "C" struct if_nameindex * ++if_nameindex(void) ++{ ++ static struct if_nameindex if_ni_array[2] = { ++ { ++ .if_index = 1, ++ .if_name = (char *)static_if_name ++ }, ++ { ++ .if_index = 0, ++ .if_name = NULL ++ } ++ }; ++ ++ return if_ni_array; ++} ++ ++ ++extern "C" void if_freenameindex(struct if_nameindex *ptr) ++{ ++} + + + /**************************** +-- +2.31.0 + + +From 0be93ad6ce740791d769878746587cbac2ffb6bb Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Thu, 4 Jun 2020 01:03:37 +0530 +Subject: [PATCH 23/24] libc: add readpassphrase + +This symbol is already in the stub library. +--- + repos/libports/lib/mk/libc-gen.inc | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/repos/libports/lib/mk/libc-gen.inc b/repos/libports/lib/mk/libc-gen.inc +index ab0ce929aa..1c7f84e800 100644 +--- a/repos/libports/lib/mk/libc-gen.inc ++++ b/repos/libports/lib/mk/libc-gen.inc +@@ -40,7 +40,6 @@ FILTER_OUT_C += \ + getentropy.c \ + getutxent.c \ + pututxline.c \ +- readpassphrase.c \ + scandir_b.c \ + sem_new.c \ + signal.c \ +-- +2.31.0 + + +From 7ca495db9f9e72ff8b42420814e141a249d5eb95 Mon Sep 17 00:00:00 2001 +From: Emery Hemingway +Date: Wed, 2 Dec 2020 22:27:00 +0100 +Subject: [PATCH 24/24] libc: do not set different errno values for O_NOFOLLOW + +Do not replace ENOENT and EEXIST with ELOOP when open is called with +O_NOFOLLOW. This breaks Tor. +--- + 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 7fece6d88d..27a9eb1808 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.31.0 +