Commit Graph
3749 Commits
Author SHA1 Message Date
Daan De Meyer d418c5c926 Merge pull request #27629 from ddstreet/tpm2_verify_sym_params
Tpm2 verify sym params
2023-06-07 13:48:54 +02:00
Zbigniew Jędrzejewski-Szmek d1579f0b70 Merge pull request #27885 from DaanDeMeyer/please-dont-make-me-write-more-openat-helpers
Add more openat like helper functions
2023-06-07 13:25:33 +02:00
Luca Boccassi cd8947d0d1 Merge pull request #27938 from keszybz/ukify-build-verb
Add 'ukify build' verb, expand tests
2023-06-06 18:22:45 +01:00
Zbigniew Jędrzejewski-Szmek 320266b961 test_ukify: pass through path to addon stub
Without this, the tests would generally be skipped, since we haven't made a
release with the addon stub yet. But even if the file is there, we always want
to test the freshly-built item.
2023-06-06 15:45:57 +02:00
Daan De Meyer 0bb5653530 Merge pull request #27918 from yuwata/chase-filename
chase: handle root path more carefully in chase_and_open()
2023-06-06 15:01:37 +02:00
Daan De Meyer fab4ef7262 btrfs-util: Add btrfs_subvol_snapshot_at() 2023-06-06 14:44:02 +02:00
Daan De Meyer 8b85333cda test-chase: Add one more test for chase_and_openat() 2023-06-06 14:42:03 +02:00
Daan De Meyer 3c8f449cc8 chase: Allow passing NULL as the empty path to chaseat()
Per coding style, we should accept NULL as the empty path.
2023-06-06 14:42:03 +02:00
Daan De Meyer f5dc1adc71 test-chase: Fix comment 2023-06-06 14:42:03 +02:00
Daan De Meyer f9f70e062d copy: Merge copy_directory() and copy_directory_fd() into copy_directory_at()
Let's merge these two into a single function that can handle both
variants and more.
2023-06-06 14:42:03 +02:00
Dan Streetman a47060bb34 tpm2: verify symmetric parms in tpm2_context_new()
This adds tpm2_get_capability_algs(), tpm2_supports_alg(), and
tpm2_test_parms(). These functions allow verifying that the TPM supports
specific algs and parameters.

When creating a new context, this checks if the TPM supports the symmetric algs
we use. If the TPM does not support the symmetric algs and parameters we
require, we log and return error.
2023-06-05 19:58:14 -04:00
Lennart Poettering af4e8e86ec battery-util: split out code that checks AC power state into its own .c/.h pair
No code change, just some splitting out of the relevant code from
udev-util.[ch].

This makes sense on its own, but is also prepartion to move the code
that checks for low battery state into battery-util.[ch], too.
2023-06-05 12:18:21 +02:00
Yu Watanabe 3991f35fbd chase: handle root path more carefully in chase_and_open()
chase_and_open() may be called with relative root path.
2023-06-05 15:50:46 +09:00
Yu Watanabe c0dff4205b test: move intro() near DEFINE_TEST_MAIN_WITH_INTRO() 2023-06-05 14:49:54 +09:00
Yu Watanabe d7aef22724 test: add more test cases about path_startswith() 2023-06-05 14:49:54 +09:00
Lennart Poettering 4d824ac0d3 Merge pull request #27435 from poettering/renew-reboot
pid1: add a new method of rebooting: userspace only under the name "soft-reboot"
2023-06-02 23:27:45 +02:00
Lennart Poettering f9ad896ee2 mount-util: add fd_make_mount_point() helper 2023-06-02 18:43:10 +02:00
Lennart Poettering beda8529b9 test-macro: add ROUND_UP() macro for rounding up to next multiple
In case of overflow will return -1 cast to the first parameter type.
2023-06-02 16:41:36 +02:00
Lennart Poettering 614ac89d30 test-sizeof: let's be a tiny bit more careful when using glibc internal types
One can argue that internal glibc types (i.e. those starting with __)
are not really part of the glibc API, hence let's at least ifdef them.
2023-06-01 21:10:04 +09:00
Yu Watanabe abe72100cf util: introduce memstream-util
There is many pitfalls in using memstream.
Let's introduce a wrapper to make us safely use it.
2023-06-01 06:48:43 +09:00
Yu Watanabe 5d2a48da12 tree-wide: use _cleanup_set_free_ and friends
Instead of _cleanup_(set_freep) or so.
2023-06-01 06:47:48 +09:00
Daan De Meyer c4b7e0f812 Merge pull request #27844 from DaanDeMeyer/repart-arch
repart: Add --architecture option
2023-05-31 23:00:19 +02:00
Daan De Meyer 2533fdd0fb Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Don't GC unit if it is in cgroup_empty_queue
2023-05-31 14:48:42 +02:00
Daan De Meyer 05d1cbb33c Merge pull request #26969 from DaanDeMeyer/xopenat-label
fs-util: Add labelling support to xopenat()
2023-05-31 14:35:50 +02:00
Lennart Poettering cbf21d1432 Merge pull request #27860 from poettering/loopback-no-prefix-route
loopback-setup: only create a single loopback route when configuring 'lo'
2023-05-31 14:03:04 +02:00
Daan De Meyer 7767b83f4a gpt: Add gpt_partition_type_override_architecture()
Let's add a function that allows changing the architecture of a given
partition type.
2023-05-31 13:48:13 +02:00
Daan De Meyer 420d2e3136 fs-util: Add XOpenFlags with XO_LABEL flag to have xopenat() MAC label files/dirs 2023-05-31 13:15:56 +02:00
Daan De Meyer a452c807a4 label: Introduce LabelOps to do pre/post labelling operations
By default, label_ops is initialized with a NULL pointer which translates
to noop labelling operations. In mac_selinux_init() and the new mac_smack_init(),
we initialize label_ops with a MAC specific LabelOps pointer.

We also introduce mac_init() to initialize any configured MACs and replace all
usages of mac_selinux_init() with mac_init().
2023-05-31 13:15:53 +02:00
Lennart Poettering f734b2cc66 test-loopback: run test in network + user namespace
This way it can actually do useful testing even when unprivileged.
2023-05-31 11:11:45 +02:00
Zbigniew Jędrzejewski-Szmek 5ad6600364 test-dlopen: allow loading of multiple libraries
This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.
2023-05-30 16:05:06 +02:00
Richard Phibel fc6172b1d8 Fix failing test
In test-execute, only the unit was started, not the slice. Because of
that the slice cgroup was pruned even if it was still needed. From what
I can tell, this is because, in the test, we don't have all the
mechanics that starts the slice for a service. To fix the issue the
slice is started manually.
2023-05-30 12:38:47 +02:00
Daan De Meyer dcc5547b8b Merge pull request #27517 from ddstreet/tpm2_calculate_policy
Tpm2 calculate policy
2023-05-26 23:08:15 +02:00
Yu Watanabe d4fd160f69 Merge pull request #27786 from YHNdnzj/format-timestamp-monotonic
time-util,format-table: add relative_monotonic variant for timestamp
2023-05-27 03:05:34 +09:00
Lennart Poettering 719771adca test-gpt: verify that alias entries are identical to the primary ones
Given we allow aliases we better check for consistency of alias entries
and the primary one.
2023-05-27 02:21:17 +09:00
Dan Streetman 5c7852f78c tpm2: add tpm2_policy_authorize()
This adds functions to get the digest for a PolicyAuthorize operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthorize with an existing session.
2023-05-26 11:12:12 -04:00
Dan Streetman 8a716354bb tpm2: add tpm2_policy_auth_value()
This adds functions to get the digest for a PolicyAuthValue operation. For
building a policy hash, this provides a function to calculate the hash; and for
building a policy hash to satisfy the authPolicy for an existing object, this
provides a function to perform PolicyAuthValue with an existing session.
2023-05-26 11:11:50 -04:00
Dan Streetman dcbc4674e3 tpm2: add tpm2_policy_pcr()
This adds functions to get the digest for a PolicyPCR operation. For building
a policy hash, this provides a function to calculate the hash; and for building
a policy hash to satisfy the authPolicy for an existing object, this provides a
function to perform PolicyPCR with an existing session.
2023-05-26 11:11:25 -04:00
Dan Streetman dbae4b9535 tpm2: add tpm2_get_name()
This adds functions to get the "name" of a key. The key "name", as defined
by the TPM2 spec, includes its entire public area (with attribute fields),
not only its key fingerprint.

A function is added to calculate the name of a provided key public area,
as well as a function to get the name of a key which is present in the TPM.
2023-05-26 11:06:53 -04:00
Dan Streetman da92d39a85 tpm2: add tpm2_digest_*() functions
These functions allow extending (or initializing) a TPM2B_DIGEST with additional
data, using a specified hash operation. This is needed to perform hash
calculations instead of relying on the TPM to perform the calculations in
trial sessions.
2023-05-26 11:06:20 -04:00
Mike Yuan d65c289fbf time-util,format-table: add relative_monotonic variant for timestamp 2023-05-26 13:29:54 +08:00
Yu Watanabe dd57168144 Merge pull request #27754 from poettering/cloexec-fdset-madness
pid1: when taking possession of passed fds check O_CLOEXEC state first
2023-05-24 06:08:17 +09:00
Lennart Poettering d7aee3f41f test: test O_CLOEXEC filtering of fdset fill logic 2023-05-23 20:46:13 +02:00
Daan De Meyer 3d41b6b8e8 tree-wide: Fix false positives on newer gcc
Recent gcc versions have started to trigger false positive
maybe-uninitialized warnings. Let's make sure we initialize
variables annotated with _cleanup_ to avoid these.
2023-05-23 19:45:27 +01:00
Lennart Poettering a3dff21ae8 pid1: when taking possession of passed fds check O_CLOEXEC state first
So here's the thing. One library we use (libselinux) is opening fds
behind our back when we initialize it and keeps it open. On the other
hand we want to automatically pick up all fds passed in to us, so that
we can distribute them to our services and close the rest. We pick them
up very early in our code, to ensure that we don't get confused by open
fds at that point. Except that libselinux insists on being initialized
even earlier. So suddenly we might take possession of libselinux' fds,
and then close them later when we decide no service wants them. Then
during shutdown we close down selinux and selinux closes its fds, but
since already closed long ago this ight close our fds instead. Hilarity
ensues.

I wish low-level software wouldn't do such things behind our back, but
well, let's make the best of it.

This changes the fd pick-up logic to only pick up fds that have
O_CLOEXEC unset. O_CLOEXEC must be unset for any fds passed in to us
over execve() after all. And for all our own fds we should set O_CLOEXEC
since we generally don't want to litter fd tables for execve(). Also,
libselinux thankfully appears to set O_CLOEXEC correctly on its fds,
hence the filter works.

Fixes: #27491
2023-05-23 19:23:32 +02:00
Lennart Poettering 563e684689 stat-util: rename files_same() → inode_same()
Let's be more accurate about what this function does: it checks whether
the underlying reported inode is the same. Internally, this already uses
a better named stat_inode_same() call, hence let's similarly name the
wrapping function following the same logic.

Similar for files_same_at() and path_equal_or_same_files().

No code changes, just some renaming.
2023-05-19 17:42:41 +02:00
Lennart Poettering 4e9ef660e6 test: add test for umount_recursive() 2023-05-17 10:29:53 +02:00
Mike Yuan 329f4b06f5 Merge pull request #27659 from yuwata/memfd-seal
memfd-util: handle F_SEAL_EXEC flag
2023-05-16 22:00:57 +08:00
Yu Watanabe 3418ca21ed test: add basic test for memfd_set_sealed() and memfd_get_sealed() 2023-05-16 18:59:25 +09:00
Mike Yuan b5b1351317 test: add tests for UpheldBy= in [Install] section 2023-05-15 15:04:38 +08:00
Daan De Meyer 32b0be0eb8 Merge pull request #27565 from yuwata/static-destruct
static-destruct: support clearing array on exit
2023-05-12 08:36:43 +02:00