From 61d0be66c3f929fcfe57835f13c12a2454293be5 Mon Sep 17 00:00:00 2001 From: zhanghao Date: Mon, 7 Aug 2023 20:19:13 +0800 Subject: [PATCH] nscd:sync some patches (cherry picked from commit b4fb6b6565cf891067795e92f4ad649d50adede0) --- fix-Segmentation-fault-in-nss-module.patch | 40 +++++++++++++++++++ ...atabase_check_reload_and_get_memleak.patch | 38 ++++++++++++++++++ glibc.spec | 8 +++- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 fix-Segmentation-fault-in-nss-module.patch create mode 100644 fix_nss_database_check_reload_and_get_memleak.patch diff --git a/fix-Segmentation-fault-in-nss-module.patch b/fix-Segmentation-fault-in-nss-module.patch new file mode 100644 index 0000000..21d75b9 --- /dev/null +++ b/fix-Segmentation-fault-in-nss-module.patch @@ -0,0 +1,40 @@ +From f5b9e0f2a8ada29cebeb6e51cbcbea396375ab26 Mon Sep 17 00:00:00 2001 +From: huangyu +Date: Wed, 7 Dec 2022 14:35:26 +0800 +Subject: [PATCH] fix Segmentation fault in nss module + +Signed-off-by: huangyu +--- + nss/nss_module.c | 2 +- + nss/nsswitch.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nss/nss_module.c b/nss/nss_module.c +index b28cb94a..bb2807e9 100644 +--- a/nss/nss_module.c ++++ b/nss/nss_module.c +@@ -352,7 +352,7 @@ nss_load_all_libraries (enum nss_database service) + { + nss_action_list ni = NULL; + +- if (__nss_database_get (service, &ni)) ++ if (__nss_database_get (service, &ni) && ni != NULL) + while (ni->module != NULL) + { + __nss_module_load (ni->module); +diff --git a/nss/nsswitch.c b/nss/nsswitch.c +index 6b7d4c78..c9d7e372 100644 +--- a/nss/nsswitch.c ++++ b/nss/nsswitch.c +@@ -133,7 +133,7 @@ libc_hidden_def (__nss_next2) + void * + __nss_lookup_function (nss_action_list ni, const char *fct_name) + { +- if (ni->module == NULL) ++ if (ni == NULL || ni->module == NULL) + return NULL; + return __nss_module_get_function (ni->module, fct_name); + } +-- +2.33.0 + diff --git a/fix_nss_database_check_reload_and_get_memleak.patch b/fix_nss_database_check_reload_and_get_memleak.patch new file mode 100644 index 0000000..6fc5789 --- /dev/null +++ b/fix_nss_database_check_reload_and_get_memleak.patch @@ -0,0 +1,38 @@ +From 66c23fa97a1bf8819051f1c358ae5eb38eeefae2 Mon Sep 17 00:00:00 2001 +From: huangyu +Date: Tue, 6 Sep 2022 11:55:40 +0800 +Subject: [PATCH] huawei-fix_nss_database_check_reload_and_get_memleak.patch +The return nss_database_check_reload_adn_get (local, actions, db) does not check +whether the local value is empty before invoking the local interface. + +Signed-off-by: huangyu +--- + nss/nss_database.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/nss/nss_database.c b/nss/nss_database.c +index 54561f03..a503890a 100644 +--- a/nss/nss_database.c ++++ b/nss/nss_database.c +@@ -254,6 +254,8 @@ __nss_configure_lookup (const char *dbname, const char *service_line) + __nss_database_get (db, &result); + + local = nss_database_state_get (); ++ if (local == NULL) ++ return -1; + + result = __nss_action_parse (service_line); + if (result == NULL) +@@ -399,6 +401,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local, + /* Acquire MO is needed because the thread that sets reload_disabled + may have loaded the configuration first, so synchronize with the + Release MO store there. */ ++ if (local == NULL) ++ return false; ++ + if (atomic_load_acquire (&local->data.reload_disabled)) + { + *result = local->data.services[database_index]; +-- +2.33.0 + diff --git a/glibc.spec b/glibc.spec index d3fc828..f91b8e9 100644 --- a/glibc.spec +++ b/glibc.spec @@ -70,7 +70,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 128 +Release: 129 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -325,6 +325,8 @@ Patch9044: add-Wl-z-noseparate-code-for-so.patch %endif Patch9045: display-declaration-fstat-function-make-fstat-call-t.patch +Patch9046: fix-Segmentation-fault-in-nss-module.patch +Patch9047: fix_nss_database_check_reload_and_get_memleak.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -1490,6 +1492,10 @@ fi %endif %changelog +* Mon Aug 7 2023 zhanghao - 2.34-129 +- fix Segmentation fault in nss module +- fix nss database check reload and get memleak + * Fri Jul 28 2023 lixing - 2.34-128 - DESC: Add static PIE support for LoongArch -- Gitee