Bug 574992

Summary: restorecon fails on large file
Product: [Fedora] Fedora Reporter: Richard Walker <walkerrichardj>
Component: policycoreutilsAssignee: Daniel Walsh <dwalsh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dwalsh, mgrepl, sdsmall
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: policycoreutils-2.0.82-4.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-04-15 03:16:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Something like this
none
setfiles/restorecon: Use lstat64 none

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):
policycoreutils-2.0.79-1.fc12.i686


How reproducible:
Completely.

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.
http://admin.fedoraproject.org/updates/policycoreutils-2.0.81-3.fc12

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.