]> git.ipfire.org Git - thirdparty/systemd.git/log
thirdparty/systemd.git
3 years agonetwork: update comment 21533/head
Yu Watanabe [Fri, 26 Nov 2021 12:01:30 +0000 (21:01 +0900)] 
network: update comment

Addresses https://github.com/systemd/systemd/pull/21517#discussion_r757096584.

3 years agonetif-util: update log message
Yu Watanabe [Fri, 26 Nov 2021 12:00:18 +0000 (21:00 +0900)] 
netif-util: update log message

Follow-up for 37593b7c488f7b957936500158f200af16534c6b.

3 years agoMerge pull request #21529 from keszybz/test-journal-flush-no-crash
Zbigniew Jędrzejewski-Szmek [Fri, 26 Nov 2021 11:28:44 +0000 (12:28 +0100)] 
Merge pull request #21529 from keszybz/test-journal-flush-no-crash

Fix crash in test-journal-flush in CI

3 years agotest: make test-55-oomd less flaky
Anita Zhang [Wed, 24 Nov 2021 09:02:22 +0000 (01:02 -0800)] 
test: make test-55-oomd less flaky

Make oomctl a bit less likely to race with systemd-oomd receiving the
managed oom cgroup info by checking oomctl output in a loop with
timeout.

Fixes #21146

3 years agoMerge pull request #21501 from medhefgo/test
Zbigniew Jędrzejewski-Szmek [Fri, 26 Nov 2021 11:23:18 +0000 (12:23 +0100)] 
Merge pull request #21501 from medhefgo/test

test: Use TEST macro

3 years agoMerge pull request #21360 from yuwata/network-json
Zbigniew Jędrzejewski-Szmek [Fri, 26 Nov 2021 10:04:52 +0000 (11:04 +0100)] 
Merge pull request #21360 from yuwata/network-json

network: json: add more information

3 years agotest-journal-flush: do not croak on corrupted input files 21529/head
Zbigniew Jędrzejewski-Szmek [Fri, 26 Nov 2021 08:46:02 +0000 (09:46 +0100)] 
test-journal-flush: do not croak on corrupted input files

We would fail if the input file was corrupted:
build/test-journal-flush ./system@0005b7dac334f805-0021aca076ae5c5e.journal\~
journal_file_copy_entry failed: Bad message
Assertion 'r >= 0' failed at src/libsystemd/sd-journal/test-journal-flush.c:55, function main(). Aborting.
[1]    619472 IOT instruction (core dumped)  build/test-journal-flush ./system@0005b7dac334f805-0021aca076ae5c5e.journal\~

Let's skip some "reasonable" errors.

Fixes #17963.

3 years agotest-journal-flush: allow testing against specific files
Zbigniew Jędrzejewski-Szmek [Fri, 26 Nov 2021 08:40:51 +0000 (09:40 +0100)] 
test-journal-flush: allow testing against specific files

>=0 → ==0 because sd_journal_open* are documented to return 0.

3 years agommap-cache: embed MMapCache.contexts[]
Vito Caputo [Thu, 25 Nov 2021 18:39:34 +0000 (10:39 -0800)] 
mmap-cache: embed MMapCache.contexts[]

Code simplification; no idea why the Context structs were being
heap-allocated piecemeal.  There aren't many and they're small,
and made even smaller with this commit.

This also gets rid of the Context.cache backreference by just
accompanying the Context* with MMapCache* to the few private
Context* operations, resolving the context ID to a Context* at
the single public entrypoint: mmap_cache_fd_get(), which asserts
on the value being within bounds.  The Context.id member and
checks are also removed, as there's far less opportunity for
these things to become inconsistent now.

Of course this drops all context_{add,free}() related code,
making for a tasty diffstat.

3 years agojournal: Deduplicate entry items before they are stored in the entry object
Daan De Meyer [Fri, 12 Nov 2021 14:32:40 +0000 (14:32 +0000)] 
journal: Deduplicate entry items before they are stored in the entry object

If the iovec contains the same data more than once, we'll end up with
duplicate offsets in the items array. Let's make sure we remove any
duplicates before we store the items in an entry object.

3 years agoMerge pull request #21253 from poettering/homed-auto-grow-shrink
Luca Boccassi [Thu, 25 Nov 2021 22:14:17 +0000 (22:14 +0000)] 
Merge pull request #21253 from poettering/homed-auto-grow-shrink

homed: automatic grow/shrink of LUKS home dirs

3 years agommap-cache: LIST_REMOVE() *after* w->unused_prev
Vito Caputo [Thu, 25 Nov 2021 15:05:06 +0000 (07:05 -0800)] 
mmap-cache: LIST_REMOVE() *after* w->unused_prev

The LIST_REMOVE() macro always assigns NULL to w->unused_prev,
meaning every time this window was in last_unused, the remainder
of the unused list was lost to the ether.

Turns out there's been a memory leak in journald after all, this
code has been there since at least 2013...

3 years agoMerge pull request #21522 from yuwata/home-fix-memleak
Zbigniew Jędrzejewski-Szmek [Thu, 25 Nov 2021 19:22:23 +0000 (20:22 +0100)] 
Merge pull request #21522 from yuwata/home-fix-memleak

home: fix memleak

3 years agoMerge pull request #21517 from yuwata/network-long-hw-addr
Zbigniew Jędrzejewski-Szmek [Thu, 25 Nov 2021 19:21:38 +0000 (20:21 +0100)] 
Merge pull request #21517 from yuwata/network-long-hw-addr

network: make MACAddress= can take longer address

3 years agonetwork,udev: make .network and .link file can match with hardware address longer...
Yu Watanabe [Thu, 4 Nov 2021 17:59:11 +0000 (02:59 +0900)] 
network,udev: make .network and .link file can match with hardware address longer or shorter than ETH_ALEN

3 years agoTry to fix exittype test flakyness
Henri Chain [Tue, 23 Nov 2021 15:47:18 +0000 (16:47 +0100)] 
Try to fix exittype test flakyness

The test was changed at @bluca 's request to avoid sleeps,
but the change insufficient to avoid all races.
The kill command is now run from the script itself to avoid using
ExecStartPost

3 years agojournal: Remove entry seqnum revert logic
Daan De Meyer [Fri, 12 Nov 2021 14:29:02 +0000 (14:29 +0000)] 
journal: Remove entry seqnum revert logic

This actually causes mismatches between the header tail entry seqnum
and the last entry seqnum since when we revert the header seqnum, we
don't remove the entry object we added. If adding the entry object
itself fails, we don't need to revert the seqnum since it's never
incremented so let's remove this logic alltogether.

3 years agoupdate TODO 21253/head
Lennart Poettering [Fri, 29 Oct 2021 07:56:22 +0000 (09:56 +0200)] 
update TODO

3 years agotest: add test case for homed rebalancing logic
Lennart Poettering [Thu, 25 Nov 2021 09:48:52 +0000 (10:48 +0100)] 
test: add test case for homed rebalancing logic

3 years agohomectl: add new "homectl rebalance" command
Lennart Poettering [Thu, 4 Nov 2021 16:38:13 +0000 (17:38 +0100)] 
homectl: add new "homectl rebalance" command

Let's add an explicit, synchronous command to request immediate rebalancing and
wait for it.

3 years agohomed: add explicit API for requesting rebalancing too
Lennart Poettering [Thu, 4 Nov 2021 15:32:05 +0000 (16:32 +0100)] 
homed: add explicit API for requesting rebalancing too

3 years agohomed: add automatic grow/shrink ("rebalancing")
Lennart Poettering [Tue, 2 Nov 2021 22:11:59 +0000 (23:11 +0100)] 
homed: add automatic grow/shrink ("rebalancing")

3 years agohomectl: expose new rebalanceWeight JSON use record field
Lennart Poettering [Thu, 4 Nov 2021 17:12:13 +0000 (18:12 +0100)] 
homectl: expose new rebalanceWeight JSON use record field

3 years agouser-record: add rebalanceWeight field
Lennart Poettering [Tue, 2 Nov 2021 22:09:31 +0000 (23:09 +0100)] 
user-record: add rebalanceWeight field

3 years agotest: don't provide password to deactivation
Lennart Poettering [Thu, 25 Nov 2021 09:58:50 +0000 (10:58 +0100)] 
test: don't provide password to deactivation

deactivation of home areas should work without any password being
supplied. Let's hence not supply it, to ensure things work correctly.

3 years agohomed: support LogControl1 D-Bus API too, and make use of it
Lennart Poettering [Thu, 25 Nov 2021 13:32:19 +0000 (14:32 +0100)] 
homed: support LogControl1 D-Bus API too, and make use of it

All our D-Bus services support the LogControl1 API, but homed didn't so
far. Fix that, and make use of it in the test case, to make debugging it
easier.

3 years agoMerge pull request #21487 from DaanDeMeyer/dissect-image-other-arch
Lennart Poettering [Thu, 25 Nov 2021 16:36:57 +0000 (17:36 +0100)] 
Merge pull request #21487 from DaanDeMeyer/dissect-image-other-arch

Allow dissect_image() to dissect images from architectures other than the native one

3 years agohomework: fix memleak 21522/head
Yu Watanabe [Thu, 25 Nov 2021 15:14:29 +0000 (00:14 +0900)] 
homework: fix memleak

Fixes #21521.

3 years agohomework: drop unnecessary initialization
Yu Watanabe [Thu, 25 Nov 2021 15:09:30 +0000 (00:09 +0900)] 
homework: drop unnecessary initialization

3 years agotest: Use TEST macro in more cases 21501/head
Jan Janssen [Wed, 24 Nov 2021 11:11:17 +0000 (12:11 +0100)] 
test: Use TEST macro in more cases

This converts to TEST macro in less trivial cases. This is mostly
due to having an intro or outro before/after the actual tests.

Some notable changes:
 - add a "test" to make sure the hashmap and ordered_hashmap tests
   from different compilation units are actually run in test-hashmap.c
 - make root arg a global var in test-install-root.c
 - slightly rework an EFI specific test in test-proc-cmdline.c
 - usage of saved_argv/saved_argc in test-process-util.c
 - splitting test-rlimit-util.c into several tests
 - moving the hwdb open check into intro in test-sd-hwdb.c
 - condense several "tests" into one in test-udev-util.c

3 years agotest: Use TEST macro
Jan Janssen [Wed, 24 Nov 2021 11:00:02 +0000 (12:00 +0100)] 
test: Use TEST macro

This converts to TEST macro where it is trivial.

Some additional notable changes:
 - simplify HAVE_LIBIDN #ifdef in test-dns-domain.c
 - use saved_argc/saved_argv in test-copy.c, test-path-util.c,
   test-tmpfiles.c and test-unit-file.c

3 years agotest-time-util: Properly restore TZ variable
Jan Janssen [Wed, 24 Nov 2021 17:45:16 +0000 (18:45 +0100)] 
test-time-util: Properly restore TZ variable

The test fails to call tzset() after unsetting TZ variable, which
could break other tests. Also, let's be nicer and actually restore
the TZ to its original value.

3 years agotest: Slightly rework DEFINE_TEST_MAIN macros
Jan Janssen [Tue, 23 Nov 2021 12:40:27 +0000 (13:40 +0100)] 
test: Slightly rework DEFINE_TEST_MAIN macros

- A lot of tests want a different log level
- Provides saved_argc/saved_argv to tests
- Separate intro/outro is more flexible

3 years agotest-network: add basic tests of json output 21360/head
Yu Watanabe [Tue, 16 Nov 2021 15:27:16 +0000 (00:27 +0900)] 
test-network: add basic tests of json output

3 years agonetwork: json: add more link information
Yu Watanabe [Sun, 14 Nov 2021 09:11:27 +0000 (18:11 +0900)] 
network: json: add more link information

3 years agonetwork: introduce link_flags_to_string_alloc() and kernel_operstate_to_string()
Yu Watanabe [Sun, 14 Nov 2021 09:36:42 +0000 (18:36 +0900)] 
network: introduce link_flags_to_string_alloc() and kernel_operstate_to_string()

3 years agonetwork: json: append routing policy rule information
Yu Watanabe [Sun, 14 Nov 2021 06:05:55 +0000 (15:05 +0900)] 
network: json: append routing policy rule information

3 years agonetwork: routing policy rule: introduce fr_act_type_full_to_string()
Yu Watanabe [Sun, 14 Nov 2021 08:36:33 +0000 (17:36 +0900)] 
network: routing policy rule: introduce fr_act_type_full_to_string()

3 years agonetwork: json: append neighbor information
Yu Watanabe [Sun, 14 Nov 2021 06:04:24 +0000 (15:04 +0900)] 
network: json: append neighbor information

3 years agonetwork: json: append nexthop information
Yu Watanabe [Sun, 14 Nov 2021 06:02:12 +0000 (15:02 +0900)] 
network: json: append nexthop information

3 years agonetwork: json: append route information
Yu Watanabe [Sun, 14 Nov 2021 06:00:06 +0000 (15:00 +0900)] 
network: json: append route information

3 years agonetwork: json: append address information
Yu Watanabe [Sun, 14 Nov 2021 05:56:23 +0000 (14:56 +0900)] 
network: json: append address information

3 years agonetwork: json: split manager_build_json() into two
Yu Watanabe [Sun, 14 Nov 2021 06:08:44 +0000 (15:08 +0900)] 
network: json: split manager_build_json() into two

3 years agonetwork: json: make {network,device}_build_json() accept NULL
Yu Watanabe [Sun, 14 Nov 2021 05:53:36 +0000 (14:53 +0900)] 
network: json: make {network,device}_build_json() accept NULL

3 years agonetwork: json: use new building json macros
Yu Watanabe [Sun, 14 Nov 2021 05:52:03 +0000 (14:52 +0900)] 
network: json: use new building json macros

3 years agonetwork: address: expose address_flags_to_string_alloc()
Yu Watanabe [Sun, 14 Nov 2021 05:46:50 +0000 (14:46 +0900)] 
network: address: expose address_flags_to_string_alloc()

3 years agojson: introduce several macros for building json object
Yu Watanabe [Thu, 11 Nov 2021 01:45:20 +0000 (10:45 +0900)] 
json: introduce several macros for building json object

3 years agoin-addr-util: introduce FAMILY_ADDRESS_SIZE_SAFE() macro
Yu Watanabe [Sun, 14 Nov 2021 06:24:20 +0000 (15:24 +0900)] 
in-addr-util: introduce FAMILY_ADDRESS_SIZE_SAFE() macro

3 years agojournal: Add more information to --verify error messages
Daan De Meyer [Fri, 12 Nov 2021 14:28:32 +0000 (14:28 +0000)] 
journal: Add more information to --verify error messages

3 years agojson: add new JSON_BUILD_CONST_STRING() macro
Lennart Poettering [Thu, 25 Nov 2021 09:25:03 +0000 (10:25 +0100)] 
json: add new JSON_BUILD_CONST_STRING() macro

This macro is like JSON_BUILD_STRING() but uses our json library's
ability to use literal strings directly as JsonVariant objects.

The changes all our codebase to use this new macro whenever we build
JSON objects from literal strings.

(I tried to make this automatic, i.e. to detect in JSON_BUILD_STRING()
whether something is a literal string nicely and thus do this stuff
automatically, but I couldn't find a way.)

This should reduce memory usage of our JSON code a bit. Constant strings
we use very often will now be shared and mapped directly from the ELF
image.

3 years agojson: don't assert() if we add a NULL element via json_variant_set_field()
Lennart Poettering [Thu, 25 Nov 2021 09:30:45 +0000 (10:30 +0100)] 
json: don't assert() if we add a NULL element via json_variant_set_field()

The rest of our JSON code tries hard to magically convert NULL inputs
into "null" JSON objects, let's make sure this also works with
json_variant_set_field().

3 years agonetwork: make MACAddress= takes hardware address with its length is INFINIBAND_ALEN 21517/head
Yu Watanabe [Thu, 4 Nov 2021 18:20:29 +0000 (03:20 +0900)] 
network: make MACAddress= takes hardware address with its length is INFINIBAND_ALEN

Also, the multicast and local bits in the specified MAC address for
ethernet are adjusted.

3 years agomkosi: Install sd-boot using postinst script instead of in build script 21487/head
Daan De Meyer [Tue, 23 Nov 2021 18:57:18 +0000 (19:57 +0100)] 
mkosi: Install sd-boot using postinst script instead of in build script

This allows us to reuse bootctl install instead of replicating the
logic in the build script.

3 years agonetif-util: introduce net_verify_hardware_address()
Yu Watanabe [Sat, 6 Nov 2021 01:55:21 +0000 (10:55 +0900)] 
netif-util: introduce net_verify_hardware_address()

3 years agoUpdate LINGUAS (#21499)
Hugo Carvalho [Thu, 25 Nov 2021 11:24:00 +0000 (11:24 +0000)] 
Update LINGUAS (#21499)

3 years agorepart,homed: split out disk cleanup macros into generic header
Lennart Poettering [Tue, 28 Sep 2021 21:24:57 +0000 (23:24 +0200)] 
repart,homed: split out disk cleanup macros into generic header

3 years agolist: add LIST_POP() helper that pops the first item off a linked list
Lennart Poettering [Tue, 28 Sep 2021 22:13:12 +0000 (00:13 +0200)] 
list: add LIST_POP() helper that pops the first item off a linked list

3 years agoman: "-j", not "-J" is the shortcut for JSON mode in homectl
Lennart Poettering [Thu, 25 Nov 2021 10:21:55 +0000 (11:21 +0100)] 
man: "-j", not "-J" is the shortcut for JSON mode in homectl

The code and --help text got this right, hence fix the man page

3 years agoMerge pull request #21503 from poettering/ioprio-fix
Yu Watanabe [Thu, 25 Nov 2021 05:23:02 +0000 (14:23 +0900)] 
Merge pull request #21503 from poettering/ioprio-fix

work around linux 5.15 ioprio API breakage

3 years agoMerge pull request #21492 from andch-nn/add-micmute-dell-machine
Yu Watanabe [Thu, 25 Nov 2021 04:52:26 +0000 (13:52 +0900)] 
Merge pull request #21492 from andch-nn/add-micmute-dell-machine

Add micmute for dell machine

3 years agoMerge pull request #21506 from poettering/homed-uidmap-fixes
Yu Watanabe [Thu, 25 Nov 2021 04:37:46 +0000 (13:37 +0900)] 
Merge pull request #21506 from poettering/homed-uidmap-fixes

homed uidmap (and other) fixes

3 years agoMerge pull request #21508 from poettering/conn-count-fix
Yu Watanabe [Thu, 25 Nov 2021 04:33:13 +0000 (13:33 +0900)] 
Merge pull request #21508 from poettering/conn-count-fix

pid1: fix connection counting

3 years agobuild: fix build without seccomp
Dominique Martinet [Wed, 24 Nov 2021 14:04:30 +0000 (23:04 +0900)] 
build: fix build without seccomp

- execute.c: bpf functions were in the middle of an #if HAVE_SECCOMP
  block for no reason
- test-fd-util.c: make seccomp-util.h includable without depending on
  <seccomp.h>, and make is_seccomp_available() hardcoded to returning
  false in this case.
  Also fix a stray DEFINED() -- HAVE_SECCOMP is defined as 0, so normal
  #if should be used like everywhere else.

3 years agobuild(deps): bump github/codeql-action from 1.0.23 to 1.0.24
dependabot[bot] [Wed, 24 Nov 2021 15:17:04 +0000 (15:17 +0000)] 
build(deps): bump github/codeql-action from 1.0.23 to 1.0.24

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1.0.23 to 1.0.24.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/a627e9fa504113bfa8e90a9b429b157a38b1cdbd...e095058bfa09de8070f94e98f5dc059531bc6235)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoman: suggest usage of CollectMode= in Accept=yes services 21508/head
Lennart Poettering [Wed, 24 Nov 2021 23:11:31 +0000 (00:11 +0100)] 
man: suggest usage of CollectMode= in Accept=yes services

3 years agosocket: various modernizations
Lennart Poettering [Wed, 24 Nov 2021 22:53:10 +0000 (23:53 +0100)] 
socket: various modernizations

3 years agosocket: always pass socket, fd and SocketPeer ownership to service together
Lennart Poettering [Wed, 24 Nov 2021 22:50:07 +0000 (23:50 +0100)] 
socket: always pass socket, fd and SocketPeer ownership to service together

Per-connection socket instances we currently maintain three fields
related to the socket: a reference to the Socket unit, the connection fd,
and a reference to the SocketPeer object that counts socket peers.

Let's synchronize their lifetime, i.e. always set them all three
together or unset them together, so that their reference counters stay
synchronous.

THis will in particuar ensure that we'll drop the SocketPeer reference
whenever we leave an active state of the service unit, i.e. at the same
time we close the fd for it.

Fixes: #20685
3 years agojournal: Don't allow creating invalid objects
Daan De Meyer [Thu, 11 Nov 2021 13:31:31 +0000 (13:31 +0000)] 
journal: Don't allow creating invalid objects

Let's not allow creating empty entry or data objects. Let's also
not allow creating data objects from data without an embedded '='
character.

3 years agoMerge pull request #21502 from keszybz/os-release-debugging
Lennart Poettering [Wed, 24 Nov 2021 21:00:02 +0000 (22:00 +0100)] 
Merge pull request #21502 from keszybz/os-release-debugging

Additional debugging info to make release-extension easier to introspect

3 years agounit_is_bound_by_inactive: fix return pointer check
Dominique Martinet [Wed, 24 Nov 2021 13:27:22 +0000 (22:27 +0900)] 
unit_is_bound_by_inactive: fix return pointer check

*ret_culprit should be set if ret_culprit has been passed a non-null value,
checking the previous *ret_culprit value does not make sense.

This would cause the culprit to not properly be assigned, leading to
pid1 crash when a unit could not be stopped.

Fixes: #21476
3 years agohomework: add debug log message whenever we applied a uidmap to a mount 21506/head
Lennart Poettering [Wed, 24 Nov 2021 17:40:36 +0000 (18:40 +0100)] 
homework: add debug log message whenever we applied a uidmap to a mount

3 years agohomework: fix a bad error propagation
Lennart Poettering [Wed, 24 Nov 2021 17:36:00 +0000 (18:36 +0100)] 
homework: fix a bad error propagation

3 years agohomework: also apply uid shifting when changing passwords/resizing/updating home...
Lennart Poettering [Wed, 24 Nov 2021 17:34:02 +0000 (18:34 +0100)] 
homework: also apply uid shifting when changing passwords/resizing/updating home areas

This adds uidmap shifting also when resizing/updating/changing
passwords. Prviously I thought we didn't have to, because the user is
not going to access the uidmap if we only quickly activate the home
area. But this thinking is wrong, because the three operations will
result in an update ~/.identity fie to be written, and we should do that
with uidmap applied, so that its ownership maps down to nobody below as
intended.

Fixes: #21441
3 years agohomework: don't try to shift uidmap for already activated home areas
Lennart Poettering [Wed, 24 Nov 2021 17:31:51 +0000 (18:31 +0100)] 
homework: don't try to shift uidmap for already activated home areas

When we want to operate on an already activated home area we so far
tried to reapply the uidmapping logic. We shouldn't do that, it's
already applied after all.

We only want to apply this for newly activated home areas. Hence check
for the right HomeSetupFlags flag for it HOME_SETUP_ALREADY_ACTIVATED.

The patch is actually in theory a two-liner. Except that so far we don#t
pass the HomeSetupFlags flags down all necessary functions where the
uidmap stuff will eventually run. Hence this larger than intended
commit.

3 years agohomework: fix message typo
Lennart Poettering [Wed, 24 Nov 2021 17:29:52 +0000 (18:29 +0100)] 
homework: fix message typo

3 years agohomectl: also acquire "cheap" passwords for homectl update/passwd
Lennart Poettering [Wed, 24 Nov 2021 17:26:28 +0000 (18:26 +0100)] 
homectl: also acquire "cheap" passwords for homectl update/passwd

In 57bb9bcba5563c040ee0c41f58e3730a006a8de2 support was added to read
"cheap" passwords from env vars and stuff before issuing the first
operation, instead of waiting for it until the first operation failed.

This was added for most verbs of "homectl", but two were left out:
update + passwd. Add it there too.

3 years agodissect-image: always say "file of image" when reporting about the image 21502/head
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 14:40:53 +0000 (15:40 +0100)] 
dissect-image: always say "file of image" when reporting about the image

We give a path, but the path is only meaningful inside of the image.
Some messages made it clear that it's a path in the image, let's make
them all do that.

3 years agoAdd debug logs of extension-release scanning
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 14:06:48 +0000 (15:06 +0100)] 
Add debug logs of extension-release scanning

3 years agodissect-image: provide a more useful message when ENOMEDIUM is returned
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 12:06:37 +0000 (13:06 +0100)] 
dissect-image: provide a more useful message when ENOMEDIUM is returned

3 years agodissect-image: do not enable "verification" when trying to acquire metadata
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 12:03:25 +0000 (13:03 +0100)] 
dissect-image: do not enable "verification" when trying to acquire metadata

The whole point of acquiring metadata is quite often to figure out why the
image does not pass verification. Refusing to provide metadata is just being
hostile to the user.

When called from other places (e.g. image_read_metadata()), verification is
still performed.

3 years agotest: make test-execute pass on Linux 5.15 21503/head
Lennart Poettering [Wed, 24 Nov 2021 14:58:50 +0000 (15:58 +0100)] 
test: make test-execute pass on Linux 5.15

Linux 5.15 broke kernel API:

https://github.com/torvalds/linux/commit/e70344c05995a190a56bbd1a23dc2218bcc8c924

Previously setting IOPRIO_CLASS_NONE for a process would then report
IOPRIO_CLASS_NONE back. But since 5.15 it reports IOPRIO_CLASS_BE
instead. Since IOPRIO_CLASS_NONE is an alias for a special setting of
IOPRIO_CLASS_BE this makes some sense, but it's also a kernel API
breakage that our testsuite trips up on.

(I made some minimal effort to inform the kernel people about this API
breakage during the 5.15 rc phase, but noone was interested.)

Either way let's hadle this gracefully in our test suite and accept
"best-effort" too when "none" was set.

(This is only triggable if the tests are run on 5.15 with full privs)

3 years agoman: don't mention IOSchedulingClass=none anymore in the docs
Lennart Poettering [Wed, 24 Nov 2021 14:54:29 +0000 (15:54 +0100)] 
man: don't mention IOSchedulingClass=none anymore in the docs

Let's not mention a redundant setting of "none". Let's instead only
mention "best-effort", which is the same. Also mention the default
settings properly.

(Also, while we are at it, don#t document the numeric alias, that's
totally redundant and harder to use, so no need to push people towards
it.)

3 years agotest: add test for ioprio normalization
Lennart Poettering [Wed, 24 Nov 2021 14:52:13 +0000 (15:52 +0100)] 
test: add test for ioprio normalization

3 years agocore: normalize ioprio values we acquire from kernel
Lennart Poettering [Wed, 24 Nov 2021 14:39:43 +0000 (15:39 +0100)] 
core: normalize ioprio values we acquire from kernel

Linux 5.15 broke API in ioprio_get(): instead of returning
IOPRIO_CLASS_NONE when that's set it now returns IOPRIO_CLASS_BE, which
is what this actually is (the former is just an alias for the latter
with a priority value of 4).

Let's hide the differences between old and new kernels here, and always
normalize to what the new kernels do.

3 years agoioprio: normalize io priority values in configuration
Lennart Poettering [Wed, 24 Nov 2021 14:38:10 +0000 (15:38 +0100)] 
ioprio: normalize io priority values in configuration

Let's always say IOPRIO_CLASS_BE when IOPRIO_CALSS_NONE is set.

3 years agoioprio-util: add macro for default ioprio settings
Lennart Poettering [Wed, 24 Nov 2021 14:30:22 +0000 (15:30 +0100)] 
ioprio-util: add macro for default ioprio settings

IOPRIO_CLASS_NONE with any priority value actually is an alias for
IOPRIO_CLASS_BE with priority value 4 – which is the default ioprio for
all processes.

We got this right at one place, but wrong at three others (where we
assumed the default value was 0, not 4). Let's add a
macro that encodes this properly, and use it everywhere.

3 years agoshared: split out ioprio related stuff into ioprio-util.[ch]
Lennart Poettering [Wed, 24 Nov 2021 14:24:55 +0000 (15:24 +0100)] 
shared: split out ioprio related stuff into ioprio-util.[ch]

No actual code changes, just some splitting out.

3 years agodissect-image: reuse common exit path
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 12:02:11 +0000 (13:02 +0100)] 
dissect-image: reuse common exit path

3 years agoshared/format-table: drop unnecessary _cleanup_
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 10:59:10 +0000 (11:59 +0100)] 
shared/format-table: drop unnecessary _cleanup_

3 years agotest-pretty-print: spelling nitpick
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 10:44:54 +0000 (11:44 +0100)] 
test-pretty-print: spelling nitpick

The antonym of "nay" is usually spelled as "yea" (and pronouced as yā, so it
rhymes with "nay"), see e.g. https://www.cop.senate.gov/general/Features/votes.htm

3 years agoshared: Add support for non-native architectures to dissect_image()
Daan De Meyer [Tue, 23 Nov 2021 16:54:26 +0000 (17:54 +0100)] 
shared: Add support for non-native architectures to dissect_image()

To allow dissecting images of architectures other than the native
(or secondary) one, we add a third designator 'OTHER' to represent
architectures other than the native or secondary one.

If no partitions of the native or secondary arch are available, we
check if a root partition of any other arch is available and use that
instead if we found one.

3 years agogpt: Store the partition type in GptPartitionType
Daan De Meyer [Wed, 24 Nov 2021 09:30:27 +0000 (10:30 +0100)] 
gpt: Store the partition type in GptPartitionType

This replaces the _GPT_ALL_ARCHES macro.

3 years agogpt: Store the architecture in GptPartitionType
Daan De Meyer [Tue, 23 Nov 2021 16:52:27 +0000 (17:52 +0100)] 
gpt: Store the architecture in GptPartitionType

We also add a function gpt_partition_type_uuid_to_arch() to get the
architecture of a partition type uuid.

3 years agoshell-completion: add journalctl --facility
Zbigniew Jędrzejewski-Szmek [Wed, 24 Nov 2021 10:21:10 +0000 (11:21 +0100)] 
shell-completion: add journalctl --facility

Fixes #21484.

3 years agobasic: Rename SECONDARY_ARCHITECTURE to ARCHITECTURE_SECONDARY
Daan De Meyer [Tue, 23 Nov 2021 16:49:30 +0000 (17:49 +0100)] 
basic: Rename SECONDARY_ARCHITECTURE to ARCHITECTURE_SECONDARY

For easier integration with the _GPT_ALL_ARCHES macro in a future
commit.

3 years agogpt: Rename PPC64LE TO PPC64_LE
Daan De Meyer [Tue, 23 Nov 2021 16:34:05 +0000 (17:34 +0100)] 
gpt: Rename PPC64LE TO PPC64_LE

For consistency with ARCHITECTURE_PPC64_LE

3 years agobasic: Give architecure enum a name
Daan De Meyer [Tue, 23 Nov 2021 16:22:18 +0000 (17:22 +0100)] 
basic: Give architecure enum a name

3 years agobasic/architectures: sort by name and remove duplicates
Zbigniew Jędrzejewski-Szmek [Tue, 23 Nov 2021 17:19:59 +0000 (18:19 +0100)] 
basic/architectures: sort by name and remove duplicates

C.f. 086df29f35069bb454d52a21a146f76cf7bd42dc.

3 years agobpf: fix memleak in restrict_fs_bpf
Julia Kartseva [Tue, 23 Nov 2021 23:38:11 +0000 (15:38 -0800)] 
bpf: fix memleak in restrict_fs_bpf

Memory allocated in bpf skeleton is not freed. Wrap ptr in _cleanup_.

Fixes: #21471
3 years agoMerge pull request #21448 from poettering/disk-image-purpose
Lennart Poettering [Wed, 24 Nov 2021 08:37:04 +0000 (09:37 +0100)] 
Merge pull request #21448 from poettering/disk-image-purpose

encode disk image purpose in extension-release.d + os-release