Commit Graph
63175 Commits
Author SHA1 Message Date
Luca Boccassi 1be50af42e Merge pull request #26804 from fbuihuu/fixes-for-test-58-repart
Fixes for test 58 repart
2023-03-15 10:56:07 +00: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
Franck Bui 693c3e1a59 test: assume run-unit-tests.py and unit tests are installed in the same directory
This avoids hard coding the path of the directory where the unit tests are
installed.
2023-03-15 09:19:33 +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 c1c4ecd356 update TODO 2023-03-14 23:06:32 +01: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
Zbigniew Jędrzejewski-Szmek ec38ec55ee cgls: add -x and -c options
-x is short for --xattrs=yes and
-c is short for --cgroup-id=yes.
2023-03-14 18:03:32 +01:00
Zbigniew Jędrzejewski-Szmek 5346bb499f cgls: stop showing cgroup ids and xattrs by default
Those are rather specialized bits of information, useful mostly for debugging.
I use cgls quite often but never had the need to use either of those…
But they take up a significant amount of screen real estate, esp. when
executed as root:

-.slice
├─user.slice (#1683)
│ → user.invocation_id: 74b0bd1258c5485eb969016384e0d06a
│ → trusted.invocation_id: 74b0bd1258c5485eb969016384e0d06a
│ └─user-1000.slice (#6488)
│   → user.invocation_id: b0261a14fe74490d9a9d5266c52cceb6
│   → trusted.invocation_id: b0261a14fe74490d9a9d5266c52cceb6
│   ├─user@1000.service … (#6590)
│   │ → user.invocation_id: 9e1fb54ad07940d8b92c33c81d169f11
│   │ → user.delegate: 1
│   │ → trusted.invocation_id: 9e1fb54ad07940d8b92c33c81d169f11
│   │ → trusted.delegate: 1
│   │ ├─session.slice (#6874)
...

Let's not show them by default, so we can show more cgroups.

(Also, on a terminal, we already highlight delegate units via underlining and
an ellipsis, so 'user.delegate:1' is redundant.)
2023-03-14 18:02:42 +01:00
Zbigniew Jędrzejewski-Szmek 882c514d50 cgtop: drop counterproductive bitfields
The variable after the bitfields has 8 byte alignment, so we weren't saving any
memory, but the code to serve the bitfields was more complicated.
2023-03-14 18:00:08 +01:00
Zbigniew Jędrzejewski-Szmek 726afd5d9a cgtop: split out the main loop into a separate function
This way the initial setup is nicely separated from the main loop logic.
2023-03-14 18:00:08 +01:00
Luca Boccassi 1092e82bb7 core: append LogExtraFields= values to log_unit* messages
This ensure messages from PID1 regarding a unit also contain those
fields. For example, portable services have PORTABLE=<image> as
extra fields, which is useful to identify which version of a portable
image produced a log message like an error or an oomd kill.
2023-03-14 16:38:23 +00:00
Luca Boccassi 2461943b84 log: add iov helpers for log_context 2023-03-14 16:37:03 +00:00
Zbigniew Jędrzejewski-Szmek af2b151be9 manager: in dump, show no controllers as "(none)"
https://github.com/systemd/systemd/commit/7b3693e4e4c9cae50fca65136278a62fae11327e#r103711181
2023-03-14 12:35:33 +01:00
Zbigniew Jędrzejewski-Szmek 449172f943 man: document "Delegate=" a bit more
This case is a bit surprising, even if logical if one understands how the
parser works. Let's be more explicit.

Follow-up for 7b3693e4e4.
2023-03-14 12:27:51 +01:00
Mike Yuan 165655cb1d test-time-util: add test cases to invalidate "show" and "cancel"
Ensure that systemctl reboot --when=show and --when=cancel will not result in ambiguities
2023-03-14 19:21:11 +08:00
Mike Yuan 1433e1f998 systemctl: add option --when for scheduled shutdown
Pass an empty string or "cancel" will cancel the action.
Pass "show" will show the scheduled actions.

Replaces #17258
2023-03-14 19:21:11 +08:00
Mike Yuan 92b00e8678 systemctl: logind: make logind_schedule_shutdown accept action as param 2023-03-14 19:21:11 +08:00
Mike Yuan 9071eea01b systemctl: logind: add missing asserts 2023-03-14 19:21:06 +08:00
Daan De Meyer 3a36d19938 Merge pull request #26662 from yuwata/test-execute-network-namespace-path
test-execute: add tests for NetworkNamespacePath=
2023-03-14 11:16:15 +01:00
Franck Bui 1b971e0117 tests: don't use absolute paths when installing binaries in TEST-58-REPART
Let image_install figures the binary paths out itself as not all distributions
ship the mkfs.* tools in the same location. For example openSUSE ships
mksquashfs in /usr/bin/.
2023-03-14 10:11:27 +01:00
Franck Bui 8fd25ba343 tests: fix inverted condition in testsuite-58.sh 2023-03-14 10:07:06 +01:00
EinBaum a5c0ad9a9a hwdb: 60-keyboard.hwdb: Fix modalias for Thinkpad X200 Tablet (#26795)
This fixes the tablet buttons on the Thinkpad X200 Tablet.
My Lenovo ThinkPad X200 Tablet is called "ThinkPadX200T" instead of "ThinkPadX200Tablet":
```
$ cat /sys/devices/virtual/dmi/id/modalias 
dmi:bvnLENOVO:bvr7WET71WW(3.21):bd11/29/2012:br3.33:efr1.6:svnLENOVO:pn7453WVK:pvrThinkPadX200T:rvnLENOVO:rn7453WVK:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:sku:
```
This patch makes both strings work correctly to support the extra tablet keys.
2023-03-14 17:41:21 +09:00
Lennart Poettering 888519889c test-process-util: port to detach_mount_namespace() 2023-03-14 17:39:28 +09:00
Yu Watanabe 4b2e1a27cc Merge pull request #26767 from yuwata/udev-rule-rework-logging
udev-rule: rework logging about udev rules
2023-03-14 13:14:49 +09:00
A S Alam b47b1708c9 po: Translated using Weblate (Punjabi)
Currently translated at 6.2% (12 of 193 strings)

Co-authored-by: A S Alam <amanpreet.alam@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pa/
Translation: systemd/main
2023-03-14 13:04:38 +09:00
Lennart Poettering b6904196a6 namespace-util: set mounts back to MS_SHARED in detach_mount_namespace()
For nspawn and services we first turn off two-way propagation of mounts
from host to sandbox via MS_SLAVE, and then set MS_SHARED again, so that
we create a new mount prop peer group again, and that we provide
behaviour similar to what we provide on the host further down the tree.

Let's do the same in detach_mount_namespace(), which we use for the
temporary mounts in the implementation of --image= in various tools.

This doesn't fix any immediate issue, but ensures we expose somewhat
systematic behaviour: whenever we detach mount namespaces we always set
things back to MS_SLAVE in the child.
2023-03-14 13:02:51 +09:00
Lennart Poettering 874cdcbcf5 core: rename "mount_flags" → "mount_propagation_flag" internally where appropriate
ExecContext has a field that controls the mount propagation flag of the
mounts in the resulting namespace. This is exposed as "MountFlags="
which is super confusing, as it suggests one could control more than
propagation, and that it was actually a flags field. It's an enum
though only, and nothing else.

We might want to rename this externally one day, but given the compat
kludges this requires and the fact this is somewhat nichey it might not
be worth it. But internally let's rename it, as it makes things much
easier to grok, in particular as part of the codebase already exposed
the concept as mount_propagation_flag.

No actual code flow changes, just some renaming.
2023-03-14 13:00:27 +09:00
Lennart Poettering eacfbd89c3 namespace: use ERRNO_IS_PRIVILEGE()/ERRNO_IS_NOT_SUPPORTED() where appropriate 2023-03-14 12:57:46 +09:00
Mike Yuan 880adc6edd test: testsuite-26: remove duplicate source 2023-03-14 12:32:16 +09:00
Lennart Poettering 97cff6cd5f userbd: manager doesn't actually use varlink, only workers do 2023-03-13 22:43:25 +00:00
Yu Watanabe a6ca54ed94 man: add missing tags in udevadm(8) 2023-03-13 19:29:58 +00:00
Topi Miettinen 7a114ed4b3 execute: use prctl(PR_SET_MDWE) for MemoryDenyWriteExecute=yes
On some ARM platforms, the dynamic linker could use PROT_BTI memory protection
flag with `mprotect(..., PROT_BTI | PROT_EXEC)` to enable additional memory
protection for executable pages. But `MemoryDenyWriteExecute=yes` blocks this
with seccomp filter denying all `mprotect(..., x | PROT_EXEC)`.

Newly preferred method is to use prctl(PR_SET_MDWE) on supported kernels. Then
in-kernel implementation can allow PROT_BTI as necessary, without weakening
MDWE. In-kernel version may also be extended to more sophisticated protections
in the future.
2023-03-13 18:44:36 +00:00
Yu Watanabe cbcdc582f3 Merge pull request #26749 from DaanDeMeyer/more-cleanups
execute: Some modernizations
2023-03-14 03:34:37 +09:00
Franck Bui 07e0ffc823 conf: replace config_parse_many_nulstr() with config_parse_config_file()
All daemons use a similar scheme to read their main config files and theirs
drop-ins. The main config files are always stored in /etc/systemd directory and
it's easy enough to construct the name of the drop-in directories based on the
name of the main config file.

Hence the new helper does that internally, which allows to reduce and simplify
the args passed previously to config_parse_many_nulstr().

Besides the overall code simplification it results:

  16 files changed, 87 insertions(+), 159 deletions(-)

it allows to identify clearly the locations in the code where configuration
files are parsed.
2023-03-14 03:31:21 +09:00
Yu Watanabe 4fed028ae4 Merge pull request #26781 from mrc0mmand/tests-again
test: add a couple of tests for systemd-path
2023-03-14 03:27:45 +09:00