Bug 618269 - Backing up non-existent files results in changed security context
Backing up non-existent files results in changed security context
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: beakerlib (Show other bugs)
14
All Linux
urgent Severity urgent
: ---
: ---
Assigned To: Petr Šplíchal
Fedora Extras Quality Assurance
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-26 10:34 EDT by Petr Šplíchal
Modified: 2016-05-31 21:40 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-10-07 11:41:31 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)
patch for the selinux context issue + local variables (4.10 KB, patch)
2010-07-27 05:46 EDT, Petr Šplíchal
no flags Details | Diff

  None (edit)
Description Petr Šplíchal 2010-07-26 10:34:07 EDT
Description of problem:

When a missing file is rlFileBackup-ed the security context of the
backup path is not correctly saved which results in rlFileRestore
to change the original context to that of the /tmp/ directory.

This is causing many false fails, marking as urgent. Will provide
a patch shortly. Please, deploy as soon as possible.

Version-Release number of selected component (if applicable):
beakerlib-1.3-3.el6.noarch

Steps to Reproduce:
    mkdir /tmp/dir
    chcon --reference /home /tmp/dir
    ls -ldZ /tmp/dir
    rlFileBackup "/tmp/dir/missing"
    rlFileRestore
    ls -ldZ /tmp/dir

Actual results:
drwxr-xr-x. root root system_u:object_r:home_root_t:s0 /tmp/dir
:: [10:28:21] :: [ ERROR   ] :: rlFileBackup: Failed to copy /tmp/dir/missing to /tmp/beakerlib-KwxEtu4/backup/tmp/dir.
drwxr-xr-x. root root unconfined_u:object_r:user_tmp_t:s0 /tmp/dir

Expected results:
drwxr-xr-x. root root system_u:object_r:home_root_t:s0 /tmp/dir
:: [10:28:21] :: [ ERROR   ] :: rlFileBackup: Failed to copy /tmp/dir/missing to /tmp/beakerlib-KwxEtu4/backup/tmp/dir.
drwxr-xr-x. root root system_u:object_r:home_root_t:s0 /tmp/dir
Comment 1 Petr Šplíchal 2010-07-27 05:46:31 EDT
Created attachment 434639 [details]
patch for the selinux context issue + local variables

Fixes the issue, test case included + bonus fix for missed local variables.

Before:

    [ PASS ] Saving the new context
    1c1
    < drwxrwxr-x. psss psss unconfined_u:object_r:httpd_user_content_t:s0 subdir
    ---
    > drwxrwxr-x. psss psss unconfined_u:object_r:user_tmp_t:s0 subdir
    [ FAIL ] Checking security context (BZ#618269)

After:

    [ PASS ] Saving the new context
    [ PASS ] Checking security context (BZ#618269)
Comment 2 Petr Šplíchal 2010-07-27 05:48:24 EDT
Fix ready. Guys, can you someone review soon? Thanks.
Comment 5 Petr Šplíchal 2010-07-27 07:11:26 EDT
Thanks for quick review! Pushed to git:

http://git.fedorahosted.org/git/?p=beakerlib.git;a=commitdiff;h=dfb91c6b27bed1568863cd9adb4b6e6415910668
Comment 6 Bug Zapper 2010-07-30 08:51:26 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 8 Bill Peck 2010-09-30 09:44:12 EDT
This is against beakerlib right?  I don't have commit privs for beakerlib.

pmuller, have you applied this to beakerlib?
Comment 9 Petr Muller 2010-09-30 11:30:37 EDT
It's in repo, but I haven't built any new packages recently. I'll create new builds today or tomorrow.

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