1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-28 07:21:32 +03:00
Commit Graph

50546 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
839eb4a458
Merge pull request #13496 from wat-ze-hex/custom-bpf-progs-parameterized-3
bpf: extend bpf cgroup program support
2021-04-12 14:31:42 +02:00
gaoyi
45f5efdea7 man: fix discriptions for --exec-delay
There are two ambiguity in the original description:
1. It will delay all RUN instructions, include builtin.
2. It will delay before running RUN, not each of RUN{program} instructions.
2021-04-12 13:03:26 +02:00
Yu Watanabe
9bafb8d504 sd-dhcp-client: constify argument in sd_dhcp_lease_get_xxx() 2021-04-12 09:55:26 +02:00
Yu Watanabe
37da8bca92 networkctl: drop unused variables 2021-04-12 09:09:57 +02:00
Luca Boccassi
0efcbecd8b test-repart: use cryptsetup and losetup autoclose
The test occasionally fails as the umount is not yet completed when
cryptsetup close is invoked.
Both cryptsetup and losetup have supported deferred cleanup for some
time now, so use it instead to avoid races.

++ losetup -P --show --find /tmp/test-repart.dMOfYQ8UUF/zzz
+ LOOP=/dev/loop6
+ VOLUME=test-repart-11882
+ touch /tmp/test-repart.dMOfYQ8UUF/empty-password
+ cryptsetup open --type=luks2 --key-file=/tmp/test-repart.dMOfYQ8UUF/empty*** test-repart-11882
+ mkdir /tmp/test-repart.dMOfYQ8UUF/mount
+ mount -t ext4 /dev/mapper/test-repart-11882 /tmp/test-repart.dMOfYQ8UUF/mount
+ diff -r /tmp/test-repart.dMOfYQ8UUF/mount/def /tmp/test-repart.dMOfYQ8UUF/definitions
+ umount /tmp/test-repart.dMOfYQ8UUF/mount
+ cryptsetup close test-repart-11882
Device test-repart-11882 is still in use.
+ rm -rf /tmp/test-repart.dMOfYQ8UUF
2021-04-11 23:50:31 +09:00
Luca Boccassi
3f66ded568 scsi_id: use read_line instead of fgets
LGTM warns about it:

"Call to fgets() is potentially dangerous. Use read_line() instead."
2021-04-11 15:45:06 +01:00
Yu Watanabe
37b7a716d3
Merge pull request #19164 from mmatsuya/main
tmpfiles: use a entry in hashmap as ItemArray in read_config_file()
2021-04-11 16:46:25 +09:00
Luca Boccassi
a7b7cab66d mkosi.arch: add rsync build dependency
Program rsync found: NO

man/meson.build:187:0: ERROR: Program 'rsync' not found
2021-04-10 22:22:08 +02:00
Oleg Popov
b204bdd4cc Extend characters set for PKCS11 URI
There are tokens with dots (and other symbols) in PKCS11 URI:

pkcs11:model=Rutoken%20ECP;manufacturer=Aktiv%20Co.;serial=3xxxxxxb;token=livelace
pkcs11:model=PRO;manufacturer=Aladdin%20R.D.;serial=CC62FB25;token=val%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00;id=%33%32%31%30%33%61%36%37%36%65%32%34%35%62%32%31;type=private
2021-04-10 20:24:18 +01:00
Yu Watanabe
5c078687dc network: refuse to configure NDISC twice 2021-04-10 20:16:11 +01:00
Lennart Poettering
1065501406 resolved: add RFC 8375 "home.arpa" to list of default NTA
RFC 8375 introduced "home.arpa" as special TLD for home networks. Let's
hence add it to our default list of NTAs.
2021-04-10 20:14:57 +01:00
Lennart Poettering
a8fd92b5a3 openssl: make RSA struct const
OpenSSL 3.0 broke API there, but it doesn't hurt to add the "const",
hence add it.

Fixes: #19267
2021-04-10 20:03:06 +01:00
Yu Watanabe
080e5c2fde sd-dhcp6-client: do not use IN_SET() macro when only one target value 2021-04-10 13:24:56 +01:00
Yu Watanabe
942cf4b8d1 network: adjust log message 2021-04-10 13:24:06 +01:00
Yu Watanabe
a78f938aaf network: drop unnecessary bitfield specifier
Manager is allocated only once. It is not necessary to optimize its
size.
2021-04-10 13:23:38 +01:00
Anita Zhang
b5a80aa9d8 units: install dbus-org.freedesktop.oom1.service alias
Fixes: #18469
2021-04-10 13:06:04 +02:00
Julia Kartseva
96734772a7 fuzz: add BPFProgram= to directives 2021-04-09 20:28:47 -07:00
Julia Kartseva
9e009a145d dbus-cgroup: add BPFProgram= dbus support
- Handle BPFProgram= property in string format
"<bpf_attach_type>:<bpffs_path>", e.g. egress:/sys/fs/bpf/egress-hook.
- Add dbus getter to list foreign bpf programs attached to a cgroup.
2021-04-09 20:28:47 -07:00
Julia Kartseva
ee08909059 man: add BPFProgram= documentation 2021-04-09 20:28:47 -07:00
Julia Kartseva
b57162aafb tests: add unit file tests for BPFProgram=
- Pin trivial bpf programs to bpf filesystem, compose BPFProgram= option
string and pass it to a unit. Programs store `0` in r0 BPF register for
denying action, e.g. drop a packet.
- Load trivial BPF programs
- Test is skipped if not run under root or if can not lock enough
memory.
- For egress and ingress hooks, test BPFProgram= option along with
with IP{Egress|Ingress}FilterPath=, expected result should not depend on
which rule is executed first.
Expected results for BPF_CGROUP_INET_INGRESS:
5 packets transmitted, 0 received, 100% packet loss, time 89ms

For BPF_CGROUP_INET_SOCK_CREATE:
ping: socket: Operation not permitted
2021-04-09 20:28:47 -07:00
Julia Kartseva
0879da98dc core: add bpf-foreign to fragment parser
- Parse a string for bpf attach type
- Simplify bpffs path
- Add foreign bpf program to cgroup context
2021-04-09 20:28:47 -07:00
Julia Kartseva
506ea51b48 core: add bpf-foreign cgroup mask and harness
Add CGROUP_MASK_BPF_FOREIGN to CGROUP_MASK_BPF and standard cgroup
context harness.
2021-04-09 20:28:47 -07:00
Julia Kartseva
5f8ba20d7f core: add bpf-foreign unit helpers
- Introduce support of cgroup-bpf programs managed (i.e. compiled,
loaded to and unloaded from kernel) externally. Systemd is only
responsible for attaching programs to unit cgroup hence the name
'foreign'.

Foreign BPF programs are identified by bpf program ID and attach type.

systemd:
- Gets kernel FD of BPF program;
- Makes a unique identifier of BPF program from BPF attach type and
program ID. Same program IDs mean the same program, i.e the same
chunk of kernel memory. Even if the same program is passed multiple
times, identical (program_id, attach_type) instances are collapsed
into one;
- Attaches programs to unit cgroup.
2021-04-09 20:28:47 -07:00
Julia Kartseva
b894ef1b71 cgroup: add foreign program to cgroup context
- Store foreign bpf programs in cgroup context. A program is considered
foreign if it was loaded to a kernel by an entity external to systemd,
so systemd is responsible only for attach and detach paths.
- Support the case of pinned bpf programs: pinning to bpffs so a program
is kept loaded to the kernel even when program fd is closed by a user
application is a common way to extend program's lifetime.
- Aadd linked list node struct with attach type and bpffs path
fields.
2021-04-09 20:28:47 -07:00
Julia Kartseva
9984f4933b shared: bpf_attach_type {from,to} string
Introduce bpf_cgroup_attach_type_table with accustomed attached type
names also used in bpftool.
Add bpf_cgroup_attach_type_{from|to}_string helpers to convert from|to
string representation of pinned bpf program, e.g.
"egress:/sys/fs/bpf/egress-hook" for
/sys/fs/bpf/egress-hook path and BPF_CGROUP_INET_EGRESS attach type.
2021-04-09 20:28:47 -07:00
Julia Kartseva
f23f0ead1f shared: add bpf-program helpers
Add helpers to:
- Create new BPFProgram instance from a path in bpf
filesystem and bpf attach type;
- Pin a program to bpf fs;
- Get BPF program ID by BPF program FD.
2021-04-09 20:28:47 -07:00
Julia Kartseva
a442ccb4eb bpf-firewall: attach with BPF_F_ALLOW_MULTI if kernel supports
Reduced version of [0].
Use BPF_F_ALLOW_MULTI attach flag for bpf-firewall if kernel supports
it.

Aside from addressing security issue in [0] attaching with 'multi'
allows further attaching of cgroup egress, ingress hooks specified by
BPFProgram=.

[0] 4e42210d40
2021-04-09 20:28:47 -07:00
Lennart Poettering
e2e40e9a9e sd-device: fix error code returned by sd_device_get_sysattr_value() for non-existing attributes
lstat() returns the error in errno, not as return value. Let's propagate
this correctly.

This broke the bolt test suite, as @gicmo discovered.

Follow-up for acfc2a1d15.
2021-04-09 19:41:43 +01:00
gaoyi
5b1375035b gpt-auto-generator: don't generate systemd-cryptsetup@.service when --Dlibcryptsetup=false 2021-04-09 17:18:09 +02:00
Zbigniew Jędrzejewski-Szmek
22344fcfb9
Merge pull request #19243 from bluca/lgtm
Fix various issues reported by LGTM
2021-04-09 13:12:41 +02:00
Aakash Singh
d6bf675f0b hwdb: 60-keyboard:: Update MSI Modern backslash and hotkeys
fix typos
2021-04-09 12:03:13 +02:00
Jérôme Carretero
aba9c92896
login: logind-dbus: support scheduled kexec (#19162)
login: logind-dbus: support delayed kexec
2021-04-09 10:55:58 +02:00
Zbigniew Jędrzejewski-Szmek
5c91fdf3f8 man: document system-systemd\x2dcryptsetup.slice
As discussed in
1dc85eff1d (r606821495),
follow-up for commit 1dc85eff1d.
2021-04-09 10:38:09 +02:00
Zbigniew Jędrzejewski-Szmek
276dc7af74 docs: use new URL for package-notes 2021-04-09 10:27:36 +02:00
simmon
d1e6dec669 po: Translated using Weblate (Korean)
Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: simmon <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/ko/
Translation: systemd/main
2021-04-09 09:31:00 +02:00
Yu Watanabe
8cd37e4354 network: do not require DHCPv6 addresses when UseAddress=no
Follow-up for 1536b7b2d0.

Fixes #19196.
2021-04-09 08:15:34 +02:00
Zbigniew Jędrzejewski-Szmek
708b299203
Merge pull request #19254 from poettering/native-journal-proto-doc
document native journal protocol
2021-04-09 08:13:21 +02:00
Zbigniew Jędrzejewski-Szmek
33ea9e9c97
Merge pull request #19255 from poettering/glyph-love
some SpecialGlyph tweaks
2021-04-09 08:05:14 +02:00
Zbigniew Jędrzejewski-Szmek
8649ec4725
Merge pull request #19248 from keszybz/make-tests-test
Make tests test
2021-04-09 07:56:04 +02:00
Lennart Poettering
eeb6923d5a core: rework unit_active_state_to_glyph() to use a translation table
Let's make this a bit more readable by implementing this via a
translation table, indexed by the state.
2021-04-08 23:01:25 +02:00
Lennart Poettering
eff60d8cea locale-util: make SpecialGlyph more like our usual enums
Let's define both an enum and a typedef named SpecialGlyph, the way we
usually do it.

Also, introduce an "invalid" special glyph, assigned to -EINVAL, also
like we always do it. (And handle it somewhat sanely in special_glyph()
2021-04-08 23:00:43 +02:00
Lennart Poettering
8ee62e53e8 man: link up new journal protocol docs 2021-04-08 22:16:58 +02:00
Lennart Poettering
1a80f4e0d7 docs: document native journal protocol
Fixes: #17748
2021-04-08 22:16:58 +02:00
Zbigniew Jędrzejewski-Szmek
d0b3039837
Merge pull request #19226 from keszybz/reenable-maybe-unitialized-warning
meson: re-enable -Wmaybe-uninitialized
2021-04-08 20:29:05 +02:00
Zbigniew Jędrzejewski-Szmek
d8e4c59785
Merge pull request #19250 from keszybz/sd-bus-is-ready-simplification
Simplify how sd_bus_is_ready() is used
2021-04-08 20:26:30 +02:00
Zbigniew Jędrzejewski-Szmek
b1e1e5ac25 TEST-17: make the test test
'! grep -v' does *not* test that there are no matching lines.
Instead, it checks that whether there are any non-matching lines.

And of course, for the test to fail, '! grep' cannot be part of
an expression with &&.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
68bb821e21 TEST-46: simplify lossy diff invocation 2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
b9bfa250f2 homectl,TEST-46: fix test and fix homectl return value, update docs
The usual: the test wasn't testing, so we didn't notice that the
command wasn't returning as expected.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
f49467b959 TEST-44: fix test
We were grepping for 'hello world', and in the namespace we would
match on 'hello world', and outside, on 'echo "hello world"'. When
the condition check was fixed, the test gave a false positive.
2021-04-08 20:21:50 +02:00
Zbigniew Jędrzejewski-Szmek
d933ccd30b TEST-43: fix exit condition testing
We were invoking 'systemd-run bash', but the test invoked by bash
was not effective. When the result of that check is propagated, the
outer command fails.
2021-04-08 20:21:50 +02:00