public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux
@ 2013-03-26 18:03 licquia at linuxfoundation dot org
2013-03-28 15:02 ` [Bug libc/15305] " carlos at redhat dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: licquia at linuxfoundation dot org @ 2013-03-26 18:03 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15305
Bug #: 15305
Summary: POSIX problem: pathconf/fpathconf modifies errno for
XFS filesystems on Linux
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: unassigned@sourceware.org
ReportedBy: licquia@linuxfoundation.org
CC: drepper.fsp@gmail.com
Classification: Unclassified
Created attachment 6950
--> http://sourceware.org/bugzilla/attachment.cgi?id=6950
test program to demonstrate the problem
When pointed at a file on a XFS filesystem under Linux, pathconf(path,
_PC_CHOWN_RESTRICTED) attempts to open /proc/sys/fs/xfs/restrict_chown to
determine what it should do. This open fails (because the path is not
supported on recent kernels), which modifies errno.
>From http://pubs.opengroup.org/onlinepubs/009695399/functions/pathconf.html:
"Otherwise, pathconf() or fpathconf() shall return the current variable value
for the file or directory without changing errno."
(describing non-error situations)
I've attached a test program, which takes a path to test as its argument.
Here's the behavior I see on Fedora 18, with ext4 as the regular filesystem and
an XFS loopback filesystem on ./mountpoint:
[licquia@lflap5 lsb-bug-3763]$ ./test-pathconf-errno /etc
pathconf returned 1
errno not changed
[licquia@lflap5 lsb-bug-3763]$ ./test-pathconf-errno ./mountpoint
pathconf returned 1
errno changed!
pre = 0
post = 2
The behavior is identical with git HEAD using LD_PRELOAD.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/15305] POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux
2013-03-26 18:03 [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux licquia at linuxfoundation dot org
@ 2013-03-28 15:02 ` carlos at redhat dot com
2013-04-01 11:35 ` siddhesh at redhat dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: carlos at redhat dot com @ 2013-03-28 15:02 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15305
Carlos O'Donell <carlos at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |carlos at redhat dot com
--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> 2013-03-28 15:02:15 UTC ---
Jeff,
Thanks for submitting this.
Take care that you're quoting POSIX 2004, and the most recent standard is 2008.
In this case the 2008 standard is still the same.
I agree that there is a problem here and we'll try to fix this for 2.18.
Siddhesh Poyarekar noted that the XFS proc file we check in glibc is now really
out of date e.g.
...
case XFS_SUPER_MAGIC:
/* Read the value from /proc/sys/fs/xfs/restrict_chown. If we cannot
read it default to assume the restriction is in place. */
fd = open_not_cancel_2 ("/proc/sys/fs/xfs/restrict_chown", O_RDONLY);
if (fd != -1)
{
char buf[2];
if (TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, 2)) == 2
&& buf[0] >= '0' && buf[0] <= '1')
retval = buf[0] - '0';
close_not_cancel_no_status (fd);
}
break;
...
The open_not_cancel_2 fails and that sets errno when it shouldn't.
I don't think we've ever had a good test for this.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/15305] POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux
2013-03-26 18:03 [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux licquia at linuxfoundation dot org
2013-03-28 15:02 ` [Bug libc/15305] " carlos at redhat dot com
@ 2013-04-01 11:35 ` siddhesh at redhat dot com
2013-04-03 6:49 ` siddhesh at redhat dot com
2014-06-13 18:38 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-01 11:35 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15305
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |siddhesh at redhat dot com
AssignedTo|unassigned at sourceware |siddhesh at redhat dot com
|dot org |
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/15305] POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux
2013-03-26 18:03 [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux licquia at linuxfoundation dot org
2013-03-28 15:02 ` [Bug libc/15305] " carlos at redhat dot com
2013-04-01 11:35 ` siddhesh at redhat dot com
@ 2013-04-03 6:49 ` siddhesh at redhat dot com
2014-06-13 18:38 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-03 6:49 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=15305
Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #2 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-03 06:49:32 UTC ---
Fixed in master.
commit d755bba40f880c01ced8740a26fecc85534454b9
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Wed Apr 3 10:56:45 2013 +0530
Preserve errno across _PC_CHOWN_RESTRICTED call on XFS
Fix BZ #15305.
On kernel versions earlier than 2.6.29, the Linux kernel exported a
sysctl called restrict_chown for xfs, which could be used to allow
chown to users other than the owner. 2.6.29 removed this support,
causing the open_not_cancel_2 to fail and thus modify errno. The fix
is to save and restore errno so that the caller sees it as unmodified.
Additionally, since the code to check the sysctl is not useful on
newer kernels, we add an ifdef so that in future the code block gets
rmeoved completely.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/15305] POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux
2013-03-26 18:03 [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux licquia at linuxfoundation dot org
` (2 preceding siblings ...)
2013-04-03 6:49 ` siddhesh at redhat dot com
@ 2014-06-13 18:38 ` fweimer at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:38 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=15305
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-13 18:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 18:03 [Bug libc/15305] New: POSIX problem: pathconf/fpathconf modifies errno for XFS filesystems on Linux licquia at linuxfoundation dot org
2013-03-28 15:02 ` [Bug libc/15305] " carlos at redhat dot com
2013-04-01 11:35 ` siddhesh at redhat dot com
2013-04-03 6:49 ` siddhesh at redhat dot com
2014-06-13 18:38 ` fweimer at redhat dot com
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).