From bf7c80502e475dd3a6a3f01f3b151b56e356f4e4 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 29 May 2020 13:17:35 +0530 Subject: [PATCH] Fix execve mapping of special libraries --- packages/genodelabs/LIB.patch | 65 ++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) diff --git a/packages/genodelabs/LIB.patch b/packages/genodelabs/LIB.patch index f019d0e..93082d8 100644 --- a/packages/genodelabs/LIB.patch +++ b/packages/genodelabs/LIB.patch @@ -1,11 +1,11 @@ -commit f7b706b179c6faff24b94b1f89153568146d398f +commit 2db637f21b83701d21aa66295cd35c737649ecdc Author: Emery Hemingway Date: Tue May 5 21:39:21 2020 +0530 Produce libraries with conventional names diff --git a/repos/base/mk/dep_lib.mk b/repos/base/mk/dep_lib.mk -index b3c980c906..385318bd46 100644 +index 21fcb77e58..533aebffa3 100644 --- a/repos/base/mk/dep_lib.mk +++ b/repos/base/mk/dep_lib.mk @@ -142,8 +142,8 @@ endif @@ -67,7 +67,7 @@ index d551ac205b..e23fade62f 100644 - $(VERBOSE)ln -sf $(call select_so,$@) $@ + $(VERBOSE)ln -sf $(call select_so,$@) $(patsubst liblib%,lib%,$@) diff --git a/repos/base/mk/lib.mk b/repos/base/mk/lib.mk -index c482457af6..7abae9ecdc 100644 +index bfee2c7420..fac49c7298 100644 --- a/repos/base/mk/lib.mk +++ b/repos/base/mk/lib.mk @@ -123,14 +123,20 @@ message: @@ -102,7 +102,7 @@ index c482457af6..7abae9ecdc 100644 # LIB_TAG := $(addsuffix .lib.tag,$(LIB)) all: $(LIB_TAG) -@@ -202,7 +208,7 @@ STATIC_LIBS := $(sort $(foreach l,$(ARCHIVES:.lib.a=),$(LIB_CACHE_DIR)/$l/ +@@ -203,7 +209,7 @@ STATIC_LIBS := $(sort $(foreach l,$(ARCHIVES:.lib.a=),$(LIB_CACHE_DIR)/$l/ STATIC_LIBS_BRIEF := $(subst $(LIB_CACHE_DIR),$$libs,$(STATIC_LIBS)) # @@ -123,6 +123,63 @@ index 04caae01b2..8d64b0d34e 100644 + $(VERBOSE)$(RM) -f *.d *.i *.ii *.s *.ali *.lib.so lib*.so clean: clean_prg_objects +diff --git a/repos/base/src/lib/ldso/include/file.h b/repos/base/src/lib/ldso/include/file.h +index 1c9ce53ca3..a8875a781e 100644 +--- a/repos/base/src/lib/ldso/include/file.h ++++ b/repos/base/src/lib/ldso/include/file.h +@@ -132,10 +132,10 @@ struct Linker::Elf_file : File + * the end of the linker area to ensure that the newly loaded + * binary has enough room within the linker area. + */ +- bool const resident = (name == "libc.lib.so") +- || (name == "libm.lib.so") +- || (name == "posix.lib.so") +- || (strcmp(name.string(), "vfs", 3) == 0); ++ bool const resident = (name == "libc.so") ++ || (name == "libm.so") ++ || (name == "libposix.so") ++ || (strcmp(name.string(), "libvfs", 6) == 0); + + reloc_base = resident ? Region_map::r()->alloc_region_at_end(size) + : Region_map::r()->alloc_region(size); +diff --git a/repos/libports/src/lib/libc/execve.cc b/repos/libports/src/lib/libc/execve.cc +index 73fd407db7..554d943763 100644 +--- a/repos/libports/src/lib/libc/execve.cc ++++ b/repos/libports/src/lib/libc/execve.cc +@@ -325,10 +325,10 @@ void Libc::init_execve(Env &env, Genode::Allocator &alloc, void *user_stack_ptr, + _binary_name_ptr = &binary_name; + _fd_alloc_ptr = &fd_alloc; + +- Dynamic_linker::keep(env, "libc.lib.so"); +- Dynamic_linker::keep(env, "libm.lib.so"); +- Dynamic_linker::keep(env, "posix.lib.so"); +- Dynamic_linker::keep(env, "vfs.lib.so"); ++ Dynamic_linker::keep(env, "libc.so"); ++ Dynamic_linker::keep(env, "libm.so"); ++ Dynamic_linker::keep(env, "libposix.so"); ++ Dynamic_linker::keep(env, "libvfs.so"); + } + + +diff --git a/repos/libports/src/lib/libc/kernel.cc b/repos/libports/src/lib/libc/kernel.cc +index 5dd4b2a2d6..430295e7d5 100644 +--- a/repos/libports/src/lib/libc/kernel.cc ++++ b/repos/libports/src/lib/libc/kernel.cc +@@ -308,10 +308,10 @@ void Libc::Kernel::_clone_state_from_parent() + * regular startup of the child. + */ + bool const blacklisted = (name == "ld.lib.so") +- || (name == "libc.lib.so") +- || (name == "libm.lib.so") +- || (name == "posix.lib.so") +- || (strcmp(name.string(), "vfs", 3) == 0); ++ || (name == "libc.so") ++ || (name == "libm.so") ++ || (name == "libposix.so") ++ || (strcmp(name.string(), "libvfs", 6) == 0); + if (!blacklisted) + copy_from_parent(range_attr(node)); + } diff --git a/repos/os/src/lib/vfs/file_system_factory.cc b/repos/os/src/lib/vfs/file_system_factory.cc index 48069d3fb8..53e8678757 100644 --- a/repos/os/src/lib/vfs/file_system_factory.cc