Bug 574992 - restorecon fails on large file
Summary: restorecon fails on large file
Alias: None
Product: Fedora
Classification: Fedora
Component: policycoreutils
Version: 12
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Daniel Walsh
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2010-03-19 03:05 UTC by Richard Walker
Modified: 2010-04-15 03:16 UTC (History)
3 users (show)

Fixed In Version: policycoreutils-2.0.82-4.fc12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-04-15 03:16:45 UTC
Type: ---

Attachments (Terms of Use)
Something like this (595 bytes, application/octet-stream)
2010-03-22 16:42 UTC, Daniel Walsh
no flags Details
setfiles/restorecon: Use lstat64 (1.30 KB, patch)
2010-03-22 17:10 UTC, Stephen Smalley
no flags Details | Diff

Description Richard Walker 2010-03-19 03:05:15 UTC
Description of problem:
Run restorecon on a large file (libvirt virtual disk):

[root@rowlf images]# ls -l OneBigFile.raw 
-rw-------. 1 root root 17179869184 2010-03-19 13:36 OneBigFile.raw
[root@rowlf images]# /sbin/restorecon -v OneBigFile.raw 
/sbin/restorecon:  lstat(OneBigFile.raw) failed:  Value too large for defined data type

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Run restorecon on a large file.
Actual results:
Error message from lstat.

Expected results:
No complaint from lstat.

Additional info:
Seems restorecon was not built with large file support.
chcon _does_ work OK.

Comment 1 Daniel Walsh 2010-03-19 13:45:07 UTC
Richard does this work if you execute

/sbin/restorecon -R -v ../

In the directory with OneBigFile.raw?

We are using fts.h which does not like -D_FILE_OFFSET_BITS=64 

cc -g -Werror -Wall -W -D_FILE_OFFSET_BITS=64 -I/usr/include -DUSE_AUDIT   -c -o setfiles.o setfiles.c
In file included from restore.h:6,
                 from setfiles.c:1:
/usr/include/fts.h:41:3: error: #error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
make: *** [setfiles.o] Error 1

Comment 2 Richard Walker 2010-03-21 23:34:15 UTC
/sbin/restorecon -R -v ../
does indeed work.

Comment 3 Daniel Walsh 2010-03-22 16:34:39 UTC
Any good ideas on how to fix?

Maybe change the stat to hard code "file" if the stat call fails with this errno.  Since I don't think any other object could get to this size.

Comment 4 Daniel Walsh 2010-03-22 16:42:16 UTC
Created attachment 401818 [details]
Something like this

Comment 5 Stephen Smalley 2010-03-22 17:05:26 UTC
I'd suggest asking glibc folks how to resolve the conflict between fts(3) and _FILE_OFFSET_BITS=64.  We were using _FILE_OFFSET_BITS=64 for setfiles/restorecon when we were still using nftw() before converting to fts().

Comment 6 Stephen Smalley 2010-03-22 17:10:03 UTC
Created attachment 401826 [details]
setfiles/restorecon:  Use lstat64

This patch changes setfiles/restorecon to explicitly use struct stat64 and lstat64().

Comment 7 Daniel Walsh 2010-03-22 18:46:37 UTC
Fixed in policycoreutils-2.0.81-3.fc12

Comment 8 Fedora Update System 2010-03-22 18:47:01 UTC
policycoreutils-2.0.81-3.fc12 has been submitted as an update for Fedora 12.

Comment 9 Fedora Update System 2010-03-23 23:38:13 UTC
policycoreutils-2.0.81-3.fc12 has been pushed to the Fedora 12 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 policycoreutils'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/policycoreutils-2.0.81-3.fc12

Comment 10 Fedora Update System 2010-04-15 03:16:35 UTC
policycoreutils-2.0.82-4.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

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