Bug 574992 - restorecon fails on large file
restorecon fails on large file
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: policycoreutils (Show other bugs)
12
i686 Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-03-18 23:05 EDT by Richard Walker
Modified: 2010-04-14 23:16 EDT (History)
3 users (show)

See Also:
Fixed In Version: policycoreutils-2.0.82-4.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-04-14 23:16:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Richard Walker 2010-03-18 23:05:15 EDT
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 09:45:07 EDT
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 19:34:15 EDT
/sbin/restorecon -R -v ../
does indeed work.
Comment 3 Daniel Walsh 2010-03-22 12:34:39 EDT
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 12:42:16 EDT
Created attachment 401818 [details]
Something like this
Comment 5 Stephen Smalley 2010-03-22 13:05:26 EDT
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 13:10:03 EDT
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 14:46:37 EDT
Fixed in policycoreutils-2.0.81-3.fc12
Comment 8 Fedora Update System 2010-03-22 14:47:01 EDT
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 19:38:13 EDT
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-14 23:16:35 EDT
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.