diff --git a/backport-libsemanage-fix-src-genhomedircon.c-build-on-gcc-14-.patch b/backport-libsemanage-fix-src-genhomedircon.c-build-on-gcc-14-.patch new file mode 100644 index 0000000000000000000000000000000000000000..b2797aa6a040765454b52798f853f260ff4823db --- /dev/null +++ b/backport-libsemanage-fix-src-genhomedircon.c-build-on-gcc-14-.patch @@ -0,0 +1,43 @@ +From 2a46979ea328fde748089ac9f949d93de94ab6f4 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 4 Dec 2023 16:16:55 +0000 +Subject: [PATCH] libsemanage: fix src/genhomedircon.c build on `gcc-14` + (`-Werror=alloc-size`) + +`gcc-14` added a new `-Walloc-size` warning that makes sure that size of +an individual element matches size of a pointed type: + + https://gcc.gnu.org/PR71219 + +`libsemanage` triggers it on `calloc()` calls where member size is used +as `1` (instead of member count): + + genhomedircon.c: In function 'ignore_setup': + genhomedircon.c:152:21: + error: allocation of insufficient size '1' for type 'ignoredir_t' + {aka 'struct IgnoreDir'} with size '16' [-Werror=alloc-size] + 152 | ptr = calloc(sizeof(ignoredir_t),1); + | ^ + +Signed-off-by: Sergei Trofimovich +Acked-by: James Carter +--- + libsemanage/src/genhomedircon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/genhomedircon.c b/src/genhomedircon.c +index 8f8774d3..66585987 100644 +--- a/src/genhomedircon.c ++++ b/src/genhomedircon.c +@@ -149,7 +149,7 @@ static int ignore_setup(char *ignoredirs) { + + tok = strtok(ignoredirs, ";"); + while(tok) { +- ptr = calloc(sizeof(ignoredir_t),1); ++ ptr = calloc(1, sizeof(ignoredir_t)); + if (!ptr) + goto err; + ptr->dir = strdup(tok); +-- +2.33.0 + diff --git a/libsemanage.spec b/libsemanage.spec index 9c993bc617ac9e03afbab39db2882a20ad37bbf6..3a6eb5ea3b88836a5cacd2684c72d94368fb8140 100644 --- a/libsemanage.spec +++ b/libsemanage.spec @@ -3,7 +3,7 @@ Name: libsemanage Version: 3.3 -Release: 5 +Release: 6 License: LGPLv2+ Summary: SELinux binary policy manipulation library URL: https://github.com/SELinuxProject/selinux/wiki @@ -16,6 +16,7 @@ Patch6002: backport-libsemanage-Fall-back-to-semanage_copy_dir-when-rena.patch Patch6003: backport-libsemanage-Fix-USE_AFTER_FREE-CWE-672-in-semanage_direct_get_module_info.patch Patch6004: backport-libsemanage-avoid-double-fclose.patch Patch6005: backport-libsemanage-fix-memory-leak-in-semanage_user_roles.patch +Patch6006: backport-libsemanage-fix-src-genhomedircon.c-build-on-gcc-14-.patch Patch9000: fix-test-failure-with-secilc.patch @@ -112,6 +113,9 @@ make test %changelog +* Mon Jan 22 2024 zhangruifang - 3.3-6 +- backport patches from upstream + * Tue Jun 13 2023 zhangguangzhi - 3.3-5 - backport patches from upstream