Commit graph

7 commits

Author SHA1 Message Date
Alejandro Colomar
418bc208d0 Rejecting non-Linux pivot_root(2).
Some non-Linux systems implement pivot_root(2), even if they
don't document that.  An example is MacOS:

$ grepc pivot_root / 2>/dev/null
.../sys/sysproto.h:3012:
int pivot_root(struct proc *, struct pivot_root_args *, int *);

Since the prototype of the syscall differs from that of Linux, we
can't use that syscall.  Let's make sure the test only detects
pivot_root(2) under Linux.  Also, rename the feature macro to make
clear that it's only about Linux's pivot_root(2).

This closes #737 issue on GitHub.
2022-08-02 19:50:10 +02:00
Alejandro Colomar
2c0888f69c Including <mntent.h> iff it exists.
With NXT_HAVE_PIVOT_ROOT, we had issues in MacOS.  Headers should
normally be included unconditionally, except of course if they
don't exist.

This fixes part of the #737 issue on GitHub.
2022-08-02 13:58:01 +02:00
Alejandro Colomar
5015b05fc4 Replaced Linux syscall macros by libc macros.
User-space programs should use the SYS_*form, as documented in
syscall(2).  That also adds compatibility to non-Linux systems.
2022-07-18 19:09:30 +02:00
Tiago Natel de Moura
f8ba5d6c00 Isolation: fixed build when features aren't detected. 2020-06-23 12:11:27 +01:00
Tiago Natel de Moura
e2b53e16c6 Added "rootfs" feature. 2020-05-28 14:57:41 +01:00
Tiago Natel
411daeaa53 Isolation: allowed the use of credentials with unpriv userns.
The setuid/setgid syscalls requires root capabilities but if the kernel
supports unprivileged user namespace then the child process has the full
set of capabilities in the new namespace, then we can allow setting "user"
and "group" in such cases (this is a common security use case).

Tests were added to ensure user gets meaningful error messages for
uid/gid mapping misconfigurations.
2019-12-06 16:52:50 +00:00
Tiago de Bem Natel de Moura
c554941b4f Initial applications isolation support using Linux namespaces. 2019-09-19 15:25:23 +03:00