| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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 <zonyitoo@qq.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Revert commit 33b799b ("ujail: elf: work around GCC bug on MIPS64")
The procd jails are working fine on MIPS64 too now.
I saw this error message when add_path_and_deps() was called which calls
elf_load_deps() again under some conditions. This is happening because
gcc_mips64_bug_work_around is stored in the data segment.
We have a call trace like this:
elf_load_deps()
gcc_mips64_bug_work_around = 1;
call add_path_and_deps()
call elf_load_deps()
gcc_mips64_bug_work_around = 1;
error if gcc_mips64_bug_work_around =! 1
gcc_mips64_bug_work_around = 0;
return;
return;
error if gcc_mips64_bug_work_around =! 1
return;
I got the same error messages on MIPS 32 BE, when I removed the compile
check.
This was tested in qemu on MIPS 64 BE and MIPS64 LE.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The members p_offset, p_filesz and p_vaddr of the structure Elf64_Phdr
are all uint64_t. This structure is used for 64 bit applications.
Without this change we would convert the 64 bit values into 32 bit
values and an overflow could happen in this conversion.
On MIPS 64 BE the variable load_vaddr has the value 0x120000000 which
sets the 32th bit which will overflow when converted to a 32 bit value.
On 32 bit systems Elf32_Phdr is used with uint32_t, converting this to
64 bit values too should not cause problems as this is not in the hot
path.
Without this fix I am getting error messages like this at bootup on MIPS 64 BE:
[ 16.622602] do_page_fault(): sending SIGSEGV to ujail for invalid read access from 00000100f37251e3
[ 16.622907] epc = 000000aaab4ed0e0 in ujail[aaab4e0000+18000]
[ 16.623237] ra = 000000aaab4ed694 in ujail[aaab4e0000+18000]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
|
|
|
| |
Always free everything before exiting, clean up dynamic structures,
add missing free() calls in various places, ...
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Work-around gcc bug which leads to segfault parsing ELF on MIPS64.
The codepath added in this commit gets triggered when parsing
/lib/ld-musl-mips64-sf.so.1 (a symlink to /lib/libc.so) on MIPS64
(built with gcc-8.4.0 and musl 1.1.24) in qemu-system-mips64 on the
malta/be64 target.
Include work-around outputting an error message, but preventing
segfault when building for MIPS64.
Tested-by: Roman Kuzmitskii <damex.pp@icloud.com>
[tested on edgerouter 4 and edgerouter lite]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
|
|
|
|
|
| |
if we forget to close() in the future,
this prevent fd leak
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
this is needed by musl (openwrt DD)
uClibc/glibc is working without this
this partly fixes
https://dev.openwrt.org/ticket/20785
we still don't handle DT_RPATH, DT_RUNPATH, nodeflib, ...
see http://man7.org/linux/man-pages/man8/ld.so.8.html
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change functions to work with full paths (do less split and concat of path)
Store "soname" as key and the fullpath as path in "libraries"
Remove "extras" list and replace it with "mounts" avl_tree
("mounts" also store fullpath)
Add add_path_and_deps() function to handle file/lib openning and mmaping
Check if file is an elf (magic number) before passing it to elf_load_deps()
elf_load_deps() now only handle elf parsing part
next commit adds script (#!) handling
Use add_path_and_deps() with -r and -w args to automatically add dependencies
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
|
| |
see
https://docs.oracle.com/cd/E19683-01/817-3677/chapter6-42444/index.html
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
| |
this code is present since first ujail commit (dfcfcca7)
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
|
|
|
| |
move all libraries search initialisation stuff
into elf.c / init_library_search()
for now we don't handle musl specific files
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
| |
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
| |
headers must include all there dependencies, no more, no less
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
|
|
|
| |
headers must include all there dependencies, no more, no less
(it uses fprintf)
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
| |
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
| |
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
|
|
| |
Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
Signed-off-by: John Crispin <blogic@openwrt.org>
|