diff --git a/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch b/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch index 6c1a21ebea..6e8c30777a 100644 --- a/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch +++ b/package/system/procd/patches/0001-uxc-fix-compilation-error-caused-by-unused-variable.patch @@ -10,8 +10,6 @@ Signed-off-by: Christian Marangi uxc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/uxc.c b/uxc.c -index eb40eb2..b22d838 100644 --- a/uxc.c +++ b/uxc.c @@ -80,6 +80,8 @@ static struct blob_buf conf; @@ -31,6 +29,3 @@ index eb40eb2..b22d838 100644 int signal = SIGTERM; int c; --- -2.37.2 - diff --git a/package/system/procd/patches/0002-jail-correctly-check-for-null-pointer.patch b/package/system/procd/patches/0002-jail-correctly-check-for-null-pointer.patch new file mode 100644 index 0000000000..5028e23da8 --- /dev/null +++ b/package/system/procd/patches/0002-jail-correctly-check-for-null-pointer.patch @@ -0,0 +1,25 @@ +From 24f6bc4322754a753e4e3e413659d542fa798c7b Mon Sep 17 00:00:00 2001 +From: Philipp Meier +Date: Tue, 8 Nov 2022 14:38:37 +0100 +Subject: [PATCH] jail: correctly check for null pointer + +Handle case where opts.sysctl is not used. + +Signed-off-by: Philipp Meier +--- + jail/jail.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/jail/jail.c ++++ b/jail/jail.c +@@ -213,6 +213,10 @@ static void free_hooklist(struct hook_ex + + static void free_sysctl(void) { + struct sysctl_val *cur; ++ ++ if (!opts.sysctl) ++ return; ++ + cur = *opts.sysctl; + + while (cur) { diff --git a/package/system/procd/patches/0003-jail-ignore-missing-.dynamic-sect.patch b/package/system/procd/patches/0003-jail-ignore-missing-.dynamic-sect.patch new file mode 100644 index 0000000000..486f0f839c --- /dev/null +++ b/package/system/procd/patches/0003-jail-ignore-missing-.dynamic-sect.patch @@ -0,0 +1,45 @@ +From 93b2c2d5ed4ca369a9ea48163024125b958212b5 Mon Sep 17 00:00:00 2001 +From: Yuteng Zhong +Date: Sun, 9 Oct 2022 22:53:27 +0800 +Subject: [PATCH] jail: ignore missing .dynamic sect + +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. + +github issue: https://github.com/openwrt/openwrt/issues/10933 + +Signed-off-by: Yuteng Zhong +--- + jail/elf.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/jail/elf.c ++++ b/jail/elf.c +@@ -240,18 +240,18 @@ int elf_load_deps(const char *path, cons + + gcc_mips64_bug_work_around = 1; + #endif +- 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];