public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug time/26814] New: glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit
@ 2020-10-29 20:02 balint at balintreczey dot hu
  2020-10-29 20:07 ` [Bug time/26814] " schwab@linux-m68k.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: balint at balintreczey dot hu @ 2020-10-29 20:02 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26814

            Bug ID: 26814
           Summary: glibc 2.32 leaks errno in sched_rr_get_interval
                    fallback Edit
           Product: glibc
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: time
          Assignee: unassigned at sourceware dot org
          Reporter: balint at balintreczey dot hu
  Target Milestone: ---

When sched_rr_get_interval_time64 is not implemented glibc falls back to
sched_rr_get_interval syscall but does not clear errno.

This breaks 'unhide quick' and a few other unhide commands giving false
positives as a result.

The problem is observed only on armhf in Ubuntu CI.

https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1896281


test.c:
#include <stdio.h>
#include <errno.h>
#include <sched.h>
int main() {
  struct timespec tp;
  errno = 0;
  sched_rr_get_interval(1, &tp);
  perror("error");
  return 0;
}

strace ./a.out
...
sched_rr_get_interval_time64(1, 0xfff88678) = -1 ENOSYS (Function not
implemented)
sched_rr_get_interval(1, {tv_sec=0, tv_nsec=0}) = 0
dup(2) = 3
fcntl64(3, F_GETFL) = 0x402 (flags O_RDWR|O_APPEND)
brk(NULL) = 0x1942000
brk(0x1963000) = 0x1963000
fstat64(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x3), ...}) = 0
write(3, "error: Function not implemented\n", 32error: Function not implemented
) = 32
...

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug time/26814] glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit
  2020-10-29 20:02 [Bug time/26814] New: glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit balint at balintreczey dot hu
@ 2020-10-29 20:07 ` schwab@linux-m68k.org
  2020-10-29 20:35 ` balint at balintreczey dot hu
  2020-10-30 12:20 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2020-10-29 20:07 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26814

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
errno is only defined if sched_rr_get_interval returns -1.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug time/26814] glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit
  2020-10-29 20:02 [Bug time/26814] New: glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit balint at balintreczey dot hu
  2020-10-29 20:07 ` [Bug time/26814] " schwab@linux-m68k.org
@ 2020-10-29 20:35 ` balint at balintreczey dot hu
  2020-10-30 12:20 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: balint at balintreczey dot hu @ 2020-10-29 20:35 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26814

--- Comment #2 from Balint Reczey <balint at balintreczey dot hu> ---
root@gg-armhf:~# cat test.c 
#include <stdio.h>
#include <errno.h>
#include <sched.h>
int main() {
  struct timespec tp;
  errno = 0;
  int ret = sched_rr_get_interval(1, &tp);
  printf("ret == %d\n", ret);
  perror("error");
  return 0;
}
root@gg-armhf:~# ./a.out 
ret == 0
error: Function not implemented
root@gg-armhf:~#

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug time/26814] glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit
  2020-10-29 20:02 [Bug time/26814] New: glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit balint at balintreczey dot hu
  2020-10-29 20:07 ` [Bug time/26814] " schwab@linux-m68k.org
  2020-10-29 20:35 ` balint at balintreczey dot hu
@ 2020-10-30 12:20 ` adhemerval.zanella at linaro dot org
  2 siblings, 0 replies; 4+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2020-10-30 12:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26814

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
I think this is similar (In reply to Balint Reczey from comment #2)
> root@gg-armhf:~# cat test.c 
> #include <stdio.h>
> #include <errno.h>
> #include <sched.h>
> int main() {
>   struct timespec tp;
>   errno = 0;
>   int ret = sched_rr_get_interval(1, &tp);
>   printf("ret == %d\n", ret);
>   perror("error");
>   return 0;
> }
> root@gg-armhf:~# ./a.out 
> ret == 0
> error: Function not implemented
> root@gg-armhf:~#

The errno value after a successful call does not give you any meaningful
information.  But I think this is similar to the recent stat y2038 support
where it triggered some invalid used within glibc itself.  I think it would be
better to use INTERNAL_SYSCALL_CALL in such cases and only sets the errno in
case of failure.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-30 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 20:02 [Bug time/26814] New: glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit balint at balintreczey dot hu
2020-10-29 20:07 ` [Bug time/26814] " schwab@linux-m68k.org
2020-10-29 20:35 ` balint at balintreczey dot hu
2020-10-30 12:20 ` adhemerval.zanella at linaro dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).