!653 nscd: sync some patches

From: @zhang-hao-jon 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2023-08-08 06:15:19 +00:00 committed by Gitee
commit 53eb4e9b41
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 85 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From f5b9e0f2a8ada29cebeb6e51cbcbea396375ab26 Mon Sep 17 00:00:00 2001
From: huangyu <huangyu106@huawei.com>
Date: Wed, 7 Dec 2022 14:35:26 +0800
Subject: [PATCH] fix Segmentation fault in nss module
Signed-off-by: huangyu <huangyu106@huawei.com>
---
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

View File

@ -0,0 +1,38 @@
From 66c23fa97a1bf8819051f1c358ae5eb38eeefae2 Mon Sep 17 00:00:00 2001
From: huangyu <huangyu106@huawei.com>
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 <huangyu106@huawei.com>
---
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

View File

@ -65,7 +65,7 @@
##############################################################################
Name: glibc
Version: 2.38
Release: 2
Release: 3
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -103,6 +103,8 @@ Patch9014: strcmp-delete-align-for-loop_aligned.patch
Patch9015: add-pthread_cond_clockwait-GLIBC_2_28.patch
Patch9016: add-GB18030-2022-charmap-BZ-30243.patch
Patch9017: 0001-Optimizing-__random-for-single-threaded-scenarios.patch
Patch9018: fix-Segmentation-fault-in-nss-module.patch
Patch9019: fix_nss_database_check_reload_and_get_memleak.patch
Provides: ldconfig rtld(GNU_HASH) bundled(gnulib)
@ -1262,6 +1264,10 @@ fi
%endif
%changelog
* Mon Aug 7 2023 zhanghao<zhanghao383@huawei.com> - 2.38-3
- fix Segmentation fault in nss module
- fix nss database check reload and get memleak
* Wed Aug 2 2023 chenhaixiang<chenhaixiang3@huawei.com> - 2.38-2
- use the released glibc 2.38 version