12 Star 0 Fork 13

src-openEuler/checkpolicy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-checkpolicy-Check-the-right-bits-of-an-ibpkeycon-rul.patch 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
wjiang 提交于 2025-03-14 14:45 +08:00 . backport patches from upstream
From 84a33fb96b4876a49bfb739b9a2160d88e015209 Mon Sep 17 00:00:00 2001
From: James Carter <jwcart2@gmail.com>
Date: Mon, 8 Jul 2024 12:50:32 -0400
Subject: [PATCH] checkpolicy: Check the right bits of an ibpkeycon rule subnet
prefix
The lower 64 bits of the subnet prefix for an ibpkeycon rule should
all be 0's. Unfortunately the check uses the s6_addr macro which refers
to the 16 entry array of 8-bit values in the union and does not refer
to the correct bits.
Use the s6_addr32 macro instead which refers to the 4 entry array of
32-bit values in the union and refers to the lower 64 bits.
Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
---
policy_define.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/policy_define.c b/policy_define.c
index 4931f23d..bfeda86b 100644
--- a/policy_define.c
+++ b/policy_define.c
@@ -5148,7 +5148,7 @@ int define_ibpkey_context(unsigned int low, unsigned int high)
goto out;
}
- if (subnet_prefix.s6_addr[2] || subnet_prefix.s6_addr[3]) {
+ if (subnet_prefix.s6_addr32[2] || subnet_prefix.s6_addr32[3]) {
yyerror("subnet prefix should be 0's in the low order 64 bits.");
rc = -1;
goto out;
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/checkpolicy.git
git@gitee.com:src-openeuler/checkpolicy.git
src-openeuler
checkpolicy
checkpolicy
master

搜索帮助