From patchwork Tue Nov 24 11:41:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Qi X-Patchwork-Id: 105397 Received: from cetc.com.cn (cetc.com.cn [220.181.39.39]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.16192.1795520515355143533 for ; Tue, 24 Nov 2026 03:42:02 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: cetc.com.cn, ip: 220.181.39.39, mailfrom: chenqi_hycx@cetc.com.cn) Received: from mail.cetc.com.cn (unknown [123.125.172.206]) by mtasvr (Coremail) with SMTP id _____wBnewBzdwVrQNQAAA--.1104S3; Tue, 24 Nov 2026 19:39:31 +0800 (CST) Received: from chenqi-Redmi.. (unknown [123.125.172.206]) by front01 (Coremail) with SMTP id C6CowACXKWr5dwVrLcFAAA--.28459S3; Tue, 24 Nov 2026 19:41:46 +0800 (CST) From: chenqi_hycx@cetc.com.cn To: yocto-patches@lists.yoctoproject.org Cc: chen_q07@163.com Subject: [meta-selinux][PATCH 1/4] selint: add recipe Date: Tue, 24 Nov 2026 19:41:34 +0800 Message-ID: <20261124114137.2203106-2-chenqi_hycx@cetc.com.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> References: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> MIME-Version: 1.0 X-CM-TRANSID: C6CowACXKWr5dwVrLcFAAA--.28459S3 X-CM-SenderInfo: xfkh015lbk5un06fv33fof0zgofq/1tbiAgYBCmsEQRspEgABsA X-CM-DELIVERINFO: =?B?54RYO6c9tbm9bwt5VqgwP2Pu2dSP9LtrOQxHOAXUJl/eWtrOBydmTZkAAV6p44o2Ir PoOOlI2Du8d65gBCGhVRqdwZU2fcS8Jmk4qy2rRWZ3YIS8odFkBghl466AlOnWPRPa0aIF JOKltOzIeMi9yjWgzsDvq/Oy/3z4zCRlZrQ78qjqnfHXbMz7ZlC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IF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsG vfC2KfnxnUUI43ZEXa7IU8mjg7UUUUU== List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 11:42:03 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5506 From: Chen Qi SELint statically checks SELinux policy source files. The native build is what refpolicy uses at build time; a target package is provided too. Version 1.5.1 (fdf0d417bf). The testsuite is disabled so the recipe does not pull in the check framework. Assisted-by: Codewhale:deepseek-flash Signed-off-by: Chen Qi --- recipes-security/selint/selint_git.bb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 recipes-security/selint/selint_git.bb diff --git a/recipes-security/selint/selint_git.bb b/recipes-security/selint/selint_git.bb new file mode 100644 index 0000000..a2d5e41 --- /dev/null +++ b/recipes-security/selint/selint_git.bb @@ -0,0 +1,27 @@ +SUMMARY = "Static analysis tool for SELinux policy source files" +DESCRIPTION = "SELint checks refpolicy style .te, .if and .fc files for \ +convention, style, warning and error level issues." +HOMEPAGE = "https://github.com/SELinuxProject/selint" +SECTION = "devel" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +SRC_URI = "git://github.com/SELinuxProject/selint.git;branch=main;protocol=https" +# Bumping this means re-syncing files/selint.conf in the refpolicy recipe. +SRCREV = "fdf0d417bcefc6a82be7349d47bbef14e8d5fbbb" +PV = "1.5.1+git" + +UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+(\.\d+)+)" + +# libconfuse and uthash come from meta-oe; the rest are for autoreconf. +DEPENDS = "libconfuse uthash pkgconfig-native autoconf-archive-native \ + bison-native flex-native" + +# The testsuite would need the check framework for no benefit here. +EXTRA_OECONF = "--without-check" + +CONFFILES:${PN} = "${sysconfdir}/selint.conf" + +inherit autotools + +BBCLASSEXTEND = "native" From patchwork Tue Nov 24 11:41:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Qi X-Patchwork-Id: 105395 Received: from cetc.com.cn (cetc.com.cn [220.181.39.39]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.16191.1795520515261822654 for ; Tue, 24 Nov 2026 03:41:55 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: cetc.com.cn, ip: 220.181.39.39, mailfrom: chenqi_hycx@cetc.com.cn) Received: from mail.cetc.com.cn (unknown [123.125.172.206]) by mtasvr (Coremail) with SMTP id _____wAX8lp0dwVrQdQAAA--.4347S3; Tue, 24 Nov 2026 19:39:32 +0800 (CST) Received: from chenqi-Redmi.. (unknown [123.125.172.206]) by front01 (Coremail) with SMTP id C6CowACXKWr5dwVrLcFAAA--.28459S4; Tue, 24 Nov 2026 19:41:48 +0800 (CST) From: chenqi_hycx@cetc.com.cn To: yocto-patches@lists.yoctoproject.org Cc: chen_q07@163.com Subject: [meta-selinux][PATCH 2/4] refpolicy: label start_getty as bin_t in corecommands.fc Date: Tue, 24 Nov 2026 19:41:35 +0800 Message-ID: <20261124114137.2203106-3-chenqi_hycx@cetc.com.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> References: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> MIME-Version: 1.0 X-CM-TRANSID: C6CowACXKWr5dwVrLcFAAA--.28459S4 X-CM-SenderInfo: xfkh015lbk5un06fv33fof0zgofq/1tbiAQYBCmsEQuMpvgAAsV X-CM-DELIVERINFO: =?B?ylPnTqc9tbm9bwt5VqgwP2Pu2dSP9LtrOQxHOAXUJl/eWtrOBydmTZkAAV6p44o2Ir PoOGf+ybSYYtFb9Hm0wXO+e7pOKY+wsB/zrqdnV9An/LPree36kE4hrIkNESG5sF+eSOH8 xqw77qx6FZnroB8n+ezvq/Oy/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1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZF pf9x07jO189UUUUU= List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 11:42:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5503 From: Chen Qi SELint reports: getty.fc: 7: (S): Type bin_t is declared in module corecommands, but used in file context here. (S-002) bin_t is declared in corecommands, so the context for the wrapper script belongs in that module. Assisted-by: Codewhale:deepseek-flash Signed-off-by: Chen Qi --- ...ecommands-label-start_getty-as-bin_t.patch | 30 +++++++++++++++++++ ...etty-add-file-context-to-start_getty.patch | 27 ----------------- .../refpolicy/refpolicy_common.inc | 2 +- 3 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 recipes-security/refpolicy/refpolicy/0023-fc-corecommands-label-start_getty-as-bin_t.patch delete mode 100644 recipes-security/refpolicy/refpolicy/0023-fc-getty-add-file-context-to-start_getty.patch diff --git a/recipes-security/refpolicy/refpolicy/0023-fc-corecommands-label-start_getty-as-bin_t.patch b/recipes-security/refpolicy/refpolicy/0023-fc-corecommands-label-start_getty-as-bin_t.patch new file mode 100644 index 0000000..6353aa7 --- /dev/null +++ b/recipes-security/refpolicy/refpolicy/0023-fc-corecommands-label-start_getty-as-bin_t.patch @@ -0,0 +1,30 @@ +From 75ad7b87b85a3fb0f0d00b88831a3171a01e8fa0 Mon Sep 17 00:00:00 2001 +From: Yi Zhao +Date: Fri, 15 Nov 2019 16:07:30 +0800 +Subject: [PATCH] fc/corecommands: label start_getty as bin_t + +start_getty is a wrapper script, so it must not inherit getty_exec_t +from the /usr/bin/.*getty pattern. bin_t is declared in corecommands, +hence the label belongs in that module's file context. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Yi Zhao +--- + policy/modules/kernel/corecommands.fc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/policy/modules/kernel/corecommands.fc b/policy/modules/kernel/corecommands.fc +index 110e7471d..3b13d3ba8 100644 +--- a/policy/modules/kernel/corecommands.fc ++++ b/policy/modules/kernel/corecommands.fc +@@ -178,6 +178,7 @@ ifdef(`distro_gentoo',` + /usr/bin/scponlyc -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/sh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/smrsh -- gen_context(system_u:object_r:shell_exec_t,s0) ++/usr/bin/start_getty -- gen_context(system_u:object_r:bin_t,s0) + /usr/bin/tcsh -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/yash -- gen_context(system_u:object_r:shell_exec_t,s0) + /usr/bin/zsh.* -- gen_context(system_u:object_r:shell_exec_t,s0) +-- +2.34.1 diff --git a/recipes-security/refpolicy/refpolicy/0023-fc-getty-add-file-context-to-start_getty.patch b/recipes-security/refpolicy/refpolicy/0023-fc-getty-add-file-context-to-start_getty.patch deleted file mode 100644 index e9b70b2..0000000 --- a/recipes-security/refpolicy/refpolicy/0023-fc-getty-add-file-context-to-start_getty.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 75ad7b87b85a3fb0f0d00b88831a3171a01e8fa0 Mon Sep 17 00:00:00 2001 -From: Yi Zhao -Date: Fri, 15 Nov 2019 16:07:30 +0800 -Subject: [PATCH] fc/getty: add file context to start_getty - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Yi Zhao ---- - policy/modules/system/getty.fc | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/policy/modules/system/getty.fc b/policy/modules/system/getty.fc -index c7701c930..8b70b609a 100644 ---- a/policy/modules/system/getty.fc -+++ b/policy/modules/system/getty.fc -@@ -4,6 +4,7 @@ - /run/agetty\.reload -- gen_context(system_u:object_r:getty_runtime_t,s0) - - /usr/bin/.*getty -- gen_context(system_u:object_r:getty_exec_t,s0) -+/usr/bin/start_getty -- gen_context(system_u:object_r:bin_t,s0) - - - /var/log/mgetty\.log.* -- gen_context(system_u:object_r:getty_log_t,s0) --- -2.34.1 - diff --git a/recipes-security/refpolicy/refpolicy_common.inc b/recipes-security/refpolicy/refpolicy_common.inc index 3f629bc..be0aa83 100644 --- a/recipes-security/refpolicy/refpolicy_common.inc +++ b/recipes-security/refpolicy/refpolicy_common.inc @@ -38,7 +38,7 @@ SRC_URI += " \ file://0020-fc-ldap-apply-policy-to-ldap-alternatives.patch \ file://0021-fc-postgresql-apply-policy-to-postgresql-alternative.patch \ file://0022-fc-usermanage-apply-policy-to-usermanage-alternative.patch \ - file://0023-fc-getty-add-file-context-to-start_getty.patch \ + file://0023-fc-corecommands-label-start_getty-as-bin_t.patch \ file://0024-fc-vlock-apply-policy-to-vlock-alternatives.patch \ file://0025-fc-add-fcontext-for-init-scripts-and-systemd-service.patch \ file://0026-file_contexts.subs_dist-set-aliase-for-root-director.patch \ From patchwork Tue Nov 24 11:41:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Qi X-Patchwork-Id: 105394 Received: from cetc.com.cn (cetc.com.cn [220.181.39.39]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.16190.1795520514694098701 for ; Tue, 24 Nov 2026 03:41:55 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: cetc.com.cn, ip: 220.181.39.39, mailfrom: chenqi_hycx@cetc.com.cn) Received: from mail.cetc.com.cn (unknown [123.125.172.206]) by mtasvr (Coremail) with SMTP id _____wA3IVt2dwVrQ9QAAA--.4299S3; Tue, 24 Nov 2026 19:39:34 +0800 (CST) Received: from chenqi-Redmi.. (unknown [123.125.172.206]) by front01 (Coremail) with SMTP id C6CowACXKWr5dwVrLcFAAA--.28459S5; Tue, 24 Nov 2026 19:41:49 +0800 (CST) From: chenqi_hycx@cetc.com.cn To: yocto-patches@lists.yoctoproject.org Cc: chen_q07@163.com Subject: [meta-selinux][PATCH 3/4] refpolicy: escape the dot in the /run/issue.d file context Date: Tue, 24 Nov 2026 19:41:36 +0800 Message-ID: <20261124114137.2203106-4-chenqi_hycx@cetc.com.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> References: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> MIME-Version: 1.0 X-CM-TRANSID: C6CowACXKWr5dwVrLcFAAA--.28459S5 X-CM-SenderInfo: xfkh015lbk5un06fv33fof0zgofq/1tbiAQYBCmsEQuMpvgABsU X-CM-DELIVERINFO: =?B?qhXWSKc9tbm9bwt5VqgwP2Pu2dSP9LtrOQxHOAXUJl/eWtrOBydmTZkAAV6p44o2Ir PoOGf+ybSYYtFb9Hm0wXO+e7oQImF3BfO1NT32lpeRyv+oJuIse3EyixAAwipZk/3iOy8/ NZBnmzR50a1+PcbQpnfvq/Oy/3z4zCRlZrQ78qjqtptRfFTqgY3IgccsdeqlfA== X-Coremail-Antispam: 1Uk129KBj93XoW7KrW8GF1kAw48Gw1rGFW7GFX_yoW8WF17pr 4xZF1IkF1kWF1rAFn2kFn7Wr4jy3ya9w4DG3yqvw47C348Zw1DGF4xJrZFgFZ0qrySk3sF q34Uta9aqF1jv3XCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3gc02F40EFcxC0VAKzVAqx4xG6I80ewCY02Avz4vE14v_Gw7v73VFW2AG mfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUYw7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2 IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l 84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1D McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr4 1lw4CEc2x0rVAKj4xxMxkIecxEwVAFwVW8KwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE 7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI 8E67AF67kF1VAFwI0_Jrv_JF1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv2 0xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2js IE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZF pf9x07jOBMNUUUUU= List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 11:42:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5502 From: Chen Qi SELint reports: systemd.fc: 103: (W): File context path contains a potentially unescaped regex character '.' at position 11: /run/issue.d(/.*)? (W-004) /run/issue.d is a literal path, so escape the dot. Assisted-by: Codewhale:deepseek-flash Signed-off-by: Chen Qi --- .../0041-systemd-add-rules-for-systemd-ssh-issue.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-security/refpolicy/refpolicy/0041-systemd-add-rules-for-systemd-ssh-issue.patch b/recipes-security/refpolicy/refpolicy/0041-systemd-add-rules-for-systemd-ssh-issue.patch index 875896b..b883fb3 100644 --- a/recipes-security/refpolicy/refpolicy/0041-systemd-add-rules-for-systemd-ssh-issue.patch +++ b/recipes-security/refpolicy/refpolicy/0041-systemd-add-rules-for-systemd-ssh-issue.patch @@ -64,7 +64,7 @@ index e44d82a88..130c62370 100644 /var/lib/systemd/pstore(/.*)? gen_context(system_u:object_r:systemd_pstore_var_lib_t,s0) /var/lib/systemd/rfkill(/.*)? gen_context(system_u:object_r:systemd_rfkill_var_lib_t,s0) -+/run/issue.d(/.*)? gen_context(system_u:object_r:systemd_ssh_issue_runtime_t,s0) ++/run/issue\.d(/.*)? gen_context(system_u:object_r:systemd_ssh_issue_runtime_t,s0) + /run/\.nologin[^/]* -- gen_context(system_u:object_r:systemd_sessions_runtime_t,s0) /run/nologin -- gen_context(system_u:object_r:systemd_sessions_runtime_t,s0) From patchwork Tue Nov 24 11:41:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Qi X-Patchwork-Id: 105396 Received: from cetc.com.cn (cetc.com.cn [220.181.39.39]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.15943.1795520516614188248 for ; Tue, 24 Nov 2026 03:41:57 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: cetc.com.cn, ip: 220.181.39.39, mailfrom: chenqi_hycx@cetc.com.cn) Received: from mail.cetc.com.cn (unknown [123.125.172.206]) by mtasvr (Coremail) with SMTP id _____wAHMWB3dwVrRdQAAA--.4185S3; Tue, 24 Nov 2026 19:39:35 +0800 (CST) Received: from chenqi-Redmi.. (unknown [123.125.172.206]) by front01 (Coremail) with SMTP id C6CowACXKWr5dwVrLcFAAA--.28459S6; Tue, 24 Nov 2026 19:41:50 +0800 (CST) From: chenqi_hycx@cetc.com.cn To: yocto-patches@lists.yoctoproject.org Cc: chen_q07@163.com Subject: [meta-selinux][PATCH 4/4] refpolicy: run selint over the policy sources Date: Tue, 24 Nov 2026 19:41:37 +0800 Message-ID: <20261124114137.2203106-5-chenqi_hycx@cetc.com.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> References: <20261124114137.2203106-1-chenqi_hycx@cetc.com.cn> MIME-Version: 1.0 X-CM-TRANSID: C6CowACXKWr5dwVrLcFAAA--.28459S6 X-CM-SenderInfo: xfkh015lbk5un06fv33fof0zgofq/1tbiAgYBCmsEQRspEwAAsA X-CM-DELIVERINFO: =?B?kzOgTac9tbm9bwt5VqgwP2Pu2dSP9LtrOQxHOAXUJl/eWtrOBydmTZkAAV6p44o2Ir PoOOlI2Du8d65gBCGhVRqdwZXxbs2EkPD7wReo4SgJeaGZRqxzCf5ZXoVyqvWm4+cYuE2F g9m7v2rCZYab04BYzZXvq/Oy/3z4zCRlZrQ78qjqvnPGwHz5IT7ICLCYnmOQBw== X-Coremail-Antispam: 1Uk129KBj93XoWxAw1rur1rurWruw4DZw4DJrc_yoW5trW3pa 1akas8A3WUWFyxKrn2kF4UWr1aga98Ca1DW398Ka1qy398ZF48Ca1rtr9xuFWru3sxJw12 qrs0vFW3WayUAFXCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3gc02F40EFcxC0VAKzVAqx4xG6I80ewCY02Avz4vE14v_Gw7v73VFW2AG mfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUYw7kC6x804xWl14x267AKxVWUJVW8JwAFc2x0x2 IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUGVWUXwA2ocxC64kIII0Yj41l 84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r126r1D McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr4 1lw4CEc2x0rVAKj4xxMxkIecxEwVAFwVW8KwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE 7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI 8E67AF67kF1VAFwI0_Jrv_JF1lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv2 0xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2js IE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZF pf9x07j7hL8UUUUU= List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Tue, 24 Nov 2026 11:42:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/5504 From: Chen Qi Lint the policy sources so that a local patch introducing a SELint finding fails the build instead of silently reaching the image. The check runs after do_compile, which leaves behind the modules.conf and the generated files that selint wants in source mode; the check then only reads ${S}. Hanging it off do_compile also keeps it correct under devtool: externalsrc puts the source tree in do_compile's file-checksums, so an edited source re-runs do_compile and with it the check. do_selint is deliberately not [nostamp]. A task that always runs invalidates its dependents, so every bitbake invocation would redo compile, install and packaging. A .bbappend can set do_selint[noexec] = "1" to skip the check. The config is selint's default plus the three checks that refpolicy CI disables (C-005, C-008, W-005). Assisted-by: Codewhale:deepseek-flash Signed-off-by: Chen Qi --- recipes-security/refpolicy/files/selint.conf | 16 ++++++++++++++++ recipes-security/refpolicy/refpolicy_common.inc | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 recipes-security/refpolicy/files/selint.conf diff --git a/recipes-security/refpolicy/files/selint.conf b/recipes-security/refpolicy/files/selint.conf new file mode 100644 index 0000000..0bb14cf --- /dev/null +++ b/recipes-security/refpolicy/files/selint.conf @@ -0,0 +1,16 @@ +# Plain copy of selint v1.5.1's default config, plus refpolicy CI's disables. +# -c replaces the installed config, so re-sync this when bumping SRCREV. + +severity = "convention" + +# C-005, C-008 and W-005 are disabled like in refpolicy's lint-policy CI. +disable = { C-001, C-005, C-006, C-008, W-005, W-010, W-011, E-003, E-004 } + +enable_source = { W-010, W-011, E-003, E-004 } + +assume_users = { system_u } +assume_roles = { object_r } + +ordering_rules = "refpolicy-lax" +ordering_requires = { bool, attribute, attribute_role, type, class, role } +ordering_requires_same_flavor = false diff --git a/recipes-security/refpolicy/refpolicy_common.inc b/recipes-security/refpolicy/refpolicy_common.inc index be0aa83..c9d752b 100644 --- a/recipes-security/refpolicy/refpolicy_common.inc +++ b/recipes-security/refpolicy/refpolicy_common.inc @@ -10,6 +10,7 @@ RPROVIDES:${PN} = "refpolicy" SRC_URI += "file://customizable_types \ file://setrans-mls.conf \ file://setrans-mcs.conf \ + file://selint.conf \ " # Base patches applied to all Yocto-based platforms. Your own version of @@ -94,7 +95,7 @@ FILES:${PN}-dev =+ " \ EXTRANATIVEPATH += "bzip2-native" -DEPENDS = "bzip2-replacement-native checkpolicy-native policycoreutils-native semodule-utils-native m4-native" +DEPENDS = "bzip2-replacement-native checkpolicy-native policycoreutils-native semodule-utils-native m4-native selint-native" RDEPENDS:${PN}-dev = " \ python3-core \ @@ -192,6 +193,14 @@ set_policy_booleans() { done } +# Lint the policy sources so that a SELint finding fails the build. +do_selint() { + cd ${S} + selint -c ${UNPACKDIR}/selint.conf \ + --source --recursive --summary --fail policy +} +addtask selint after do_compile before do_install + do_compile() { oe_runmake bare if [ -f "${WORKDIR}/modules.conf" ] ; then