Bug 448591 - blkid command does not work for unprivileged users
Summary: blkid command does not work for unprivileged users
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: e2fsprogs
Version: 9
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-05-27 18:31 UTC by Kevin Arunski
Modified: 2009-06-10 01:56 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-06-10 01:56:20 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Kevin Arunski 2008-05-27 18:31:55 UTC
Description of problem:
The blkid command does not return any output when run as a non-privileged user.
In Fedora 8, the blkid command would return information like volume UUIDs to a
user without access to the underlying block device by reading from the file
/etc/blkid/blkid.tab.  In Fedora 9 this doesn't work.  Strace shows that blkid
attempts to open the block device and fails.

Version-Release number of selected component (if applicable):
e2fsprogs-1.40.8-2.fc9.x86_64

How reproducible:
always

Steps to Reproduce:
1. Login as a user with no r/w access to block devices
2. /sbin/blkid

  
Actual results:
No output is produced. Program exits with status 2.

Expected results:
Program should display volume UUIDs, labels, etc.

Additional info:
This is a regression from Fedora 8.

Comment 1 Eric Sandeen 2008-05-27 19:23:31 UTC
Thanks for the report.

On F8 it looks like it opens & reads blkid.tab, tries to open the bdev & fails,
but prints the cached info anyway, without setting the VERIFIED flag.

On F9 it does almost the same, but looks like it exits on the device open failure.

This is the mod that changed the behavior:

http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commitdiff;h=838f133c72a583eae67414368e46ee0303e0a51f

diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index e87c0b9..917447b 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -1155,7 +1155,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
 	if (((probe.fd = open(dev->bid_name, O_RDONLY)) < 0) ||
 	    (fstat(probe.fd, &st) < 0)) {
 		if (probe.fd >= 0) close(probe.fd);
-		if (errno == ENXIO || errno == ENODEV || errno == ENOENT) {
+		if (errno != EPERM) {
 			blkid_free_dev(dev);
 			return NULL;
 		}

it should probably add "&& errno != EACCES" since that's what we're getting in
this case.

I'll float that upstream.

Thanks,
-Eric

Comment 2 Eric Sandeen 2008-05-27 19:34:17 UTC
Sent upstream:

http://marc.info/?l=linux-ext4&m=121191651317306&w=2

Comment 3 Eric Sandeen 2008-05-27 20:43:43 UTC
Whoops, actually this was already fixed in 1.40.10.  I'll get things updated for F8.

http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commitdiff;h=8bcaaabb1a023af4852dbf0dba76249982c62e40

Comment 4 Eric Sandeen 2008-06-02 21:32:57 UTC
Built in e2fsprogs-1.40.10-fc9 and pushed  to testing...  

Comment 5 Fedora Update System 2008-06-02 21:33:41 UTC
e2fsprogs-1.40.10-1.fc9 has been submitted as an update for Fedora 9

Comment 6 Fedora Update System 2008-06-03 07:27:34 UTC
e2fsprogs-1.40.10-1.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update e2fsprogs'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-4808

Comment 7 Bug Zapper 2009-06-10 01:14:33 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Eric Sandeen 2009-06-10 01:56:20 UTC
Fix is in F9 now, somehow the automatic bug-closer got confused I guess.


Note You need to log in before you can comment on or make changes to this bug.