platform/upstream/nsjail.git
10 months agoMakefile: Add security compiling flags (RELRO) 40/301940/1
Unsung Lee [Fri, 24 Nov 2023 12:41:42 +0000 (21:41 +0900)]
Makefile: Add security compiling flags (RELRO)

Add "-Wl,-z,relro" (Partial RELRO) in COMMON_FLAGS and LDFLAGS
to support RELRO (RELocation Read-Only).
It is used to defend against GOT-Overwrite attack by removeing write permission.

Change-Id: If15e159d5b2e5ad1a07e54098ac9051581881abe
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
13 months agopackaging: add the patch for kafel 36/297036/1 accepted/tizen/8.0/unified/20231005.095253 accepted/tizen/unified/20230818.183530 tizen_8.0_m2_release
Łukasz Stelmach [Thu, 3 Aug 2023 12:09:37 +0000 (14:09 +0200)]
packaging: add the patch for kafel

The patch fixes problems with paralel builds on highly loaded systems,
where bison(1) and flex(2) may be invoked twice and break currently
running compilers.

Change-Id: I1699ad46b5bad49f5076623f7b7b38a482e789f2
Cc: HyungGi Lee <hyunggi.lee@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
13 months agoRestore "riscv64: Update kafel"
Łukasz Stelmach [Wed, 9 Aug 2023 08:22:04 +0000 (10:22 +0200)]
Restore "riscv64: Update kafel"

This reverts commit 4adb2b26b95c34474b45ab716c131ac26165eea3.

Change-Id: Ieb57480755310acc21e0911cd16e92367b89ba6b
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
14 months agoRevert "riscv64: Update kafel" 92/296392/1 accepted/tizen/unified/20230803.034054
Chanwoo Choi [Thu, 27 Jul 2023 01:26:14 +0000 (10:26 +0900)]
Revert "riscv64: Update kafel"

This reverts commit 7fd784c88b99962b40087bce082ae970464091df.

It cause the build fail. Revert it and then fix the build issue.

Change-Id: I8adab0910411f2cf60aab060535d382598554345
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
18 months agoFix compile using `FROM ubuntu:20.04` 18/290818/1 accepted/tizen/unified/20230621.023214 accepted/tizen/unified/dev/20230726.115432
ndrewh [Thu, 4 Nov 2021 01:17:18 +0000 (21:17 -0400)]
Fix compile using `FROM ubuntu:20.04`

Remove clone_args members that are only present in 5.5+ and 5.7+

cherry-picked upstream commit b248125

Change-Id: I05e6d003bf528ff4c445d1610b440eafc2f81ff7

22 months agoriscv64: Update kafel 62/284662/2 submit/tizen/20221206.114626
Marek Pikuła [Tue, 8 Nov 2022 15:20:55 +0000 (16:20 +0100)]
riscv64: Update kafel

Upstream Kafel version https://github.com/google/kafel.git 1af0975

Change-Id: I4754aa094ad0efb4b308a9e1c1fb0f9cfba39493
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2 years agoAdd .gitignore 05/272305/2
Hyotaek Shim [Mon, 14 Mar 2022 09:21:48 +0000 (18:21 +0900)]
Add .gitignore

Change-Id: I45d3a57cea80ba0a6d6f949568a306db76f8d367
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
2 years agoFix nsjail.service to remove duplicated options 03/272303/2
Hyotaek Shim [Mon, 14 Mar 2022 09:20:02 +0000 (18:20 +0900)]
Fix nsjail.service to remove duplicated options

Change-Id: I8c468e8e13fb8de25f585c58370987667529ba86
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
3 years agoFix Multiple Targets and Parallel builds issue accepted/tizen_6.5_unified accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0 tizen_7.0_hotfix accepted/tizen/6.5/unified/20211028.224209 accepted/tizen/7.0/unified/20221110.061308 accepted/tizen/7.0/unified/hotfix/20221116.111203 accepted/tizen/unified/20210928.125403 submit/tizen/20210924.054742 submit/tizen_6.5/20211028.163601 tizen_6.5.m2_release tizen_7.0_m2_release
Kunhoon Baik [Fri, 24 Sep 2021 05:40:24 +0000 (14:40 +0900)]
Fix Multiple Targets and Parallel builds issue

In parallel build (with -j option), xxx.c and xxx.h is scheduled independently.
Thus, bison and flex will be called twice.

Sometimes, it causes build error.
To create multiple targets in one invocation, pattern rules with multiple targets are used.

3 years agoDisable remount memory cgroup and no malort creation if no memory cgroup accepted/tizen/unified/20210923.012103 submit/tizen/20210916.083705
Kunhoon Baik [Thu, 16 Sep 2021 08:20:41 +0000 (17:20 +0900)]
Disable remount memory cgroup and no malort creation if no memory cgroup

If memory cgroup does not existed,
 - we will not try to create memory cgroup or remount memory cgroup.
 - malort will not setup memory cgroup

3 years agoRemove /bin, /usr/bin mount from test configuration
Kunhoon Baik [Fri, 10 Sep 2021 08:20:59 +0000 (17:20 +0900)]
Remove /bin, /usr/bin mount from test configuration

For minimal expose of executable binary

3 years agoAdjust test configuration of nsjail test accepted/tizen/unified/20210910.025730 submit/tizen/20210909.125926
Kunhoon Baik [Thu, 9 Sep 2021 12:57:58 +0000 (21:57 +0900)]
Adjust test configuration of nsjail test

3 years ago[Temporary] Add lua related directory
Kunhoon Baik [Thu, 9 Sep 2021 12:56:04 +0000 (21:56 +0900)]
[Temporary] Add lua related directory

This is a patch for malort project.
This patch will be moved to other git with refactoring.

3 years agoFix test nsjail configuration accepted/tizen/unified/20210909.052205 submit/tizen/20210909.002301 submit/tizen/20210909.025949
Kunhoon Baik [Thu, 9 Sep 2021 00:19:10 +0000 (09:19 +0900)]
Fix test nsjail configuration

The number of nsjail's default nofile is 32.
In some target platform, it is too low.
Thus, this patch set enough large number to nofile.

3 years agoFix to apply mthumb option to only arm
Kunhoon Baik [Thu, 9 Sep 2021 00:18:17 +0000 (09:18 +0900)]
Fix to apply mthumb option to only arm

3 years agoAdd mthumb option to Linker flag submit/tizen/20210908.021401
Kunhoon Baik [Wed, 8 Sep 2021 02:12:18 +0000 (11:12 +0900)]
Add mthumb option to Linker flag

For supporting mthumb (+lto) in compiler 9.2, -mthumb should be also applied to "link flags"

3 years agoAdd TV permission signature to service file accepted/tizen/unified/20210907.121834 submit/tizen/20210907.030831
Kunhoon Baik [Tue, 7 Sep 2021 03:02:25 +0000 (12:02 +0900)]
Add TV permission signature to service file

3 years agoAdd cgroup_remount program for target using old-resourced
Kunhoon Baik [Mon, 6 Sep 2021 07:41:04 +0000 (16:41 +0900)]
Add cgroup_remount program for target using old-resourced

Old Tizen resourced used "resourced" cgroup folder for controlling memory instead of "memory"
To apply nsjail(+malort) for such target, memory folder should be created.

For the compatibility, cgroup_mount is provided.

cf) provide mount prgoram because some targets cannot use mount program freely.

3 years agoFix "-Werror=shadow" Error of open source nsjail accepted/tizen/unified/20210903.044531 submit/tizen/20210903.005907
Kunhoon Baik [Fri, 3 Sep 2021 00:55:02 +0000 (09:55 +0900)]
Fix "-Werror=shadow" Error of open source nsjail

The arg env of systemExe function shadows global env variable.
 - Local Function : int systemExe(const std::vector<std::string>& args, char** env);
 - Global : static __thread jmp_buf env;

-Werror=shadow options catches the issue.
Thus, the arg env of systemExe is changed to exec_env to avoid the compiler issue.

cf) This patch is not yet contributed to nsjail open source.

3 years agoExit test program in case of malloc fail submit/tizen/20210831.013333
Kunhoon Baik [Tue, 31 Aug 2021 01:31:40 +0000 (10:31 +0900)]
Exit test program in case of malloc fail

3 years agox86 build fixes accepted/tizen/unified/20210826.024531 submit/tizen/20210826.011604
Kunhoon Baik [Wed, 25 Aug 2021 10:19:07 +0000 (19:19 +0900)]
x86 build fixes

Recent x86 build problem of kafel was solved.
 - https://github.com/google/nsjail/commit/87af69bea4a2ec3cc8ba0866bed55cb00b1b565c

Instead of disabling x86 build, apply the patch.

3 years agoAdd definition for building Kafel in ARM and AARCH64 submit/tizen/20210825.085400
Kunhoon Baik [Wed, 25 Aug 2021 08:35:24 +0000 (17:35 +0900)]
Add definition for building Kafel in ARM and AARCH64

Tizen support linux kernel header include files in the linux-glibc-devel package.
Unfortunately, it supports old definition.

Thus, to build Kafel correctly, following definition should be defined.
(Original Kafel does not include such definition)

This patche includes the modification in kafel/src/common.h

3 years agoAdd nsjail upstream url
Kunhoon Baik [Wed, 25 Aug 2021 05:24:45 +0000 (14:24 +0900)]
Add nsjail upstream url

Please keep the latest upstream source code in the upstream-git by using the url in "#X-Vcs-Url"

You can update the upstream manually. Following commands can be used to keep the latest upstream source code.
 $ git remote add upstream https://github.com/google/nsjail.git
 $ git fetch --all
 $ git checkout upstream-git
 $ git rebase upstream/master
 $ git push origin upstream-git:upstream-git

3 years agoClean up Kafel source code
Kunhoon Baik [Tue, 24 Aug 2021 01:38:36 +0000 (10:38 +0900)]
Clean up Kafel source code

Cleanup object files and bison/flex generated files

3 years agoDisable Net NS feature for Tizen
Kunhoon Baik [Mon, 23 Aug 2021 07:53:47 +0000 (16:53 +0900)]
Disable Net NS feature for Tizen

Tizen does not support libnl3 net namespace officially because libnl3 version is 3.2.22.

At this moment, malort project does not require network virtualization.
Thus, at this moment, it is ok to disable Tizen.

In the future, when libnl3 is upgraded to over 3.2.24, net namespace feature will be enabled.

3 years agoDisable MACVLAN feature for Tizen
Kunhoon Baik [Mon, 23 Aug 2021 07:20:38 +0000 (16:20 +0900)]
Disable MACVLAN feature for Tizen

Tizen does not support libnl3 macvlan officially because libnl3 version is 3.2.22.
In addition, MACVLAN feature was not tested in Tizen.

At this moment, malort project does not require network virtualization.
Thus, at this moment, it is ok to disable Tizen.

In the future, when MACVLAN supports in Tizen, MACVLAN feature will be enabled.

3 years agoChange test configuration - log path and cpu conf
Kunhoon Baik [Thu, 29 Jul 2021 10:55:33 +0000 (19:55 +0900)]
Change test configuration - log path and cpu conf

- malort project will use "/var/log/malort" instead of "/tmp"
- malort project does not create child cgroup node of each "NSJAIL" process.

3 years agoAdd /dev and /tmp for Testing
Kunhoon Baik [Wed, 21 Jul 2021 08:44:08 +0000 (17:44 +0900)]
Add /dev and /tmp for Testing

 - some program may access to /dev/random by using random function
   For that, add /dev bind mount until finding better way

 - Tizen application cannot write some volatile data to /opt/var
   For that, provide /tmp mount until finding better way

3 years agoChange cgroup node from NSJAIL to malort
Kunhoon Baik [Wed, 21 Jul 2021 00:27:33 +0000 (09:27 +0900)]
Change cgroup node from NSJAIL to malort

As default, NSJAIL uses "NSJAIL" folder to create nsjail controller cgroup.
However, ST-hub uses the folder as "malort" which is internal project name.

At this moment, to reduce not-hurried code clean-up tasks, change nsjail root folder as "malort"

3 years agoAdd nsjail test Tizen application
Kunhoon Baik [Mon, 19 Jul 2021 04:27:18 +0000 (13:27 +0900)]
Add nsjail test Tizen application

This is an application to execute nsjail for testing nsjail in Tizen application Environment.

Use build script "build_test_runner.sh" to build. You need to install Tizen CLI to build.
You can execute the app like following.
 - $> aul_test launch test_runner execute /usr/bin/nsjail_test/jail_mem_syscall_test

3 years agoAdd nsjail service for Tizen distribution
Kunhoon Baik [Mon, 19 Jul 2021 03:14:39 +0000 (12:14 +0900)]
Add nsjail service for Tizen distribution

Tizen will use nsjail as application container by using USER Namespeace.

If creating new user namespace, the new user can get admin(root) privilege in the namespace,
and can use several kernel resource by creating other namespaces.

However, the new user namesapce cannot access unprivilged resource in original namespace.
For that, Tizen nsjail service creates some resources (directories for cgroup, and bind mount tmp directories) for the new user namespace.

cf) Each Tizen App has each smack label.
    Unfortunatly, nsjail does not consider such issue for bind mount.
    For that, at this moment, we create new user's uid based folder name for each application.
    In the future, the folder name should be created on basis of Tizen package name.

3 years agoAdd runner-sandbox.cfg for Tizen nsjail test
Kunhoon Baik [Fri, 16 Jul 2021 09:10:46 +0000 (18:10 +0900)]
Add runner-sandbox.cfg for Tizen nsjail test

Nsjail uses a specific configuration file for jailing.
For testing nsjail in Tizen, sthub script engine runner sandbox.cfg is added.
You can test it like following.

nsjail -v --config /usr/share/runner-sandbox.cfg -- /usr/bin/nsjail_test/jail_mem_syscall_test

3 years agoAdd Simple test program for Tizen nsjail
Kunhoon Baik [Thu, 15 Jul 2021 09:19:35 +0000 (18:19 +0900)]
Add Simple test program for Tizen nsjail

 - memory limit test
 - syscall(getuid) violation test

The more test programs should be created

3 years agoAdjust cgroup cpu for Tizen
Kunhoon Baik [Thu, 15 Jul 2021 05:16:27 +0000 (14:16 +0900)]
Adjust cgroup cpu for Tizen

Latest public Tizen does not support cfs_period_us or cfs_quota_us because CONFIG_FAIR_GROUP_SCHED, CONFIG_CFS_BANDWIDTH are not enabled.
Thus, instead of strict cpu limitation using cfs_quota, use cpu_shares.
The cpu_shares of each NSJAIL process will be assigned according to ratio (cfs_quota/cfs_period)

This is temporary patch and is not well validated.
Tizen will consider to enable the kernel option for cfs_quota_us.

3 years agoCreating nsjail RPM specification and build patch based on upstream-git branch
Kunhoon Baik [Mon, 12 Jul 2021 09:07:35 +0000 (18:07 +0900)]
Creating nsjail RPM specification and build patch based on upstream-git branch

Upstream git was created with "nsjail 2021-07-07 version"
For Tizen RPM, additional patches were created based on the open source version

1) Linking to upstream-git branch - .gbs.conf
   : You can check the Tizen open source updating guide at https://wiki.tizen.org/Updating_packages

2) Creating kafel.tar.gz
   : Unfortunately, Tizen does not provide git tool at build time. (git-core package is required)
   : Thus, instead of using git submodule command, create kafel.tar.gz from the git submodule.
   : For your information, following patch is added for the kafel for fixing build error (TODO)

+// Fix for Linux <3.12
+#ifndef EM_ARM
+#define EM_ARM 40
+#endif
+

3) NSJail requires 3.2.24 over libnl3 vesion.
   Unfortunately, current Tizen libnl3 version 3.2.22. (TODO)

3 years agocmdline: clone_newcgroup -> true by default; clone_newtime should be false 3.0.20210707
Robert Swiecki [Wed, 7 Jul 2021 09:55:17 +0000 (11:55 +0200)]
cmdline: clone_newcgroup -> true by default; clone_newtime should be false

3 years agomake indent
Robert Swiecki [Wed, 16 Jun 2021 15:44:07 +0000 (17:44 +0200)]
make indent

3 years agoMerge pull request #172 from eli-zr/_macvlan_mode
robertswiecki [Wed, 16 Jun 2021 15:43:31 +0000 (17:43 +0200)]
Merge pull request #172 from eli-zr/_macvlan_mode

MACVLAN modes support

3 years agoMACVLAN modes support
Eli Zrihen [Wed, 16 Jun 2021 13:59:12 +0000 (16:59 +0300)]
MACVLAN modes support

3 years agoEnable support for clone3() and for CLONE_NEWTIME
Robert Swiecki [Tue, 18 May 2021 12:38:01 +0000 (14:38 +0200)]
Enable support for clone3() and for CLONE_NEWTIME

3 years agoMerge pull request #170 from infiniteregrets/fix-macro
robertswiecki [Wed, 12 May 2021 07:51:35 +0000 (09:51 +0200)]
Merge pull request #170 from infiniteregrets/fix-macro

Fixed macro in subproc.cc

3 years agoFixed macro in subproc.cc
Mehul Arora [Wed, 12 May 2021 06:43:06 +0000 (12:13 +0530)]
Fixed macro in subproc.cc

3 years agoInitial support for CLONE_NEWTIME
Robert Swiecki [Tue, 11 May 2021 12:48:45 +0000 (14:48 +0200)]
Initial support for CLONE_NEWTIME

3 years agoUpdate kafel to include bugfixes
Wiktor Garbacz [Fri, 7 May 2021 15:50:31 +0000 (17:50 +0200)]
Update kafel to include bugfixes

3 years agoconfigs/ - add comments to config files using #
Robert Swiecki [Wed, 5 May 2021 11:50:51 +0000 (13:50 +0200)]
configs/ - add comments to config files using #

3 years agoMerge pull request #164 from ziqin/master
robertswiecki [Tue, 4 May 2021 19:41:17 +0000 (21:41 +0200)]
Merge pull request #164 from ziqin/master

Fix a typo in command line description

3 years agoBump kafel
Wiktor Garbacz [Wed, 28 Apr 2021 14:32:09 +0000 (16:32 +0200)]
Bump kafel

3 years agoYet another bugfix Kafel version bump
Wiktor Garbacz [Thu, 22 Apr 2021 09:01:04 +0000 (11:01 +0200)]
Yet another bugfix Kafel version bump

3 years agoupdate kafel again to include a bugfix.
Wiktor Garbacz [Wed, 21 Apr 2021 07:47:20 +0000 (09:47 +0200)]
update kafel again to include a bugfix.

3 years agoUpdate kafel
Wiktor Garbacz [Fri, 16 Apr 2021 12:22:30 +0000 (14:22 +0200)]
Update kafel

3 years agoFix default value of cgroup_cpu_mount in README
WANG Ziqin [Sat, 3 Apr 2021 15:59:35 +0000 (23:59 +0800)]
Fix default value of cgroup_cpu_mount in README

3 years agoFix typo in command line description
Ziqin Wang [Sat, 3 Apr 2021 15:31:56 +0000 (23:31 +0800)]
Fix typo in command line description

3 years agoMerge pull request #160 from ginkoid/master
happyCoder92 [Wed, 10 Feb 2021 07:47:34 +0000 (08:47 +0100)]
Merge pull request #160 from ginkoid/master

net: add support for max_conns

3 years agonet: add support for max_conns
Philip Papurt [Tue, 9 Feb 2021 22:13:35 +0000 (17:13 -0500)]
net: add support for max_conns

3 years agosubproc: refer users to dmesg in case si_syscall==31 (SIGSYS)
Robert Swiecki [Mon, 1 Feb 2021 22:22:43 +0000 (23:22 +0100)]
subproc: refer users to dmesg in case si_syscall==31 (SIGSYS)

3 years agoFix build
Wiktor Garbacz [Thu, 28 Jan 2021 08:47:31 +0000 (09:47 +0100)]
Fix build

3 years agoAdd new capabilities, ignore unsupported caps for bounding set
Wiktor Garbacz [Wed, 27 Jan 2021 13:37:12 +0000 (14:37 +0100)]
Add new capabilities, ignore unsupported caps for bounding set

4 years agonsjail: don't add connections to the proxy map if launching a new process failed
Robert Swiecki [Sun, 30 Aug 2020 21:22:22 +0000 (23:22 +0200)]
nsjail: don't add connections to the proxy map if launching a new process failed

4 years agosubproc: kill a process once in the -Ml mode once the TCP connection has ended
Robert Swiecki [Sun, 30 Aug 2020 20:02:08 +0000 (22:02 +0200)]
subproc: kill a process once in the -Ml mode once the TCP connection has ended

4 years agoMerge pull request #150 from joemiller/patch-1
robertswiecki [Wed, 26 Aug 2020 15:02:02 +0000 (17:02 +0200)]
Merge pull request #150 from joemiller/patch-1

remove build dependency on which

4 years agomake indent
Robert Swiecki [Wed, 26 Aug 2020 14:09:55 +0000 (16:09 +0200)]
make indent

4 years agoremove build dependency on which
joe miller [Sat, 15 Aug 2020 00:07:30 +0000 (17:07 -0700)]
remove build dependency on which

4 years agoMerge pull request #148 from boryspoplawski/master
robertswiecki [Mon, 3 Aug 2020 20:42:28 +0000 (22:42 +0200)]
Merge pull request #148 from boryspoplawski/master

Fix compilation errors on old gcc (5.4.0)

4 years agoMakefile: compile kafel with -fPIE (maybe fixes #149)
Robert Swiecki [Mon, 3 Aug 2020 18:43:08 +0000 (20:43 +0200)]
Makefile: compile kafel with -fPIE (maybe fixes #149)

4 years agoFix compilation errors on old gcc (5.4.0)
borysp [Wed, 29 Jul 2020 13:18:10 +0000 (15:18 +0200)]
Fix compilation errors on old gcc (5.4.0)

4 years agoconfig.proto: make indent
Robert Swiecki [Tue, 28 Jul 2020 12:03:27 +0000 (14:03 +0200)]
config.proto: make indent

4 years agoconfig.proto: renumerate config fields
Robert Swiecki [Tue, 28 Jul 2020 12:02:34 +0000 (14:02 +0200)]
config.proto: renumerate config fields

4 years agoMerge pull request #147 from disconnect3d/patch-2 3.0
robertswiecki [Wed, 22 Jul 2020 22:09:23 +0000 (00:09 +0200)]
Merge pull request #147 from disconnect3d/patch-2

Fixes #146: cgroups_mem_max unit in config.proto

4 years agoFixes #146: cgroups_mem_max unit in config.proto
Disconnect3d [Thu, 16 Jul 2020 12:43:43 +0000 (14:43 +0200)]
Fixes #146: cgroups_mem_max unit in config.proto

This commit fixes the incorrect cgroups_mem_max unit described in a config.proto comment.

We do not perform any calculations on this value and we don't specify the values unit (k/M/G) when writing to memory cgroup controller files, so the value is specified in bytes.

4 years agomake indent
Robert Swiecki [Thu, 9 Jul 2020 15:29:02 +0000 (17:29 +0200)]
make indent

4 years agoconfig: remove deprecated config options
Robert Swiecki [Thu, 9 Jul 2020 15:28:56 +0000 (17:28 +0200)]
config: remove deprecated config options

4 years agoMerge pull request #145 from cblichmann/master
robertswiecki [Tue, 7 Jul 2020 14:52:21 +0000 (16:52 +0200)]
Merge pull request #145 from cblichmann/master

Fix a few typos.

4 years agoFix a few typos.
Christian Blichmann [Tue, 7 Jul 2020 12:07:22 +0000 (14:07 +0200)]
Fix a few typos.

These were found by external tooling while preparing the Debian package.

* Uknown -> Unknown
* Writting -> Writing
* commited -> committed
* processess -> processes

Signed-off-by: Christian Blichmann <mail@blichmann.eu>
4 years agoMerge pull request #144 from arcz/config-deps-paths
happyCoder92 [Tue, 7 Jul 2020 09:55:11 +0000 (11:55 +0200)]
Merge pull request #144 from arcz/config-deps-paths

Build-time config of newuidmap and newgidmap paths

4 years agoStringify CLI-passed paths
Artur Cygan [Mon, 6 Jul 2020 12:38:11 +0000 (14:38 +0200)]
Stringify CLI-passed paths

4 years agoBuild-time config of newuidmap and newgidmap paths
Artur Cygan [Mon, 22 Jun 2020 11:42:22 +0000 (13:42 +0200)]
Build-time config of newuidmap and newgidmap paths

4 years agonsjail: don't change cwd during daemon()
Robert Swiecki [Tue, 21 Apr 2020 09:25:06 +0000 (11:25 +0200)]
nsjail: don't change cwd during daemon()

4 years agoFix format specifier for size_t
Wiktor Garbacz [Fri, 27 Mar 2020 09:19:40 +0000 (10:19 +0100)]
Fix format specifier for size_t

4 years agoMerge pull request #136 from c7f-m0d3/master
happyCoder92 [Thu, 19 Mar 2020 12:50:35 +0000 (13:50 +0100)]
Merge pull request #136 from c7f-m0d3/master

fix non-functional max_conns_per_ip

4 years agofix non-functional max_conns_per_ip
Piotr Krysiuk [Thu, 19 Mar 2020 00:13:28 +0000 (00:13 +0000)]
fix non-functional max_conns_per_ip

Starting with nsjail::listenMode update to pipe socket traffic [commit 273ce6bc846b7325c7f0915067c54bf8cf6f5654], a pipe file descriptor is passed as connsock parameter when calling net::limitConns and also as sock parameter when calling addProc in subproc::runChild.
This breaks net::limitConns because pid.remote_addr and also local variable addr are left uninitialized despite net::connToText calls when counting number of existing network connections from the same peer.

The subsequent correction to fetch remote address [commit 2cf562160d308f9b5cca767a2459332f2041b41c] made the bug even more interesting, since the loop in net::limitConns now compares unsanitized content of stack with network addresses of already connected clients.

4 years agoMerge pull request #133 from sirdarckcat/master
happyCoder92 [Mon, 2 Mar 2020 14:31:37 +0000 (15:31 +0100)]
Merge pull request #133 from sirdarckcat/master

Create dockerpush.yml

4 years agoCreate dockerpush.yml
Eduardo' Vela" Nava (sirdarckcat) [Sun, 1 Mar 2020 06:56:34 +0000 (07:56 +0100)]
Create dockerpush.yml

4 years agomake indent
Robert Swiecki [Mon, 17 Feb 2020 19:33:45 +0000 (20:33 +0100)]
make indent

4 years agofix POLLNVAL in pipeTraffic
Wiktor Garbacz [Mon, 17 Feb 2020 14:55:08 +0000 (15:55 +0100)]
fix POLLNVAL in pipeTraffic

4 years agofix infinite loop in pipeTraffic
Wiktor Garbacz [Mon, 17 Feb 2020 13:16:40 +0000 (14:16 +0100)]
fix infinite loop in pipeTraffic

4 years agosubproc: debug log when hotting SIHQUIT (Ctrl+\) #2 - better check
Robert Swiecki [Mon, 17 Feb 2020 13:13:17 +0000 (14:13 +0100)]
subproc: debug log when hotting SIHQUIT (Ctrl+\) #2 - better check

4 years agosubproc: debug log when hotting SIHQUIT (Ctrl+\)
Robert Swiecki [Mon, 17 Feb 2020 13:11:58 +0000 (14:11 +0100)]
subproc: debug log when hotting SIHQUIT (Ctrl+\)

4 years agosubproc: verify that a pid in a pid map doesn't exist before inserting
Robert Swiecki [Mon, 17 Feb 2020 13:07:25 +0000 (14:07 +0100)]
subproc: verify that a pid in a pid map doesn't exist before inserting

4 years agonsjail/pid/subproc: a). keep childrens' PIDs in a map indexed by pid b). correctly...
Robert Swiecki [Sun, 16 Feb 2020 21:34:19 +0000 (22:34 +0100)]
nsjail/pid/subproc: a). keep childrens' PIDs in a map indexed by pid b). correctly fetch remote IPv6 address text

4 years agoMerge pull request #130 from happyCoder92/proxy
robertswiecki [Fri, 14 Feb 2020 16:08:41 +0000 (17:08 +0100)]
Merge pull request #130 from happyCoder92/proxy

pipe socket traffic in and out of sandboxee

4 years agoMerge pull request #128 from disconnect3d/patch-2
robertswiecki [Fri, 14 Feb 2020 16:08:07 +0000 (17:08 +0100)]
Merge pull request #128 from disconnect3d/patch-2

Update Dockerfile to use ubuntu:18.04 image

4 years agopipe socket traffic in and out of sandboxee
Wiktor Garbacz [Thu, 13 Feb 2020 11:24:28 +0000 (12:24 +0100)]
pipe socket traffic in and out of sandboxee

4 years agoMakefile: fix kafel submodule init for parallel build
Wiktor Garbacz [Mon, 27 Jan 2020 09:32:10 +0000 (10:32 +0100)]
Makefile: fix kafel submodule init for parallel build

4 years agosubproc: recognize CLONE_PIDFD
Robert Swiecki [Tue, 10 Dec 2019 10:09:14 +0000 (11:09 +0100)]
subproc: recognize CLONE_PIDFD

4 years agoMerge pull request #129 from disconnect3d/patch-3
robertswiecki [Sat, 7 Dec 2019 16:24:29 +0000 (17:24 +0100)]
Merge pull request #129 from disconnect3d/patch-3

Fix default rlimit_stack value

4 years agoFix default rlimit_stack value
Disconnect3d [Sat, 7 Dec 2019 16:05:45 +0000 (17:05 +0100)]
Fix default rlimit_stack value

The default `rlimit_stack` value was set to 1048576. However, this value is in MiB and so is later multiplied by 1024*1024 in https://github.com/google/nsjail/blob/b3d544d155f5d1543dce1bd3e5327ef41583815a/config.cc#L161-L162 and it ends up as a limit of 1 TB for the stack size.

This PR changes it to 8 MB which is a more sane default or, at least I took it from my virtual machine's ulimits:
```
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31175
max locked memory       (kbytes, -l) 16384
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31175
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
```

4 years agoUpdate Dockerfile to use ubuntu:18.04 image
Disconnect3d [Sat, 7 Dec 2019 13:24:32 +0000 (14:24 +0100)]
Update Dockerfile to use ubuntu:18.04 image

4 years agoallow setgroups when using exclusively newgid
Wiktor Garbacz [Fri, 1 Nov 2019 12:40:25 +0000 (13:40 +0100)]
allow setgroups when using exclusively newgid

4 years agoconfigs/: indent
Robert Swiecki [Tue, 29 Oct 2019 00:40:52 +0000 (01:40 +0100)]
configs/: indent

5 years agoconfigs/znc: remove a problematic quote
Robert Swiecki [Thu, 3 Oct 2019 22:35:36 +0000 (00:35 +0200)]
configs/znc: remove a problematic quote