History log of /unit/src/nxt_isolation.c (Results 1 – 18 of 18)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2379:927b793559d4 16-Mar-2023 Andrew Clayton

Default PR_SET_NO_NEW_PRIVS to off.

This prctl(2) option was enabled in commit 0277d8f1 ("Isolation: Fix the
enablement of PR_SET_NO_NEW_PRIVS.") and this was being set by default.

This prctl(2) wh

Default PR_SET_NO_NEW_PRIVS to off.

This prctl(2) option was enabled in commit 0277d8f1 ("Isolation: Fix the
enablement of PR_SET_NO_NEW_PRIVS.") and this was being set by default.

This prctl(2) when enabled renders (amongst other things) the set-UID
and set-GID bits on executables ineffective after an execve(2).

This causes an issue for applications that want to execute the
sendmail(8) binary, this includes the PHP mail() function, which is
usually set-GID.

After some internal discussion it was decided to disable this option by
default.

Closes: <https://github.com/nginx/unit/issues/852>
Fixes: 0277d8f1 ("Isolation: Fix the enablement of PR_SET_NO_NEW_PRIVS.")
Fixes: e2b53e16 ("Added "rootfs" feature.")
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


Revision tags: 1.29.1-1, 1.29.1
# 2331:48798e038044 22-Feb-2023 Andrew Clayton

Isolation: rootfs: Set the sticky bit on the tmp directory.

When using the 'rootfs' isolation option, by default a tmpfs filesystem
is mounted on tmp/. Currently this is mounted with a mode of 0777,

Isolation: rootfs: Set the sticky bit on the tmp directory.

When using the 'rootfs' isolation option, by default a tmpfs filesystem
is mounted on tmp/. Currently this is mounted with a mode of 0777, i.e

drwxrwxrwx. 3 root root 60 Feb 22 11:56 tmp

however this should really have the sticky bit[0] set (as is per-normal for
such directories) to prevent users from having free reign on the files
contained within.

What we really want is it mounted with a mode of 01777, i.e

drwxrwxrwt. 3 root root 60 Feb 22 11:57 tmp

[0]: To quote inode(7)

"The sticky bit (S_ISVTX) on a directory means that a file in that
directory can be renamed or deleted only by the owner of the file, by
the owner of the directory, and by a privileged process."

Reviewed-by: Liam Crilly <liam@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


# 2321:b8d29a14676d 18-Nov-2022 Andrew Clayton

Isolation: Rename NXT_HAVE_CLONE -> NXT_HAVE_LINUX_NS.

Due to the need to replace our use of clone/__NR_clone on Linux with
fork(2)/unshare(2) for enabling Linux namespaces(7) to keep the
pthreads(7

Isolation: Rename NXT_HAVE_CLONE -> NXT_HAVE_LINUX_NS.

Due to the need to replace our use of clone/__NR_clone on Linux with
fork(2)/unshare(2) for enabling Linux namespaces(7) to keep the
pthreads(7) API working. Let's rename NXT_HAVE_CLONE to
NXT_HAVE_LINUX_NS, i.e name it after the feature, not how it's
implemented, then in future if we change how we do namespaces again we
don't have to rename this.

Reviewed-by: Alejandro Colomar <alx@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


Revision tags: 1.29.0-1, 1.29.0
# 2260:3005b3de99a5 24-Oct-2022 Andrew Clayton

Isolation: wired up per-application cgroup support internally.

This commit hooks into the cgroup infrastructure added in the previous
commit to create per-application cgroups.

It does this by addin

Isolation: wired up per-application cgroup support internally.

This commit hooks into the cgroup infrastructure added in the previous
commit to create per-application cgroups.

It does this by adding each "prototype process" into its own cgroup,
then each child process inherits its parents cgroup.

If we fail to create a cgroup we simply fail the process. This behaviour
may get enhanced in the future.

This won't actually do anything yet. Subsequent commits will hook this
up to the build and config systems.

Reviewed-by: Alejandro Colomar <alx@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


Revision tags: 1.28.0-1, 1.28.0
# 2170:8eee6cdafb58 02-Aug-2022 Alejandro Colomar

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:

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.

show more ...


# 2169:b8afbff114fc 18-Jun-2022 Alejandro Colomar

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

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.

show more ...


# 2153:37bccff06c9f 18-Jun-2022 Alejandro Colomar

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.


Revision tags: 1.27.0-1, 1.27.0, 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0, 1.25.0-1, 1.25.0
# 1927:ac8d11e34427 03-Aug-2021 Max Romanov

Fixed dead assignments.

Found by Clang Static Analyzer.


Revision tags: 1.24.0-1, 1.24.0, 1.23.0-1, 1.23.0, 1.22.0-1, 1.22.0
# 1744:5e6c2b8fb3fe 14-Dec-2020 Tiago Natel de Moura

Isolation: fixed unmounting when mnt namespace is in place.

The code had a wrong assumption that "mount namespaces" automatically
unmounts process mounts when exits but this happens only with
unpriv

Isolation: fixed unmounting when mnt namespace is in place.

The code had a wrong assumption that "mount namespaces" automatically
unmounts process mounts when exits but this happens only with
unprivileged mounts.

show more ...


Revision tags: 1.21.0-1, 1.21.0
# 1708:4463c1fc26fd 16-Nov-2020 Tiago Natel de Moura

Isolation: added option to disable "procfs" mount.

Now users can disable the default procfs mount point
in the rootfs.

{
"isolation": {
"automount": {
"procfs": false

Isolation: added option to disable "procfs" mount.

Now users can disable the default procfs mount point
in the rootfs.

{
"isolation": {
"automount": {
"procfs": false
}
}
}

show more ...


# 1704:6a003e0f3a6e 13-Nov-2020 Tiago Natel de Moura

Isolation: added option to disable tmpfs mount.

Now users can disable the default tmpfs mount point
in the rootfs.

{
"isolation": {
"automount": {
"tmpfs": false

Isolation: added option to disable tmpfs mount.

Now users can disable the default tmpfs mount point
in the rootfs.

{
"isolation": {
"automount": {
"tmpfs": false
}
}
}

show more ...


# 1673:883f2f79c2f6 29-Oct-2020 Tiago Natel de Moura

Isolation: mounting of procfs by default when using "rootfs".


# 1671:04de10f67b33 29-Oct-2020 Tiago Natel de Moura

Isolation: correctly unmount non-dependent paths first.

When mount points reside within other mount points, this
patch sorts them by path length and then unmounts then
in an order reverse to their m

Isolation: correctly unmount non-dependent paths first.

When mount points reside within other mount points, this
patch sorts them by path length and then unmounts then
in an order reverse to their mounting. This results in
independent paths being unmounted first.

This fixes an issue in buildbots where dependent paths failed
to unmount, leading to the build script removing system-wide
language libraries.

show more ...


Revision tags: 1.20.0-1, 1.20.0
# 1602:5f7638bf724e 18-Sep-2020 Artem Konev

Updated racially charged language in messages and comments.


# 1595:d1884e46cf71 16-Sep-2020 Tiago Natel de Moura

Isolation: remove redundant macro.


# 1585:e941d77852d1 25-Aug-2020 Tiago Natel de Moura

Isolation: added "automount" option.

Now it's possible to disable default bind mounts of
languages by setting:

{
"isolation": {
"automount": {
"language_deps": fal

Isolation: added "automount" option.

Now it's possible to disable default bind mounts of
languages by setting:

{
"isolation": {
"automount": {
"language_deps": false
}
}
}

In this case, the user is responsible to provide a "rootfs"
containing the language libraries and required files for
the application.

show more ...


# 1580:f1aefdf995d4 20-Aug-2020 Tiago Natel de Moura

Isolation: mount tmpfs by default.


# 1579:c80e692dc644 20-Aug-2020 Tiago Natel de Moura

Moved isolation related code to "nxt_isolation.c".