Commit Graph

3664 Commits

Author SHA1 Message Date
Simon McVittie 97f9ef0bb1 New upstream version 2022.5 2022-07-26 18:09:15 +01:00
Colin Walters 15740d042c Release 2022.5 2022-07-22 15:08:25 -04:00
Colin Walters 83e6357186 sign/ed25519: Verify signatures are minimum length
The ed25519 signature verification code does not
check that the signature is a minimum/correct length.
As a result, if the signature is too short, libsodium will end up
reading a few bytes out of bounds.

Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Co-authored-by: Demi Marie Obenour <demi@invisiblethingslab.com>

Closes: https://github.com/ostreedev/ostree/security/advisories/GHSA-gqf4-p3gv-g8vw
2022-07-14 17:13:51 -04:00
Colin Walters ed1146738b
Merge pull request #2669 from HuijingHei/fix-kargs
Fix `ostree admin kargs edit-in-place` fails issue
2022-07-13 16:35:28 -04:00
Colin Walters a3749efb1a
Merge pull request #2672 from cgwalters/initialize-sysroot-cleanups
sysroot: Have `ensure_writable` also always initialize
2022-07-13 16:35:17 -04:00
Colin Walters 60853219d5 sysroot: Add a few more assertions about `boot_fd`
These places are all safe, but it would catch bugs in the future
more clearly to trip an assertion here.
2022-07-13 15:38:59 -04:00
Colin Walters 75aa7a22f6 sysroot: Have `ensure_writable` also always initialize
For historical reasons we have a fair bit of distinct sysroot
initialization going on.  A lot of code is calling *just* the new
`ensure_writable()` API, which does basically what you'd expect...
except if we're not using a mount namespace.

Which is the case in unit tests and legacy setups.
Change this API to also ensure the sysroot is fully initialized
even in those cases.  Specifically we'll have `self->sysroot_fd`.

For now, callers that need `/boot` also need to separately
call `_ensure_boot_fd()`.
2022-07-13 15:35:00 -04:00
Colin Walters 2c71655205 deploy: Ensure sysroot is initialized for kargs in place
Even without a mount namespace set up.
2022-07-13 15:32:05 -04:00
Huijing Hei 7b7b6d741b Fix `ostree admin kargs edit-in-place` fails issue
Add func to set kernel arguments in place, instead of create new
deployment
Fix https://github.com/ostreedev/ostree/issues/2664
2022-07-12 16:27:00 +08:00
Saqib Ali d7107e3036 ostree-repo: bls-append-except-default followup
This PR is followup from https://github.com/coreos/coreos-assembler/pull/2863
Summary of changes:
- Moved bls-append-except-default parsing logic to reload_sysroot_config()
- Made sure heap allocated memory is being freed
2022-07-07 16:06:11 -04:00
Colin Walters becc18936f lib: Stop using old `ostree_sysroot_get_repo()` API
It's falliable, and in one place we were actually ignoring
the error and leaving a `NULL` repo object which is just a trap
for people coming along later since it's rarely nullable.

Quite a while ago we switched to loading the repo at the same time
as the sysroot; convert callers in the library to use this infallible
accessor.

Prep for another patch which will use the repo object.
2022-07-06 07:47:57 -04:00
Colin Walters 0d911bf91f
Merge pull request #2632 from saqibali-2k/pr/prune-commit-only
lib/prune: speed up pruning by retrieving only commits
2022-06-30 09:08:54 -04:00
Saqib Ali a984871237 lib/prune: speed up pruning by retrieving only commits
After landing the new --commit-only functionality, we still noticed
exceedingly long pruning times in large repos. Lets add an optimization
that will only retrieve commit objects when --commit-only flag is used.
2022-06-27 08:04:50 -04:00
Nikita Dubrovskii 14a7c0c74b s390x: rename sd-boot to sdboot
Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
2022-06-24 15:15:57 +02:00
Huijing Hei 3bc59a5206 RFE: Add a hidden option to `ostree admin kargs edit-in-place` to
update all existing deployments in place

Example:
$ sudo ostree admin kargs edit-in-place --append-if-missing=rw
See https://github.com/ostreedev/ostree/issues/2617

This will not add duplicate key, if there is `TESTARG=VAL1` in the
kernel arguments, `--append-if-missing=TESTARG=VAL2` will be ignored.
2022-06-23 22:31:39 +08:00
Simon McVittie 5968aa5ff6 New upstream version 2022.4 2022-06-17 14:06:59 +01:00
Colin Walters 9bdf3861ad cli/refs: Port to C99 style
General background cleanup.
2022-06-15 09:36:54 -04:00
Colin Walters 2f1c9a727e cli/remote-list: Port to C99 style
General background cleanup.
2022-06-15 09:35:03 -04:00
Colin Walters a0ae2f9156 cli/gpg-sign: Port to C99 style
General background cleanup.
2022-06-15 09:33:46 -04:00
Jonathan Lebon d9d085dc7b
Merge pull request #2650 from cgwalters/misc-declare-and-initialize-1 2022-06-14 16:20:44 -04:00
Colin Walters 43b712951d cli/diff: Port to C99 style
General background cleanup.
2022-06-14 10:04:04 -04:00
Colin Walters f8403f46dc cli/config: Port to C99 style
General background cleanup.
2022-06-14 10:03:58 -04:00
Colin Walters 4e356d0e8f cli/unlock: Port to C99 style
General background cleanup.
2022-06-14 09:53:11 -04:00
Colin Walters 588b07e554 cli/undeploy: Port to C99 style
General background cleanup.
2022-06-14 09:51:41 -04:00
Colin Walters 46e1db392d cli/os-init: Port to C99 style
General background cleanup; motivated by a recent PR which
was using pre-C99 code as a base.
2022-06-14 09:50:07 -04:00
Colin Walters 436ff11a00 fsck: Use `load_variant_if_exists`
This cleans up error handling here.
2022-06-12 10:58:29 -04:00
Colin Walters bd030a96f2 fsck: Move most commit processing into helper function
The inner loop was way too long; split out most of the heavy
lifting around backrefs and tombstones into a helper function.
2022-06-12 10:57:27 -04:00
Colin Walters 2fe0ea7395 fsck: De-indent loop
Could have done this in the previous change, but wanted to avoid
excessive diff noise.
2022-06-12 10:48:39 -04:00
Colin Walters 6981633f9c fsck: Don't load all object names into memory
We recently discovered `list_objects()` is inefficient with memory.
The more efficient `list_objects_set()` API isn't yet public, but
this fsck code actually just skips over non-commit objects, and
we already have an API to list just those.
2022-06-09 21:01:03 -04:00
Colin Walters a13d812368 repo: Document non-obvious way to list all commits
I was going to add an API for this and then realized the empty
string does it.
2022-06-09 18:34:51 -04:00
Joseph Marrero Corchado a6ecd96cda
Merge pull request #2638 from cgwalters/fix-symbol-versioning
lib: Fix symbol versioning inheritance
2022-06-08 17:17:28 -04:00
Colin Walters 145d91d1c9 lib: Fix symbol versioning inheritance
I messed this up; the last release should inherit from the previous
release (N-1) and not the previous to that (N-2).

I think (hope) this isn't an ABI break...

Just noticed this when I was going to add a new symbol.
2022-06-08 16:44:51 -04:00
Colin Walters fffb111633 prune: Also use object set API in `ostree_repo_prune_from_reachable()`
I missed the second prune path when working on
https://github.com/ostreedev/ostree/pull/2635
2022-06-08 16:22:26 -04:00
Dan Nicholson 14fbcf3f31 New upstream version 2022.3 2022-06-08 16:32:57 +00:00
Colin Walters a71915e436 repo: Further optimize `ostree_repo_list_objects_set()`
In a prior change we discovered that for bad historical reasons
libostree was returning a mapping "object type+checksum" => "metadata"
but the "metadata" was redundant and pointless.

Optimize the prune API to use a (currently internal) object listing
API which returns a set, not a map.  This allows `GHashTable` to
avoid allocating a separate array for the values, neatly cutting
memory usage in half (from ~13MB to ~6MB) on my test case of a
dry-run prune of a FCOS build.
2022-06-08 10:18:55 -04:00
Colin Walters c2baa6d10b repo: Optimize memory use of `ostree_repo_list_objects()`
I was looking at https://github.com/ostreedev/ostree/pull/2632
and confused at the usage of
`GVariant *value = g_variant_new ("(b@as)", TRUE, g_variant_new_strv (NULL, 0));`
which looked strange - why the empty strv?

It turns out that this is a historical legacy of the time when
ostree had pack files.  And nothing actually cares about the values
of these variants; we should have an API that returns a proper set,
and not a hash.

But...since all of these things have exactly the same value, instead
of allocating lots of redundant copies on the heap, just have
them all hold a refcount on a shared value.

This cuts the heap usage from 20MB to 13MB on a test FCOS repository
build.
2022-06-07 20:35:37 -04:00
Colin Walters 5fa364d399 Release 2022.4 2022-06-06 11:04:44 -04:00
Joseph Marrero Corchado 8bd1c88013
Merge pull request #2625 from cgwalters/drop-features-introspection
Drop `OSTREE_BUILT_FEATURES` from introspection
2022-06-03 09:22:48 -04:00
Colin Walters 3e645ad950 Drop `OSTREE_BUILT_FEATURES` from introspection
It inherently depends on the individual build, and can't
really be an official stable API for introspection users.
I've noticed the value of this flip flop when doing local builds.

I'm fairly certain no one is trying to use it from a higher level
language.

It'd probably make sense to even drop from the official C API,
but I'm trying to be conservative with that.
2022-06-02 19:44:40 -04:00
Colin Walters 32ee82133b Rename ostree-cmdprivate to drop out of introspection
I was looking at our `.gir` and noticed we had the cmdprivate bits
because the pattern for excluding headers is `-private.h`, which
didn't match `cmdprivate.h`.
2022-06-02 17:13:17 -04:00
James Westman 03d592b116
Fix annotations on ostree_mutable_tree_lookup()
(nullable) and (optional) were missing on lookup()'s out parameters,
which caused the rust bindings for the function to not work. Due to the
missing (nullable), it would return a Result<(GString, MutableTree), _>,
not a Result<(Option<GString>, Option<MutableTree>), _>, which led to
panics.
2022-05-30 17:36:07 -05:00
Nikita Dubrovskii 972f00e483 s390x: do not unpack existing initrd, just append LUKS keys to its copy
Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
2022-05-27 12:06:33 +02:00
Jonathan Lebon 9aca8816c6
Merge pull request #2615 from nikita-dubrovskii/handle_errors 2022-05-25 13:38:23 -04:00
Colin Walters 2363d3ad98
Merge pull request #2605 from saqibali-2k/pr/bls-append
ostree-systroot-deploy: parse bls-append-except-default key
2022-05-25 11:33:10 -04:00
Nikita Dubrovskii b03fa626f1 s390x: fail on error during reading of SecureExecution sysfs flag 2022-05-25 11:00:34 -04:00
Huijing Hei b024ce5eeb Remove dup "--os=OSNAME" line in output of "ostree admin config-diff --help"
Small fix for https://github.com/ostreedev/ostree/issues/2594
2022-05-25 11:15:39 +08:00
Huijing Hei 606459ad26 Fix GNU style of two spaces for indent in https://github.com/ostreedev/ostree/pull/2612 2022-05-25 11:12:47 +08:00
Colin Walters ea0be27bd3
Merge pull request #2612 from HuijingHei/deploy-karg-delete
Teach --karg-delete option to ostree admin deploy
2022-05-24 11:18:54 -04:00
Nikita Dubrovskii d000569859 s390x: ensure SecureExecution is enabled before sd-boot generation
Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
2022-05-23 18:24:43 +02:00
Huijing Hei 0ba3bfe4fd Teach --karg-delete option to ostree admin deploy
See https://github.com/ostreedev/ostree/issues/2586
2022-05-19 22:50:09 +08:00