diff mbox series

[kirkstone] glibc: explicit use the internal __time64_t type

Message ID 20230119040416.864574-1-mingli.yu@eng.windriver.com
State New, archived
Headers show
Series [kirkstone] glibc: explicit use the internal __time64_t type | expand

Commit Message

mingli.yu@eng.windriver.com Jan. 19, 2023, 4:04 a.m. UTC
From: Mingli Yu <mingli.yu@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.yu@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

Comments

Randy MacLeod Jan. 19, 2023, 5:41 p.m. UTC | #1
On 2023-01-18 23:04, Yu, Mingli via lists.openembedded.org wrote:
> From: Mingli Yu<mingli.yu@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.

Already covered by:

[OE-core][kirkstone 7/9] glibc: stable 2.35 branch updates.

https://lore.kernel.org/openembedded-core/20230110064813.239677-1-yashinde145@gmail.com/

> Below commits on glibc-2.35 stable branch are updated.
> 293211b6fd time: Use 64 bit time on tzfile
> 26c8278889 nscd: Use 64 bit time_t on libc nscd routines (BZ# 29402)

Above is your patch:
0001-nscd-Use-64-bit-time_t-on-libc-nscd-routines-BZ-2940.patch


> f75f61b659 nis: Build libnsl with 64 bit time_t
> ca97201c24 Apply asm redirections in syslog.h before first use [BZ #27087]
> cad7947db7 elf: Fix wrong fscanf usage on tst-pldd
> e9eb987894 Allow for unpriviledged nested containers
> 2636fbb7ef elf: Fix wrong fscanf usage on tst-pldd
> e7019eeeb5 x86: Fix wcsnlen-avx2 page cross length comparison [BZ #29591]
> fb73a40981 elf: Fix rtld-audit trampoline for aarch64
>
> Signed-off-by: Yash Shinde<Yash.Shinde@windriver.com>


../Randy

>
> 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.yu@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.zanella@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<dj@redhat.com>
> +
> +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa4a19277842fd09a4815a986f70e0fe0903836f;hp=545eefc2f5da61801ba82b7a32ca2589b769ec90]
> +
> +Signed-off-by: Mingli Yu<mingli.yu@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}"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> 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/3616765
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

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.zanella@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 <dj@redhat.com>
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa4a19277842fd09a4815a986f70e0fe0903836f;hp=545eefc2f5da61801ba82b7a32ca2589b769ec90]
+
+Signed-off-by: Mingli Yu <mingli.yu@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}"