Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin/state-overlay: Require root and don't lock sysroot #3158

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/libostree/ostree-impl-system-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,14 @@ _ostree_impl_system_generator (const char *normal_dir, const char *early_dir, co
g_autofree char *cmdline = read_proc_cmdline ();
if (!cmdline)
return glnx_throw (error, "Failed to read /proc/cmdline");

g_autofree char *ostree_cmdline = otcore_find_proc_cmdline_key (cmdline, "ostree");
// SAFETY: If we have /run/ostree, then we must have the ostree= karg
g_assert (ostree_cmdline);

/* This could happen in CoreOS live environments, where we hackily mock
* the `ostree=` karg for `ostree-prepare-root.service` specifically, but
* otherwise that karg doesn't exist on the real command-line. */
if (!ostree_cmdline)
return TRUE;

if (!require_internal_units (normal_dir, early_dir, late_dir, error))
return FALSE;
Expand Down
5 changes: 3 additions & 2 deletions src/ostree/ot-admin-builtin-state-overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ ot_admin_builtin_state_overlay (int argc, char **argv, OstreeCommandInvocation *
/* First parse the args without loading the sysroot to see what options are
* set. */
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_NONE, invocation, &sysroot,
cancellable, error))
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
| OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
invocation, &sysroot, cancellable, error))
return FALSE;

if (argc < 3)
Expand Down
Loading