From: Mingli Yu <mingli...@windriver.com>

Backport a patch [1] to explicit use the internal __time64_t type
to fix the issue that nscd wrongly cut /etc/hosts to be /hosts on
32bits system.

Before the patch:
  root@qemux86:~# systemctl status nscd
* nscd.service - Name Service Cache Daemon
     Loaded: loaded (/lib/systemd/system/nscd.service; enabled; vendor preset: 
enabled)
     Active: active (running) since Mon 2022-07-25 09:17:41 UTC; 41s ago
    Process: 264 ExecStart=/usr/sbin/nscd (code=exited, status=0/SUCCESS)
   Main PID: 267 (nscd)
      Tasks: 10 (limit: 4810)
     Memory: 992.0K
     CGroup: /system.slice/nscd.service
             `-267 /usr/sbin/nscd

Jul 25 09:17:57 qemux86 nscd[267]: 267 checking for monitored file `/hosts': No 
such file or directory
Jul 25 09:17:59 qemux86 nscd[267]: 267 checking for monitored file 
`/nsswitch.conf': No such file or directory
Jul 25 09:17:59 qemux86 nscd[267]: 267 checking for monitored file `/services': 
No such file or directory
Jul 25 09:18:13 qemux86 nscd[267]: 267 checking for monitored file 
`/nsswitch.conf': No such file or directory
Jul 25 09:18:13 qemux86 nscd[267]: 267 checking for monitored file 
`/resolv.conf': No such file or directory
Jul 25 09:18:13 qemux86 nscd[267]: 267 checking for monitored file `/hosts': No 
such file or directory
Jul 25 09:18:14 qemux86 nscd[267]: 267 checking for monitored file 
`/nsswitch.conf': No such file or directory
Jul 25 09:18:14 qemux86 nscd[267]: 267 checking for monitored file `/services': 
No such file or directory
Jul 25 09:18:18 qemux86 nscd[267]: 267 checking for monitored file 
`/nsswitch.conf': No such file or directory
Jul 25 09:18:18 qemux86 nscd[267]: 267 checking for monitored file `/passwd': 
No such file or directory
Jul 25 09:18:28 qemux86 nscd[267]: 267 checking for monitored file 
`/nsswitch.conf': No such file or directory
Jul 25 09:18:28 qemux86 nscd[267]: 267 checking for monitored file 
`/resolv.conf': No such file or directory
Jul 25 09:18:28 qemux86 nscd[267]: 267 checking for monitored file `/hosts': No 
such file or directory

After the patch:
  root@qemux86:~# systemctl status nscd
* nscd.service - Name Service Cache Daemon
     Loaded: loaded (/lib/systemd/system/nscd.service; enabled; vendor preset: 
enabled)
     Active: active (running) since Wed 2022-10-26 05:24:41 UTC; 55s ago
    Process: 235 ExecStart=/usr/sbin/nscd (code=exited, status=0/SUCCESS)
   Main PID: 240 (nscd)
      Tasks: 10 (limit: 4812)
     Memory: 716.0K
     CGroup: /system.slice/nscd.service
             `- 240 /usr/sbin/nscd

Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring directory `/etc` (2)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring file `/etc/passwd` (1)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring directory `/etc` (2)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring file `/etc/nsswitch.conf` (6)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring directory `/etc` (2)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring file `/etc/group` (3)
Oct 26 05:24:45 qemux86 nscd[240]: 240 monitoring directory `/etc` (2)
Oct 26 05:24:58 qemux86 nscd[240]: 240 monitored file `/etc/resolv.conf` 
changed (mtime)
Oct 26 05:24:58 qemux86 nscd[240]: 240 monitoring file `/etc/resolv.conf` (7)
Oct 26 05:24:58 qemux86 nscd[240]: 240 monitoring directory `/etc` (2)

[1] 
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa4a19277842fd09a4815a986f70e0fe0903836f;hp=545eefc2f5da61801ba82b7a32ca2589b769ec90

Signed-off-by: Mingli Yu <mingli...@windriver.com>
---
 ...time_t-on-libc-nscd-routines-BZ-2940.patch | 46 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.35.bb         |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 
meta/recipes-core/glibc/glibc/0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch

diff --git 
a/meta/recipes-core/glibc/glibc/0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch
 
b/meta/recipes-core/glibc/glibc/0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch
new file mode 100644
index 0000000000..8d324a3074
--- /dev/null
+++ 
b/meta/recipes-core/glibc/glibc/0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch
@@ -0,0 +1,46 @@
+From 3d89d36bb2c7f91fee0d81226234205126971eb7 Mon Sep 17 00:00:00 2001
+From: Adhemerval Zanella Netto <adhemerval.zane...@linaro.org>
+Date: Wed, 26 Oct 2022 12:29:18 +0800
+Subject: [PATCH] nscd: Use 64 bit time_t on libc nscd routines (BZ# 29402)
+
+Although the nscd module is built with 64 bit time_t, the routines
+linked direct to libc.so need to use the internal symbols.
+Reviewed-by: DJ Delorie <d...@redhat.com>
+
+Upstream-Status: Backport 
[https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa4a19277842fd09a4815a986f70e0fe0903836f;hp=545eefc2f5da61801ba82b7a32ca2589b769ec90]
+
+Signed-off-by: Mingli Yu <mingli...@windriver.com>
+---
+ nscd/nscd.h          | 2 +-
+ nscd/nscd_gethst_r.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/nscd/nscd.h b/nscd/nscd.h
+index 368091aef8..f15321585b 100644
+--- a/nscd/nscd.h
++++ b/nscd/nscd.h
+@@ -65,7 +65,7 @@ typedef enum
+ struct traced_file
+ {
+   /* Tracks the last modified time of the traced file.  */
+-  time_t mtime;
++  __time64_t mtime;
+   /* Support multiple registered files per database.  */
+   struct traced_file *next;
+   int call_res_init;
+diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
+index 9becb62033..31c64275f0 100644
+--- a/nscd/nscd_gethst_r.c
++++ b/nscd/nscd_gethst_r.c
+@@ -112,7 +112,7 @@ __nscd_get_nl_timestamp (void)
+   if (map == NULL
+       || (map != NO_MAPPING
+         && map->head->nscd_certainly_running == 0
+-        && map->head->timestamp + MAPPING_TIMEOUT < time_now ()))
++        && map->head->timestamp + MAPPING_TIMEOUT < time64_now ()))
+     map = __nscd_get_mapping (GETFDHST, "hosts", &__hst_map_handle.mapped);
+ 
+   if (map == NO_MAPPING)
+-- 
+2.25.1
+
diff --git a/meta/recipes-core/glibc/glibc_2.35.bb 
b/meta/recipes-core/glibc/glibc_2.35.bb
index df847e76bf..4352c6edd7 100644
--- a/meta/recipes-core/glibc/glibc_2.35.bb
+++ b/meta/recipes-core/glibc/glibc_2.35.bb
@@ -50,6 +50,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            
file://0024-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
            \
            
file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \
+           
file://0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#176116): 
https://lists.openembedded.org/g/openembedded-core/message/176116
Mute This Topic: https://lists.openembedded.org/mt/96371326/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to