public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27559] New: fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory
@ 2021-03-10 21:02 cptpcrd.git at gmail dot com
2021-03-10 21:41 ` [Bug libc/27559] " adhemerval.zanella at linaro dot org
2021-03-11 13:55 ` adhemerval.zanella at linaro dot org
0 siblings, 2 replies; 3+ messages in thread
From: cptpcrd.git at gmail dot com @ 2021-03-10 21:02 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27559
Bug ID: 27559
Summary: fstat(AT_FDCWD) succeeds (it shouldn't) and returns
information for the current directory
Product: glibc
Version: 2.33
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: cptpcrd.git at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
This can be easily reproduced in Python:
```
>>> import os
>>> os.fstat(-100) # AT_FDCWD is -100; this should fail with EBADF
```
Or in C:
```
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
int main() {
struct stat st;
// This call should fail with EBADF (bad file descriptor)
if(fstat(AT_FDCWD, &st) < 0) {
perror(NULL);
return 1;
}
return 0;
}
```
This seems to have appeared in glibc 2.33.
I strongly suspect that this regression was introduced in one of these commits:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=4d97cc8cf3da925fd06fc37d4daebafce3247719
or
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=30f1c7439489bf756a45e349d69be1826e0c9bd8
(I'm not familiar with glibc's source layout, so I'm not sure which fstat.c
actually gets compiled on Linux).
musl libc had a similar issue:
https://git.etalabs.net/cgit/musl/commit/?id=eeff60608c7aa65806c7c9f0ebddcf2520684ffa
The glibc fix would probably be similar.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27559] fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory
2021-03-10 21:02 [Bug libc/27559] New: fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory cptpcrd.git at gmail dot com
@ 2021-03-10 21:41 ` adhemerval.zanella at linaro dot org
2021-03-11 13:55 ` adhemerval.zanella at linaro dot org
1 sibling, 0 replies; 3+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-03-10 21:41 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27559
Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
CC| |adhemerval.zanella at linaro dot o
| |rg
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-03-10
Assignee|unassigned at sourceware dot org |adhemerval.zanella at linaro dot o
| |rg
--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Confirmed, now that we implement fstat with fstatat we should return EBADF for
negative input.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libc/27559] fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory
2021-03-10 21:02 [Bug libc/27559] New: fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory cptpcrd.git at gmail dot com
2021-03-10 21:41 ` [Bug libc/27559] " adhemerval.zanella at linaro dot org
@ 2021-03-11 13:55 ` adhemerval.zanella at linaro dot org
1 sibling, 0 replies; 3+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2021-03-11 13:55 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=27559
Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Target Milestone|--- |2.34
Resolution|--- |FIXED
--- Comment #2 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.34 and I will backport to 2.33 as well.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-11 13:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 21:02 [Bug libc/27559] New: fstat(AT_FDCWD) succeeds (it shouldn't) and returns information for the current directory cptpcrd.git at gmail dot com
2021-03-10 21:41 ` [Bug libc/27559] " adhemerval.zanella at linaro dot org
2021-03-11 13:55 ` 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).