diff mbox series

jail: ignore missing .dynamic sect

Message ID mailman.24701.1665327047.4154159.openwrt-devel@lists.openwrt.org
State Superseded
Headers show
Series jail: ignore missing .dynamic sect | expand

Commit Message

hurrhnn--- via openwrt-devel Oct. 9, 2022, 2:49 p.m. UTC
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
From: Yuteng Zhong <zonyitoo@qq.com>

github issue: https://github.com/openwrt/openwrt/issues/10933

A static-linked binary doesn't have a .dynamic section, but when
starting ujail with -r or -w will automatically search for PT_DYNAMIC in
ELF and exit with failure if it is not found.

Signed-off-by: Yuteng Zhong <zonyitoo@qq.com>
---
 jail/elf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/jail/elf.c b/jail/elf.c
index 176d046..978fc6e 100644
--- a/jail/elf.c
+++ b/jail/elf.c
@@ -236,18 +236,18 @@  int elf_load_deps(const char *path, const char *map)
 	unsigned long load_offset, load_vaddr;
 	unsigned long interp_offset;
 
-	if (elf_find_section(map, PT_LOAD, &load_offset, NULL, &load_vaddr)) {
-		ERROR("failed to load the .load section from %s\n", path);
-		return -1;
+	if (elf_find_section(map, PT_INTERP, &interp_offset, NULL, NULL) == 0) {
+		add_path_and_deps(map+interp_offset, 1, -1, 0);
 	}
 
-	if (elf_find_section(map, PT_DYNAMIC, &dyn_offset, &dyn_size, NULL)) {
-		ERROR("failed to load the .dynamic section from %s\n", path);
-		return -1;
+	if (elf_find_section(map, PT_LOAD, &load_offset, NULL, &load_vaddr)) {
+		DEBUG("failed to load the .load section from %s\n", path);
+		return 0;
 	}
 
-	if (elf_find_section(map, PT_INTERP, &interp_offset, NULL, NULL) == 0) {
-		add_path_and_deps(map+interp_offset, 1, -1, 0);
+	if (elf_find_section(map, PT_DYNAMIC, &dyn_offset, &dyn_size, NULL)) {
+		DEBUG("failed to load the .dynamic section from %s\n", path);
+		return 0;
 	}
 
 	int clazz = map[EI_CLASS];