[v2] pthread: Use 64 bit time_t stat internally for sem_open (BZ #28880)

Message ID 20220214171729.2462574-1-adhemerval.zanella@linaro.org
State Committed
Commit 894755e16e10725c94bec3f910d35730614a7d00
Headers
Series [v2] pthread: Use 64 bit time_t stat internally for sem_open (BZ #28880) |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Adhemerval Zanella Feb. 14, 2022, 5:17 p.m. UTC
  The __sem_check_add_mapping internal stat calls fails with
EOVERFLOW if system time is larger than 32 bit.

It is a missing spot from 52a5fe70a2c fix to use 64 bit stat
internally.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
v2: Fixed title.
---
 sysdeps/pthread/sem_routines.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Adhemerval Zanella Feb. 14, 2022, 5:18 p.m. UTC | #1
I will commit this shortly.

On 14/02/2022 14:17, Adhemerval Zanella wrote:
> The __sem_check_add_mapping internal stat calls fails with
> EOVERFLOW if system time is larger than 32 bit.
> 
> It is a missing spot from 52a5fe70a2c fix to use 64 bit stat
> internally.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> ---
> v2: Fixed title.
> ---
>  sysdeps/pthread/sem_routines.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/pthread/sem_routines.c b/sysdeps/pthread/sem_routines.c
> index 9e1924398d..877e1e8556 100644
> --- a/sysdeps/pthread/sem_routines.c
> +++ b/sysdeps/pthread/sem_routines.c
> @@ -25,7 +25,7 @@
>  struct inuse_sem
>  {
>    dev_t dev;
> -  ino_t ino;
> +  ino64_t ino;
>    int refcnt;
>    sem_t *sem;
>    char name[];
> @@ -34,7 +34,7 @@ struct inuse_sem
>  struct search_sem
>  {
>    dev_t dev;
> -  ino_t ino;
> +  ino64_t ino;
>    int refcnt;
>    sem_t *sem;
>    char name[NAME_MAX + 1];
> @@ -77,8 +77,8 @@ __sem_check_add_mapping (const char *name, int fd, sem_t *existing)
>    sem_t *result = SEM_FAILED;
>  
>    /* Get the information about the file.  */
> -  struct stat64 st;
> -  if (__fstat64 (fd, &st) == 0)
> +  struct __stat64_t64 st;
> +  if (__fstat64_time64 (fd, &st) == 0)
>      {
>        /* Get the lock.  */
>        lll_lock (sem_mappings_lock, LLL_PRIVATE);
  

Patch

diff --git a/sysdeps/pthread/sem_routines.c b/sysdeps/pthread/sem_routines.c
index 9e1924398d..877e1e8556 100644
--- a/sysdeps/pthread/sem_routines.c
+++ b/sysdeps/pthread/sem_routines.c
@@ -25,7 +25,7 @@ 
 struct inuse_sem
 {
   dev_t dev;
-  ino_t ino;
+  ino64_t ino;
   int refcnt;
   sem_t *sem;
   char name[];
@@ -34,7 +34,7 @@  struct inuse_sem
 struct search_sem
 {
   dev_t dev;
-  ino_t ino;
+  ino64_t ino;
   int refcnt;
   sem_t *sem;
   char name[NAME_MAX + 1];
@@ -77,8 +77,8 @@  __sem_check_add_mapping (const char *name, int fd, sem_t *existing)
   sem_t *result = SEM_FAILED;
 
   /* Get the information about the file.  */
-  struct stat64 st;
-  if (__fstat64 (fd, &st) == 0)
+  struct __stat64_t64 st;
+  if (__fstat64_time64 (fd, &st) == 0)
     {
       /* Get the lock.  */
       lll_lock (sem_mappings_lock, LLL_PRIVATE);