Filter bootloader supplied kernel cmdline options
* d/p/Filter-bootloader-supplied-kernel-cmdline-options.patch:
- Filter out kernel command line parameters set by the bootloading when
deriving the configuration from /proc/cmdline.
* Add myself to uploaders
This commit is contained in:
parent
b9dd03b680
commit
a52e3d4a52
|
|
@ -1,3 +1,12 @@
|
||||||
|
ostree (2016.12-2) unstable; urgency=medium
|
||||||
|
|
||||||
|
* d/p/Filter-bootloader-supplied-kernel-cmdline-options.patch:
|
||||||
|
- Filter out kernel command line parameters set by the bootloading when
|
||||||
|
deriving the configuration from /proc/cmdline.
|
||||||
|
* Add myself to uploaders
|
||||||
|
|
||||||
|
-- Sjoerd Simons <sjoerd@debian.org> Thu, 03 Nov 2016 15:48:01 -0600
|
||||||
|
|
||||||
ostree (2016.12-1) unstable; urgency=medium
|
ostree (2016.12-1) unstable; urgency=medium
|
||||||
|
|
||||||
* Force LC_ALL=C.UTF-8 during build, so that builds in non-English
|
* Force LC_ALL=C.UTF-8 during build, so that builds in non-English
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.
|
||||||
Uploaders:
|
Uploaders:
|
||||||
Matthias Klumpp <mak@debian.org>,
|
Matthias Klumpp <mak@debian.org>,
|
||||||
Simon McVittie <smcv@debian.org>,
|
Simon McVittie <smcv@debian.org>,
|
||||||
|
Sjoerd Simons <sjoerd@debian.org>
|
||||||
Build-Depends:
|
Build-Depends:
|
||||||
attr,
|
attr,
|
||||||
bison,
|
bison,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
From f0e493bf2992d752ec3cf517542e60d9ea376be4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sjoerd Simons <sjoerd@luon.net>
|
||||||
|
Date: Sun, 30 Oct 2016 21:06:27 +0100
|
||||||
|
Subject: [PATCH] Filter bootloader supplied kernel cmdline options
|
||||||
|
|
||||||
|
Various bootloader add kernel commandline options dynamically, filter
|
||||||
|
these out when grabbing boot options from /proc/cmdline. Specifically
|
||||||
|
grub adds BOOT_IMAGE and systemd-boot adds initrd.
|
||||||
|
|
||||||
|
Closes: #560
|
||||||
|
Approved by: cgwalters
|
||||||
|
---
|
||||||
|
src/libostree/ostree-kernel-args.c | 43 ++++++++++++++++++++++++++++++----
|
||||||
|
src/libostree/ostree-kernel-args.h | 3 +++
|
||||||
|
tests/test-admin-deploy-karg.sh | 2 ++
|
||||||
|
tests/test-admin-instutil-set-kargs.sh | 2 ++
|
||||||
|
4 files changed, 46 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c
|
||||||
|
index ec189fc..22b5caa 100644
|
||||||
|
--- a/src/libostree/ostree-kernel-args.c
|
||||||
|
+++ b/src/libostree/ostree-kernel-args.c
|
||||||
|
@@ -53,6 +53,23 @@ split_keyeq (char *arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+static gboolean
|
||||||
|
+_arg_has_prefix (const char *arg,
|
||||||
|
+ char **prefixes)
|
||||||
|
+{
|
||||||
|
+ char **strviter;
|
||||||
|
+
|
||||||
|
+ for (strviter = prefixes; strviter && *strviter; strviter++)
|
||||||
|
+ {
|
||||||
|
+ const char *prefix = *strviter;
|
||||||
|
+
|
||||||
|
+ if (g_str_has_prefix (arg, prefix))
|
||||||
|
+ return TRUE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return FALSE;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
OstreeKernelArgs *
|
||||||
|
_ostree_kernel_args_new (void)
|
||||||
|
{
|
||||||
|
@@ -154,18 +171,28 @@ _ostree_kernel_args_replace_argv (OstreeKernelArgs *kargs,
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
-_ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||||
|
- char **argv)
|
||||||
|
+_ostree_kernel_args_append_argv_filtered (OstreeKernelArgs *kargs,
|
||||||
|
+ char **argv,
|
||||||
|
+ char **prefixes)
|
||||||
|
{
|
||||||
|
char **strviter;
|
||||||
|
|
||||||
|
for (strviter = argv; strviter && *strviter; strviter++)
|
||||||
|
{
|
||||||
|
const char *arg = *strviter;
|
||||||
|
- _ostree_kernel_args_append (kargs, arg);
|
||||||
|
+
|
||||||
|
+ if (!_arg_has_prefix (arg, prefixes))
|
||||||
|
+ _ostree_kernel_args_append (kargs, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+_ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||||
|
+ char **argv)
|
||||||
|
+{
|
||||||
|
+ _ostree_kernel_args_append_argv_filtered (kargs, argv, NULL);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
gboolean
|
||||||
|
_ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
@@ -175,6 +202,13 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||||
|
g_autofree char *proc_cmdline = NULL;
|
||||||
|
gsize proc_cmdline_len = 0;
|
||||||
|
g_auto(GStrv) proc_cmdline_args = NULL;
|
||||||
|
+ /* When updating the filter list don't forget to update the list in the tests
|
||||||
|
+ * e.g. tests/test-admin-deploy-karg.sh and
|
||||||
|
+ * tests/test-admin-instutil-set-kargs.sh
|
||||||
|
+ */
|
||||||
|
+ char *filtered_prefixes[] = { "BOOT_IMAGE=", /* GRUB 2 */
|
||||||
|
+ "initrd=", /* sd-boot */
|
||||||
|
+ NULL };
|
||||||
|
|
||||||
|
if (!g_file_load_contents (proc_cmdline_path, cancellable,
|
||||||
|
&proc_cmdline, &proc_cmdline_len,
|
||||||
|
@@ -184,7 +218,8 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||||
|
g_strchomp (proc_cmdline);
|
||||||
|
|
||||||
|
proc_cmdline_args = g_strsplit (proc_cmdline, " ", -1);
|
||||||
|
- _ostree_kernel_args_append_argv (kargs, proc_cmdline_args);
|
||||||
|
+ _ostree_kernel_args_append_argv_filtered (kargs, proc_cmdline_args,
|
||||||
|
+ filtered_prefixes);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
diff --git a/src/libostree/ostree-kernel-args.h b/src/libostree/ostree-kernel-args.h
|
||||||
|
index 18710d7..ceaa1ca 100644
|
||||||
|
--- a/src/libostree/ostree-kernel-args.h
|
||||||
|
+++ b/src/libostree/ostree-kernel-args.h
|
||||||
|
@@ -39,6 +39,9 @@ void _ostree_kernel_args_append (OstreeKernelArgs *kargs,
|
||||||
|
const char *key);
|
||||||
|
void _ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||||
|
char **argv);
|
||||||
|
+void _ostree_kernel_args_append_argv_filtered (OstreeKernelArgs *kargs,
|
||||||
|
+ char **argv,
|
||||||
|
+ char **prefixes);
|
||||||
|
|
||||||
|
gboolean _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
diff --git a/tests/test-admin-deploy-karg.sh b/tests/test-admin-deploy-karg.sh
|
||||||
|
index b7305f4..643aef7 100755
|
||||||
|
--- a/tests/test-admin-deploy-karg.sh
|
||||||
|
+++ b/tests/test-admin-deploy-karg.sh
|
||||||
|
@@ -46,6 +46,8 @@ ${CMD_PREFIX} ostree admin deploy --karg-proc-cmdline --os=testos testos:testos/
|
||||||
|
for arg in $(cat /proc/cmdline); do
|
||||||
|
case "$arg" in
|
||||||
|
ostree=*) # Skip ostree arg that gets stripped out
|
||||||
|
+ ;;
|
||||||
|
+ initrd=*|BOOT_IMAGE=*) # Skip options set by bootloader that gets filtered out
|
||||||
|
;;
|
||||||
|
*) assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
|
||||||
|
;;
|
||||||
|
diff --git a/tests/test-admin-instutil-set-kargs.sh b/tests/test-admin-instutil-set-kargs.sh
|
||||||
|
index 40f4b74..132c933 100755
|
||||||
|
--- a/tests/test-admin-instutil-set-kargs.sh
|
||||||
|
+++ b/tests/test-admin-instutil-set-kargs.sh
|
||||||
|
@@ -58,6 +58,8 @@ for arg in $(cat /proc/cmdline); do
|
||||||
|
case "$arg" in
|
||||||
|
ostree=*) # Skip ostree arg that gets stripped out
|
||||||
|
;;
|
||||||
|
+ initrd=*|BOOT_IMAGE=*) # Skip options set by bootloader that gets filtered out
|
||||||
|
+ ;;
|
||||||
|
*) assert_file_has_content sysroot/boot/loader/entries/ostree-testos-0.conf "options.*$arg"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
--
|
||||||
|
2.10.2
|
||||||
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
Terminate-individual-tests-after-half-an-hour.patch
|
Terminate-individual-tests-after-half-an-hour.patch
|
||||||
dist/Retrieve-some-missing-test-files-from-upstream-git.patch
|
dist/Retrieve-some-missing-test-files-from-upstream-git.patch
|
||||||
|
Filter-bootloader-supplied-kernel-cmdline-options.patch
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue