service: Start services normally when seccomp is disabled When service init file declares seccomp support (procd_set_param seccomp), but procd is compiled without seccomp support, the service should be started normally, because seccomp-trace and utrace are not available. Older procd versions decided about whether to start a service in seccomp sandbox or not based on existence of seccomp whitelist in the filesystem. This was recently removed (c8faedc "Do not disable seccomp when configuration is not found", 2017-09-12) because it could be easy for attackers to disable seccomp support. This changes is a follow-up to the mentioned commit. With it, procd decides about whether to use seccomp sandbox based only on compile-time configuration. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz> Tested-by: Hans Dedecker <dedeckeh@gmail.com>
init: add support for sysupgrades triggered from preinit This will allow to add support for sysupgrades via upgraded from failsafe mode. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
system: always support staged sysupgrade In preparation for switching all targets to the staged sysupgrade mechanism, upgraded is always built, and the "nandupgrade" ubus method is renamed to "sysupgrade". To make the migration easier, support for the old name "nandupgrade" and the "upgrade" method that will become unused with the staged sysupgrade is retained for now. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
procd: fix build when DEBUG is set There is a collision between the DEBUG set in the CMake file as flag and the macro defined in log.h, resulting in build error: In file included from ./procd/initd/init.h:19:0, from ./procd/initd/init.c:33: ./procd/initd/../log.h:20:0: error: "DEBUG" redefined [-Werror] #define DEBUG(level, fmt, ...) do { \ ^ <command-line>:0:0: note: this is the location of the previous definition cc1: all warnings being treated as errors This patch fixes the issue by renaming the build flag to UDEV_DEBUG (since it is only used in udevtrigger). Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
cmake: Find libubox/uloop.h Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for libubox/uloop.h. Some external toolchains which do not include standard locations would fail to find the header otherwise. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
add a build-time option to disable init related code Signed-off-by: Felix Fietkau <nbd@openwrt.org>
add option to disable build of the init binary Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Expose EARLY_PATH as cmake flag Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
ujail: rework fs jail part 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>
cmake: use CMAKE_INSTALL_* variables Replace hard-coded installation directories with cmake-provided variables, which gives more flexibility on where to install final binaries. Great simplification for usage with e.g. BitBake recipes. Signed-off-by: Sergiy Kibrik <sakib@meta.ua>
jail: add capabilities support If there is one or more capabilities in cap.keep, drop all capabilities not in cap.keep. Always drop all capabalities in cap.drop exemple json syntax: { "cap.keep": [ "cap_net_raw" ], "cap.drop": [] } Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
add UTRACE_SUPPORT build option we can now build preload-seccomp, ujail, utrace separately Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
service: if logging start app with LD_PRELOAD & lib for line buffering Using pipe automatically switches service to block buffering which kind of breaks our logging. We won't get anything from stdout FD until the buffer gets filled fully or the service exits. This makes log messages appear with an unwanted delay. This change adds a tiny libsetlbf.so switching stdout to line buffering and uses this lib for every logging-enabled service started by procd. We don't need any extra change for stderr as it's unbuffered by default. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Modified to use no buffering to align with stderr. Several cleanups. Signed-off-by: Steven Barth <steven@midlink.org>
make jail build optional Signed-off-by: John Crispin <blogic@openwrt.org>
add initial version of ujail and utrace Signed-off-by: John Crispin <blogic@openwrt.org>
json 0.12 fixes Signed-off-by: John Crispin <blogic@openwrt.org>
Make build of upgraded optional Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
add support for zram compressed tmpfs Signed-off-by: John Crispin <blogic@openwrt.org>
Use one generic routine to access /proc/cmdline Signed-off-by: Michel Stam <m.stam@fugro.nl>
make static linking work for upgraded Signed-off-by: John Crispin <blogic@openwrt.org>