71 Commits

Author SHA1 Message Date
Robert Swiecki
408d49ed48 mnt: consolidate EROFS fallbacks into errno-preserving helpers 2026-04-02 15:00:33 +02:00
robertswiecki
f1a9dc67b1 Merge pull request #260 from nemmyam/fix-erofs-mkdir-readonly-mounts
mnt: handle EROFS from mkdir/open on read-only mounts
2026-04-02 14:56:14 +02:00
Robert Swiecki
024c6fec42 mnt: put missing MS_ ST_ definitions in one place 2026-03-25 08:27:06 +01:00
Nemmy
5c5ddf7def mnt: handle EROFS from mkdir/open on read-only mounts
mkdir() can return EROFS instead of EEXIST for existing entries on
read-only mounts (e.g. NFS). Fall back to stat()/fstatat() on EROFS
and proceed if the entry exists with the expected type.
2026-03-20 13:43:23 -03:00
Robert Swiecki
e1d349aa6c nsjail: move common legacy/newapi code to mnt.cc|.h 2026-02-02 11:22:34 +01:00
Robert Swiecki
d8ea726682 Implement support for the new Linux mount API and refactor mount logic into dedicated files. Added the --experimental_mnt flag to allow forcing legacy or new mount behaviors. 2026-01-31 16:05:58 +01:00
Luka Hietala
00ff54761c cast MS_RDONLY to uintptr_t 2026-01-05 21:30:43 +02:00
Robert Swiecki
23aff11480 mnt: don't remount R/O points, which failed to mount in the first place 2025-11-26 09:18:23 +01:00
Robert Swiecki
57a6e17e50 nsjail.h/all - reduce size of nsjail_t and stop duplicating nsjail::NsJailConfig fields. Now nsjail::NsJailConfig is the source of truth for jails' configuraiton 2025-11-24 17:12:43 +01:00
Robert Swiecki
06350410ac nsjail.h+all: move nsjail::NsJailConfig into struct nsj_t to avoid parameter duplicaiton. Now nsjail::NsJailConfig is the source of configuration truth for jails 2025-11-24 07:21:35 +01:00
Robert Swiecki
ae03e11835 clang-format-21 + make indent 2025-11-23 00:03:41 +01:00
Robert Swiecki
df58b2ac1a mnt: add MS_NOSYMFOLLOW/ST_NOSYMFOLLOW support 2025-11-22 21:49:21 +01:00
Robert Swiecki
05eb7f89e3 mnt: MS_NOUSER is 1<<31, and cannot be caster to uint64_t w/o change of bit-value 2025-09-23 21:06:50 +02:00
Robert Swiecki
cf6f4f6dfa make indent 2025-01-07 09:42:14 +01:00
Robert Swiecki
0982bc9779 logging: no need to use '%s' with QC() 2024-06-26 21:24:02 +02:00
Robert Swiecki
98ec95ca85 Use nullptr where appropriate 2023-10-20 18:01:36 +02:00
Robert Swiecki
ca29f292b6 mnt: reformat messages for PLOG 2023-10-03 23:16:55 +02:00
Robert Swiecki
439606be70 Makefile/indent: add AlwaysBreakBeforeMultilineStrings:false 2023-09-19 20:31:57 +02:00
Robert Swiecki
2e27593482 make indent: clang-format-18 2023-09-19 08:45:42 +02:00
Wiktor Garbacz
f920c9194e Mount read-only directly if mounting rw fails
For new mounts if MNT_LOCK_READONLY is locked on the visible mnt
mount_too_revealing will fail and the whole mount will fail.
Those mounts need to be created with the readonly flag set.
2023-05-16 14:07:22 +02:00
Robert Swiecki
285ea15811 subproc/mount: use better types for flags, u64 for clone, unsigned long for mount 2022-10-24 13:12:20 +02:00
Robert Swiecki
c63e5b39e8 use QC() across the code 2022-08-10 15:23:53 +02:00
Robert Swiecki
f628f74b00 mnt: quote paths in log messages 2022-08-09 12:06:42 +02:00
Robert Swiecki
4128a7cbd9 mnt: remove unnecessary quote in a debug message 2022-08-09 11:32:49 +02:00
Robert Swiecki
999d4631f3 mnt: better error messages with mandatory mount points 2022-02-10 09:51:13 +01:00
Robert Swiecki
246d4721b1 macros: make NS_VALSTR_STRUCT accept unsigned/64-bit vals 2021-09-30 16:44:48 +02:00
Wiktor Garbacz
95e112cf41 Fix formatting 2021-08-03 17:46:08 +02:00
Eli Zrihen
b83d6f7421 Renaming use_switchroot option with no_pivotroot 2021-07-20 15:45:58 +03:00
Eli Zrihen
b6576fcde7 Adding a warning when switchroot is used 2021-07-20 10:20:23 +03:00
Eli Zrihen
99507c5920 Merge branch '_test_switchroot_alternative' 2021-07-13 15:40:21 +03:00
Eli Zrihen
15205a23f9 No Yoda 2021-07-08 21:47:13 +03:00
Eli Zrihen
be302c4cc9 Comment fix 2021-06-23 14:51:34 +03:00
Eli Zrihen
dab1713ac9 Added use_switchroot option 2021-06-17 14:57:01 +03:00
Robert Swiecki
d1f332b911 Enable support for clone3() and for CLONE_NEWTIME 2021-05-18 14:38:01 +02:00
Robert Swiecki
f7554882fe make indent 2020-07-09 17:29:02 +02:00
Christian Blichmann
910fb5498c 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>
2020-07-07 14:07:22 +02:00
Robert Swiecki
41305fdc4d mnt: shorter description of mount points 2019-08-31 22:08:02 +02:00
Robert Swiecki
e2c5c59bd3 standardize on envar vs envvar 2019-08-28 22:18:58 +02:00
Robert Swiecki
d9efc0b3a7 mnt: use setcwd unconditionally with and w/o clone_newns 2019-08-25 11:16:12 +02:00
Robert Swiecki
a2dacef5d7 allow to use nsjail w/o namespaces 2019-03-29 21:38:14 +01:00
Robert Swiecki
331f2bcd74 mnt: try /run/user/<uid>/nsjail as a root mount dir first 2019-03-28 23:25:15 +01:00
Robert Swiecki
9fe225dbe2 mnt: use /run/usr/<uid> first when mounting dirs 2019-03-18 16:37:04 +01:00
Robert Swiecki
061e32839f use util::syscall whenever possible 2019-01-21 22:37:30 +01:00
Robert Swiecki
6217d27d61 mnt: better description for mounts 2018-11-22 08:44:25 +01:00
Robert Swiecki
122f251efd mnt: simplify debug message #2 2018-10-30 01:44:08 +01:00
Robert Swiecki
28c80845ea mnt: simplify debug message 2018-10-30 01:33:09 +01:00
Robert Swiecki
cfdf71043e mnt: simplify printing mnt points 2018-10-28 21:07:46 +01:00
Robert Swiecki
6af9565a1d mnt: function rename 2018-07-29 00:30:08 +02:00
Wiktor Garbacz
ba14675185 mnt: added nosuid/nodev/noexec flags to config
Closes #70
2018-07-27 11:29:15 +02:00
Wiktor Garbacz
c23d02e5f3 mnt: remount all filesystems
Explicitly specifying RW "/" mount in config did not yield desired
result.
The reason was a default RO "/" tmpfs is prepended to mountpoint
list. All filesystems are initially mounted RW to be able to create
directories for mountpoints. Read only filesystems were remounted
during a 2nd pass, effectively overriding RW flag of fs mounted
over them.

Fixes #88
2018-07-24 16:30:31 +02:00