Summary: | glibc 2.32 leaks errno in sched_rr_get_interval fallback Edit | ||
---|---|---|---|
Product: | glibc | Reporter: | Balint Reczey <balint> |
Component: | time | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED NOTABUG | ||
Severity: | normal | CC: | adhemerval.zanella |
Priority: | P2 | ||
Version: | 2.32 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Balint Reczey
2020-10-29 20:02:02 UTC
errno is only defined if sched_rr_get_interval returns -1. 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:~# 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. |