From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] package/libsemanage: add option to manually define policy version
Date: Sun, 15 Dec 2019 12:50:26 +0100 [thread overview]
Message-ID: <20191215125026.1c484b08@windsurf.home> (raw)
In-Reply-To: <20191215011517.1977342-2-aduskett@gmail.com>
Hello Adam,
Thanks for this patch. With the explanations of the commit log and the
cover letter, I understand a bit better what's going on.
On Sat, 14 Dec 2019 17:15:16 -0800
aduskett at gmail.com wrote:
> +if BR2_PACKAGE_LIBSEMANAGE
> +
> +config BR2_PACKAGE_LIBSEMANAGE_POLICY_MANUAL_VERSION
> + bool "Manually specify the policy version"
> + help
> + Manually specify the policy version to build.
Do we really need this boolean ? Why not always have the option BR2_PACKAGE_LIBSEMANAGE_POLICY_MAX_VERSION ?
> +if BR2_PACKAGE_LIBSEMANAGE_POLICY_MANUAL_VERSION
> +
> +config BR2_PACKAGE_LIBSEMANAGE_POLICY_MAX_VERSION
> + int "maximum policy version"
> + default 25
> + range 25 31
> + help
> + The maximum SELinux policy version your kernel supports.
> +
> + Here's a handy table to help you choose:
> + kernel version SElinux policy max version
> + <= 2.6.x 25
> + > 2.6 <= 3.5 26
> + > 3.5 <= 3.14 28 (27 and 28 were added@the same time)
> + > 3.14 <= 4.3 29
> + > 4.3 <= 4.13 30
> + > 4.13 <= 5.5 31
I think on top of PATCH 1/2, another patch could be added to make
things a little bit smarter in terms of defaults:
default 31 if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_13
default 30 if BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_3
default 29 if BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_14
default 28 if BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5
default 26 if BR2_TOOLCHAIN_HEADERS_AT_LEAST_2_6
default 25
This would@least allow the default value to be a bit more sensible
than just using "25", which is ancient.
> +# This default value may be overwrriten by setting the policy-version = line in
> +# /etc/semanage/semanage.conf.
> +LIBSEMANAGE_MAX_POLICY_VERSION = 31
Here, what you're basically doing is assuming that if
BR2_PACKAGE_LIBSEMANAGE_POLICY_MANUAL_VERSION is not enabled, we
default to "31". But "31" may be wrong. That's why I suggest to drop BR2_PACKAGE_LIBSEMANAGE_POLICY_MANUAL_VERSION and always have a BR2_PACKAGE_LIBSEMANAGE_POLICY_MAX_VERSION option.
> +ifeq ($(BR2_PACKAGE_LIBSEMANAGE_POLICY_MANUAL_VERSION),y)
> +LIBSEMANAGE_MAX_POLICY_VERSION = $(BR2_PACKAGE_LIBSEMANAGE_POLICY_MAX_VERSION)
> +endif
> +
> +define LIBSEMANAGE_SET_SEMANAGE_MAX_POLICY
> + $(SED) "/policy-version = /c\policy-version = $(LIBSEMANAGE_MAX_POLICY_VERSION)" \
> + $(TARGET_DIR)/etc/selinux/semanage.conf
> +endef
> +LIBSEMANAGE_POST_INSTALL_TARGET_HOOKS += LIBSEMANAGE_SET_SEMANAGE_MAX_POLICY
> +HOST_LIBSEMANAGE_POST_INSTALL_HOOKS += LIBSEMANAGE_SET_SEMANAGE_MAX_POLICY
The host hook is not appropriate: it tweaks a file in $(TARGET_DIR),
which is not good.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-12-15 11:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-15 1:15 [Buildroot] [PATCH 0/2] package/libsemanage: set policy versions explicitly aduskett at gmail.com
2019-12-15 1:15 ` [Buildroot] [PATCH 1/2] package/libsemanage: add option to manually define policy version aduskett at gmail.com
2019-12-15 11:50 ` Thomas Petazzoni [this message]
2019-12-15 17:36 ` Adam Duskett
2019-12-16 9:02 ` Thomas Petazzoni
2019-12-15 1:15 ` [Buildroot] [PATCH 2/2] package/libsemanage: allow the user to specify a kernel version aduskett at gmail.com
2019-12-15 12:10 ` Thomas Petazzoni
2019-12-15 17:40 ` Adam Duskett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191215125026.1c484b08@windsurf.home \
--to=thomas.petazzoni@bootlin.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.