Commit Graph

42226 Commits

Author SHA1 Message Date
Daan De Meyer
f5abe8f957 Merge pull request #26784 from DaanDeMeyer/chase-fix
Allow creating files and directories with chase_symlinks_open() and further improvements
2023-03-15 15:51:47 +01:00
Daan De Meyer
39eb3ffaaa fs-util: Drop unlink_noerrno() 2023-03-15 13:27:20 +01:00
Daan De Meyer
a45332500d Merge pull request #26820 from DaanDeMeyer/dir-fd-is-root
fd-util: Add dir_fd_is_root()
2023-03-15 12:48:14 +01:00
Daan De Meyer
ea8282b6fc chase-symlinks: Add more assertions
Let's turn some runtime errors into assertions and add a few new
assertions.
2023-03-15 12:38:14 +01:00
Daan De Meyer
47f0e1b5e0 chase-symlinks: Rework open() functions and some chase flags
Currently, when CHASE_PARENT is specified, we chase the parent directory
of the symlink itself. Let's change this and chase the parent directory
of the symlink target so that trying to open the actual file later with
O_NOFOLLOW doesn't fail with ELOOP.

To get the current behavior, callers can add CHASE_NOFOLLOW to chase
the parent directory of the symlink itself.

Currently, when CHASE_MKDIR_0755 is specified, we create all components
of the path as directories. Instead, let's change the flag to only create
parent directories and leave the final component of the PATH untouched.
Also, allow CHASE_NONEXISTENT with CHASE_MKDIR_0755 now that it doesn't
create all components anymore.

Finally, rework chase_symlinks_and_open() and chase_symlinkat_at_and_open()
to always chase the parent directory and use xopenat() to open the final
component of the path. This allows us to pass O_CREAT to create the file or
directory (O_DIRECTORY) if it is missing. If CHASE_PARENT is configured, we
just reopen the parent directory that we chased.
2023-03-15 12:38:11 +01:00
Daan De Meyer
af423b4ba9 fd-util: Add dir_fd_is_root() 2023-03-15 11:51:08 +01:00
Daan De Meyer
9bf8441503 mountpoint-util: Add path_get_mnt_id_at() 2023-03-15 11:51:06 +01:00
Luca Boccassi
62562ef5b4 Merge pull request #26825 from keszybz/log-message-fix
Log message fix
2023-03-15 10:49:35 +00:00
Zbigniew Jędrzejewski-Szmek
add74820b7 core: fix "(null)" in output
We want an empty string, not NULL. I made some brainfart here.
Fixup for 1980a25dc0.
2023-03-15 09:33:17 +01:00
Zbigniew Jędrzejewski-Szmek
24aaf6c66c core: reduce scope of variable 2023-03-15 09:33:17 +01:00
Lennart Poettering
32e7970304 Merge pull request #26800 from t-8ch/memfd_create
memfd: add support for exec flags
2023-03-15 09:28:09 +01:00
Lennart Poettering
264c267686 Merge pull request #26794 from bluca/log_extra_fields
core: append LogExtraFields= values to log_unit* messages
2023-03-15 09:27:47 +01:00
Luca Boccassi
d4b6ec980d core: make the memory pressure cgroup path writable when ProtectControlGroups=yes
The interface requires services to write to the cgroup file to activate notifications,
but with ProtectControlGroups=yes we make it read-only. Add a writable bind mount.

Follow-up for 6bb0084204
2023-03-15 09:23:17 +01:00
Thomas Weißschuh
c29715a8f7 treewide: memfd_create: use exec flags
Use the flags MEMFD_EXEC or MEMFD_NOEXEC_SEAL as applicable.

These warnings instruct the kernel wether the memfd is executable or
not.

Without specifying those flags the kernel will emit the following
warning since version 6.3,
commit 105ff5339f49 ("mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC"):

    kernel: memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1 'systemd'
2023-03-15 01:18:59 +00:00
Thomas Weißschuh
ad62530ebb memfd-util: add wrapper for memfd_create
The wrapper removes the flags MFD_EXEC and MFD_NOEXEC_SEAL when running
on kernels not understanding those flags.
2023-03-15 01:18:59 +00:00
Thomas Weißschuh
8cb0a001d8 missing: add memfd exec flags 2023-03-15 01:18:59 +00:00
Jan Janssen
ccde62954c stub: Remove overlapping PE section warning
Now that we always create PE images with a non-zero image base we cannot
run into this issue anymore. Any tool that still uses the old hard-coded
section offsets will end up creating bad images with sections below the
image base. objcopy will warn about this and any PE loader will simply
refuse to load such an image. Meanwhile updated tools do not use
hard-coded offsets anymore.
2023-03-15 00:24:17 +00:00
Luca Boccassi
544471bf83 Merge pull request #26815 from keszybz/cgls-no-xattrs-by-default
Do not show xattrs and cgroup ids in cgls by default
2023-03-15 00:24:02 +00:00
Luca Boccassi
a247e95c28 Merge pull request #26808 from keszybz/no-controllers-followup
Docs and dump output follow-up for the case of delegation with no controllers
2023-03-15 00:23:05 +00:00
Daan De Meyer
85c494f7e7 mkfs-util: Redirect mksquashfs output to /dev/null
The -quiet option for mksquashfs was added somewhat recently so to
support older versions, let's redirect stdout of mksquashfs to
/dev/null instead.
2023-03-15 00:21:36 +00:00
Luca Boccassi
b2f84688d9 Merge pull request #26683 from YHNdnzj/systemctl-shutdown-when
systemctl: add --when for scheduled poweroff/halt/reboot/kexec support
2023-03-15 00:19:50 +00:00
OMOJOLA JOSHUA
59228d0dbf src: changed instances of sd_bus_call_method() to bus_call_method() (#26819)
* src: changed instances of sd_bus_call_method() to bus_call_method()
2023-03-15 00:12:57 +00:00
Lennart Poettering
a3c3386eac dissect: make all paths we operation on absolute
Let's avoid any ambiguities around paths, and make them absolute when
accepting them, like we do in most our tools now. This makes us
independent of the current working directory and allows us to change it
without issues or pass around the paths elsewhere if need be.
2023-03-14 23:04:18 +01:00
Lennart Poettering
f0a96d195a core: fix mount flag help output, it only takes one argument 2023-03-14 23:03:32 +01:00
Lennart Poettering
12c0f4ff52 dissect: mark UID/GIDs that are surprising in DDIs with colors
DDIs should not contain files owned by dynamic users or the nobody
users. Let's subtly highlight those entries in mtree output.
2023-03-14 23:03:16 +01:00